Commit 57f51c48 by 叶立庆

初始化项目-bi

0 parents
Showing 88 changed files with 4852 additions and 0 deletions
This diff is collapsed. Click to expand it.
package com.glsk;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
}
}
/**
* PlatformMerchantBrand.getBrand2()/
* File file = new File("/app/soft/java_project/appletBusinessAnalysis/品牌.json");
httpGetBrand()的apiUrl //线上 //测试
application.properties 端口/数据库连接切换
my.properties 数据库连接切换
// MerchantStatic、IncreMerchantStatic
// StaffStatic、IncreStaffStatic
// BoutiqueUpgradeMerchant、IncreBoutiqueUpgradeMerchant
// BoutiqueUpgradeStaff 、IncreBoutiqueUpgradeStaff同步
//
// BinlogMonitor5监听 6个任务
// (增量更新每分钟更新一次 :60s) //Thread.sleep(60000);***********
*/
//package com.glsk.compute.bak20240426;
//
//import com.alibaba.fastjson2.JSON;
//import com.alibaba.fastjson2.JSONArray;
//import com.alibaba.fastjson2.JSONObject;
//import com.glsk.compute.brand.*;
//import com.glsk.mapper.DatavMapper;
//import com.glsk.util.MybatisUtil;
//import org.apache.ibatis.session.SqlSession;
//import com.glsk.compute.brand.ReadLocalJsonFileDemo.*;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import java.io.File;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author fangfang
// * @create 2023-07-28 16:26
// * 门店 区域 品牌 映射关系入库:operatebi_boutique_upgrade_brand_merchant2
// */
//
////192.168.5.1/scrm_account:platform_merchant
//public class PlatformMerchantBrand {
// @Autowired
// static DatavMapper datavMapper;
// public static void main(String[] args)throws IOException {
//
// queryBrandByMerchantNo();
// }
//
//
// public static List<Map<String,String>> queryBrandByMerchantNo() throws IOException {
// SqlSession sqlSession = null;
// try {
// sqlSession = MybatisUtil.getsqlSession("scrm_account");
//
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// DatavMapper datavMapper = sqlSession.getMapper(DatavMapper.class);
//
//
// String sql = "select distinct IFNULL(merchantNo,'0')merchantNo,IFNULL(merchant_name,'0')merchant_name, \n" +
// "IFNULL(replace(replace(replace(merchant_brand_cars, char(10), ''),char(13), ''), char(9), ''),'0')merchant_brand_cars,\n" +
// "IFNULL(merchant_address,'0')merchant_address,\n" +
// "IFNULL(province_code,'0')province_code,\n" +
// "IFNULL(province_name,'0')province_name,\n" +
// "IFNULL(lng,0)lng,\n" +
// "IFNULL(lat,0)lat from platform_merchant WHERE del_flag=0 "+
// "" ;// and merchantNo='44210895'
//
// System.out.println("sql="+sql);
// List<Map> totalmaps = datavMapper.sqlBySelf(sql);
//
//
// //获取品牌
// List<Brand> brandList = getBrand2();
//
// List<Map<String,String>> brands = new ArrayList<>();
// List<Map<String,String>> childrenbrands = new ArrayList<>();
// List<Map<String,String>> merBrandMap = new ArrayList<>();
// if(totalmaps.size()!=0){
// for (Map totalmap : totalmaps) {
// if(totalmap!=null){
// if(String.valueOf(totalmap.get("merchant_brand_cars"))!=null ){
// String merchant_brand_cars = String.valueOf(totalmap.get("merchant_brand_cars"));
// String merchantNo = String.valueOf(totalmap.get("merchantNo"));//门店id
// Map<String,String>str=new HashMap<>();
//
// String brandname="";
//
// String[] split = merchant_brand_cars.split(";");
//
// for (String s : split) {
// for (Brand brand : brandList) {
// String id = brand.getId();
// if(id.equals(s)){
// Map<String,String> map01=new HashMap<>();
// map01.put(String.valueOf(brand.getId()),String.valueOf(brand.getLabel()));
// brands.add(map01);
// brandname+=String.valueOf(brand.getLabel())+"/";
// if(String.valueOf(brand.getLabel()).equals("鸿蒙智行")){
// str.put(merchantNo,"鸿蒙智行");
//
// }
//
// }
//
// }
// }
//
// String tmpname=null;
// if(brandname.length()==0){
// tmpname="";
// }else {
// tmpname= brandname.substring(0, brandname.length() - 1);
// StringTruncator.truncateStringWithoutBreakingCharacters(tmpname.replaceAll("\n","").replaceAll("\t","").replaceAll("\\s+", ""), 5000);
// }
// System.out.println();
//// str.put(merchantNo,tmpname);
//// str.put(merchantNo,merchantNo);
// merBrandMap.add(str);
// }
// }
// }
// }
//
//
//
//
//
// sqlSession.commit();
// sqlSession.close();
//
//
// return merBrandMap;
// }
//
//
//
// public static void httpGetBrand(String path) {
// //测试
//// String apiUrl = "https://rop-merchant.test.glsx.com.cn/rop-merchants/router?format=json&sign=3F2D3078064CEBDFA4D07E456BD69C492BD32D36&appKey=48e5e13229b82c1b4e6e8c96151f0637&method=merchants.api.merchantCommon.getCarbrandTree&locale=zh_CN&v=1.0.0";
//// //线上
// String apiUrl = "https://commodity.glsx.com.cn/rop-merchants/router?format=json&sign=3F2D3078064CEBDFA4D07E456BD69C492BD32D36&appKey=48e5e13229b82c1b4e6e8c96151f0637&method=merchants.api.merchantCommon.getCarbrandTree&locale=zh_CN&v=1.0.0";
//// //预发布
//// String apiUrl = "http://rop-merchant.beta.glsx.com.cn/rop-merchants/router?format=json&sign=3F2D3078064CEBDFA4D07E456BD69C492BD32D36&appKey=48e5e13229b82c1b4e6e8c96151f0637&method=merchants.api.merchantCommon.getCarbrandTree&locale=zh_CN&v=1.0.0";
//
// try {
// String responseJson = ApiCaller.callApi(apiUrl);
//// System.out.println();
// MyObject myObject = JsonParser.parseJson(responseJson, MyObject.class);
//
// String jsonFilePath = path; // 替换为您想要保存的文件路径
//
// FileSaver.saveJsonToFile(responseJson, jsonFilePath);
//
// // 或者,如果您想保存解析后的Java对象
// // String objectJson = new Gson().toJson(myObject);
// // FileSaver.saveJsonToFile(objectJson, jsonFilePath);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
//
//
// }
//
//
//
//
//
// public static List<Brand> getBrand2() throws IOException {
//// String path="src/main/resources/config/品牌.json";//本地
// String path="/app/soft/java_project/appletBusinessAnalysis/品牌.json";//测试 生产
//
// httpGetBrand(path);
//
// File file = new File(path);
// JSONObject jsonObject = ReadLocalJsonFileDemo.readerMethod2(file);
//
//
// // 读取json文件的data字段,并转换为json数组
// JSONArray array = jsonObject.getJSONArray("data");
//
// List<Brand> brandList=new ArrayList<>();
// for (int i = 0; i < array.size(); i++) {
// JSONObject json = array.getJSONObject(i);
//// System.out.println("id="+json.getString("id"));
//
// Brand brand =new Brand();
// brand.setId( json.getString("id"));
// brand.setLabel(json.getString("label"));
// brand.setLogoUrl(json.getString("logoUrl"));
// JSONArray children = JSON.parseArray(json.getString("children"));
//
// brandList.add(brand);
//
//
//// if(JSON.parseArray(json.getString("children"))!=null){
//// for (int j = 0; j < children.size(); j++) {
//// Brand brand =new Brand();
//// brand.setId( json.getString("id"));
//// brand.setLabel(json.getString("label"));
//// brand.setLogoUrl(json.getString("logoUrl"));
////
////// JSONObject childrenjson = children.getJSONObject(j);
////// brand.setChildrenid(childrenjson.getString("id"));
////// brand.setChildrenlabel(childrenjson.getString("label"));
////// brand.setChildrenlogoUrl(childrenjson.getString("logoUrl"));
////// brand.setChildrenchildren(childrenjson.getString("children"));
//// brandList.add(brand);
//// }
//// }
// }
//
//// //写到excel
//// String fileName="src/main/resources/resoult/brandList.xlsx";
//// EasyExcel.write(fileName,Brand.class).sheet("Sheet1").doWrite(brandList);
//
// return brandList;
//
// }
//
//
//
//
//}
//package com.glsk.compute.bak20240426;
//
//import com.alibaba.excel.EasyExcel;
//import com.alibaba.excel.annotation.ExcelProperty;
//import com.alibaba.excel.annotation.write.style.ColumnWidth;
//import com.alibaba.fastjson2.JSON;
//import com.alibaba.fastjson2.JSONArray;
//import com.alibaba.fastjson2.JSONObject;
//import lombok.Data;
//
//import java.io.*;
//import java.util.ArrayList;
//import java.util.List;
//
//
///**
// * @author fangfang
// * @create 2023-07-28 14:09
// * 获取门店 区域(省份) 品牌得映射关系
// */
//public class ReadLocalJsonFileDemo {
// public static void main(String[] args) throws IOException {
//// File file = new File("D:\\test.json");
// File file = new File("src/main/resources/config/品牌.json");
// JSONObject jsonObject = readerMethod2(file);
//
//
//
// // 读取json文件的data字段,并转换为json数组
// System.out.println();
// System.out.println();
// System.out.println();
// System.out.println();
// System.out.println();
// System.out.println("======================");
//
// JSONArray array = jsonObject.getJSONArray("data");
// List<Brand> brandList=new ArrayList<>();
// for (int i = 0; i < array.size(); i++) {
// JSONObject json = array.getJSONObject(i);
// System.out.println("id="+json.getString("id"));
//
//
// JSONArray children = JSON.parseArray(json.getString("children"));
// if(JSON.parseArray(json.getString("children"))!=null){
// for (int j = 0; j < children.size(); j++) {
// Brand brand =new Brand();
// brand.setId( json.getString("id"));
// brand.setLabel(json.getString("label"));
// brand.setLogoUrl(json.getString("logoUrl"));
//
// JSONObject childrenjson = children.getJSONObject(j);
// brand.setChildrenid(childrenjson.getString("id"));
// brand.setChildrenlabel(childrenjson.getString("label"));
// brand.setChildrenlogoUrl(childrenjson.getString("logoUrl"));
// brand.setChildrenchildren(childrenjson.getString("children"));
// brandList.add(brand);
// }
// }
// }
//
//// System.out.println(brandList.toString());
//
// String fileName="src/main/resources/resoult/brandList.xlsx";
// EasyExcel.write(fileName, Brand.class).sheet("Sheet1").doWrite(brandList);
//
//
// }
//
//
// public static JSONObject readerMethod(File file) throws IOException {
// FileReader fileReader = new FileReader(file);
// Reader reader = new InputStreamReader(new FileInputStream(file), "Utf-8");
// int ch= 0;
// StringBuffer sb = new StringBuffer();
// while((ch = reader.read()) != -1) {
// sb.append((char) ch);
// }
// fileReader.close();
// reader.close();
// String jsonStr = sb.toString();
// return JSONObject.parseObject(jsonStr);
// }
//
//
//
//
//
// public static JSONObject readerMethod2(File file) throws IOException {
// String filePath = "path/to/your/file.json";
//
// StringBuilder contentBuilder = new StringBuilder();
// try (BufferedReader br = new BufferedReader(new FileReader(file))) {
// String line;
// while ((line = br.readLine()) != null) {
// contentBuilder.append(line).append("\n");// 获取StringBuilder对象的字符串表示形式
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// JSONObject jsonObj = JSONObject.parseObject(contentBuilder.toString()) ; // 将字符串解析为JSONObject对象
//
// // 打印结果
// System.out.println(jsonObj);
//
// return jsonObj;
// }
//
//
//}
//
//@Data
//class Brand{
// @ColumnWidth(10)
// @ExcelProperty({"品牌id"})
// private String id ;
// @ColumnWidth(10)
// @ExcelProperty({"品牌名"})
// private String label ;
// @ColumnWidth(10)
// @ExcelProperty({"logo地址"})
// private String logoUrl;
// @ColumnWidth(10)
// @ExcelProperty({"子品牌id"})
// private String childrenid ;
// @ColumnWidth(10)
// @ExcelProperty({"子品牌名称"})
// private String childrenlabel ;
// @ColumnWidth(10)
// @ExcelProperty({"子品牌logo"})
// private String childrenlogoUrl;
// @ColumnWidth(10)
// @ExcelProperty({"子品牌"})
// private String childrenchildren;
//
// public String getChildrenid() {
// return childrenid;
// }
//
// public void setChildrenid(String childrenid) {
// this.childrenid = childrenid;
// }
//
// public String getChildrenlabel() {
// return childrenlabel;
// }
//
// public void setChildrenlabel(String childrenlabel) {
// this.childrenlabel = childrenlabel;
// }
//
// public String getChildrenlogoUrl() {
// return childrenlogoUrl;
// }
//
// public void setChildrenlogoUrl(String childrenlogoUrl) {
// this.childrenlogoUrl = childrenlogoUrl;
// }
//
// public String getChildrenchildren() {
// return childrenchildren;
// }
//
// public void setChildrenchildren(String childrenchildren) {
// this.childrenchildren = childrenchildren;
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getLabel() {
// return label;
// }
//
// public void setLabel(String label) {
// this.label = label;
// }
//
// public String getLogoUrl() {
// return logoUrl;
// }
//
// public void setLogoUrl(String logoUrl) {
// this.logoUrl = logoUrl;
// }
//
//
//}
//
//class ChildrenBrand {
// @ColumnWidth(10)
// @ExcelProperty({"子品牌id"})
// private Integer id ;
// @ColumnWidth(10)
// @ExcelProperty({"子品牌名称"})
// private String label ;
// @ColumnWidth(10)
// @ExcelProperty({"子品牌logo"})
// private String logoUrl;
// @ColumnWidth(10)
// @ExcelProperty({"子品牌"})
// private String children;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getLabel() {
// return label;
// }
//
// public void setLabel(String label) {
// this.label = label;
// }
//
// public String getLogoUrl() {
// return logoUrl;
// }
//
// public void setLogoUrl(String logoUrl) {
// this.logoUrl = logoUrl;
// }
//
// public String getChildren() {
// return children;
// }
//
// public void setChildren(String children) {
// this.children = children;
// }
//}
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
20240426下午16:14分备份员代码
\ No newline at end of file
package com.glsk.compute.brand;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
/**
* @author fangfang
* @create 2024-03-07 14:31
*/
public class ApiCaller {
public static String callApi(String apiUrl) throws Exception {
HttpClient client = HttpClients.createDefault();
HttpGet request = new HttpGet(apiUrl);
HttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();
if (entity != null) {
return EntityUtils.toString(entity);
}
return null;
}
}
\ No newline at end of file
package com.glsk.compute.brand;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
public class FileSaver {
public static void saveJsonToFile(String json, String filePath) throws IOException {
File file = new File(filePath);
FileUtils.writeStringToFile(file, json, "UTF-8");
}
}
\ No newline at end of file
package com.glsk.compute.brand;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.List;
public class JsonParser {
public static <T> T parseJson(String json, Class<T> clazz) {
Gson gson = new Gson();
return gson.fromJson(json, clazz);
}
public static <T> List<T> parseJsonList(String json, Class<T> clazz) {
Gson gson = new Gson();
Type type = new TypeToken<List<T>>(){}.getType();
return gson.fromJson(json, type);
}
}
\ No newline at end of file
package com.glsk.compute.brand;
import java.util.List;
/**
* @author fangfang
* @create 2024-03-07 14:39
*/
public class MyObject {
int code;
String errId;
String message;
List<Data> data;
@Override
public String toString() {
return "MyObject{" +
"code=" + code +
", errId='" + errId + '\'' +
", message='" + message + '\'' +
", data=" + data +
'}';
}
public MyObject() {
}
public MyObject(int code, String errId, String message, List<Data> data) {
this.code = code;
this.errId = errId;
this.message = message;
this.data = data;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getErrId() {
return errId;
}
public void setErrId(String errId) {
this.errId = errId;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<Data> getData() {
return data;
}
public void setData(List<Data> data) {
this.data = data;
}
public static class Data{
String id;
String label;
String logoUrl;
List<Children> children;
public Data(String id, String label, String logoUrl, List<Children> children) {
this.id = id;
this.label = label;
this.logoUrl = logoUrl;
this.children = children;
}
public Data() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getLogoUrl() {
return logoUrl;
}
public void setLogoUrl(String logoUrl) {
this.logoUrl = logoUrl;
}
public List<Children> getChildren() {
return children;
}
public void setChildren(List<Children> children) {
this.children = children;
}
@Override
public String toString() {
return "Data{" +
"id='" + id + '\'' +
", label='" + label + '\'' +
", logoUrl='" + logoUrl + '\'' +
", children=" + children +
'}';
}
public static class Children{
String id;
String label;
String logoUrl;
String children;
@Override
public String toString() {
return "Children{" +
"id='" + id + '\'' +
", label='" + label + '\'' +
", logoUrl='" + logoUrl + '\'' +
", children='" + children + '\'' +
'}';
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getLogoUrl() {
return logoUrl;
}
public void setLogoUrl(String logoUrl) {
this.logoUrl = logoUrl;
}
public String getChildren() {
return children;
}
public void setChildren(String children) {
this.children = children;
}
public Children() {
}
public Children(String id, String label, String logoUrl, String children) {
this.id = id;
this.label = label;
this.logoUrl = logoUrl;
this.children = children;
}
}
}
}
package com.glsk.compute.brand;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author fangfang
* @create 2023-07-28 14:09
* 获取门店 区域(省份) 品牌得映射关系
*/
public class ReadLocalJsonFileDemo {
public static void main(String[] args) throws IOException {
// File file = new File("D:\\test.json");
File file = new File("src/main/resources/config/品牌.json");
JSONObject jsonObject = readerMethod2(file);
// 读取json文件的data字段,并转换为json数组
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println("======================");
JSONArray array = jsonObject.getJSONArray("data");
List<Brand> brandList=new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
JSONObject json = array.getJSONObject(i);
System.out.println("id="+json.getString("id"));
JSONArray children = JSON.parseArray(json.getString("children"));
if(JSON.parseArray(json.getString("children"))!=null){
for (int j = 0; j < children.size(); j++) {
Brand brand =new Brand();
brand.setId( json.getString("id"));
brand.setLabel(json.getString("label"));
brand.setLogoUrl(json.getString("logoUrl"));
JSONObject childrenjson = children.getJSONObject(j);
brand.setChildrenid(childrenjson.getString("id"));
brand.setChildrenlabel(childrenjson.getString("label"));
brand.setChildrenlogoUrl(childrenjson.getString("logoUrl"));
brand.setChildrenchildren(childrenjson.getString("children"));
brandList.add(brand);
}
}
}
// System.out.println(brandList.toString());
String fileName="src/main/resources/resoult/brandList.xlsx";
EasyExcel.write(fileName,Brand.class).sheet("Sheet1").doWrite(brandList);
}
public static JSONObject readerMethod(File file) throws IOException {
FileReader fileReader = new FileReader(file);
Reader reader = new InputStreamReader(new FileInputStream(file), "Utf-8");
int ch= 0;
StringBuffer sb = new StringBuffer();
while((ch = reader.read()) != -1) {
sb.append((char) ch);
}
fileReader.close();
reader.close();
String jsonStr = sb.toString();
return JSONObject.parseObject(jsonStr);
}
public static JSONObject readerMethod2(File file) throws IOException {
String filePath = "path/to/your/file.json";
StringBuilder contentBuilder = new StringBuilder();
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
String line;
while ((line = br.readLine()) != null) {
contentBuilder.append(line).append("\n");// 获取StringBuilder对象的字符串表示形式
}
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObj = JSONObject.parseObject(contentBuilder.toString()) ; // 将字符串解析为JSONObject对象
// 打印结果
System.out.println(jsonObj);
return jsonObj;
}
}
@Data
class Brand{
@ColumnWidth(10)
@ExcelProperty({"品牌id"})
private String id ;
@ColumnWidth(10)
@ExcelProperty({"品牌名"})
private String label ;
@ColumnWidth(10)
@ExcelProperty({"logo地址"})
private String logoUrl;
@ColumnWidth(10)
@ExcelProperty({"子品牌id"})
private String childrenid ;
@ColumnWidth(10)
@ExcelProperty({"子品牌名称"})
private String childrenlabel ;
@ColumnWidth(10)
@ExcelProperty({"子品牌logo"})
private String childrenlogoUrl;
@ColumnWidth(10)
@ExcelProperty({"子品牌"})
private String childrenchildren;
public String getChildrenid() {
return childrenid;
}
public void setChildrenid(String childrenid) {
this.childrenid = childrenid;
}
public String getChildrenlabel() {
return childrenlabel;
}
public void setChildrenlabel(String childrenlabel) {
this.childrenlabel = childrenlabel;
}
public String getChildrenlogoUrl() {
return childrenlogoUrl;
}
public void setChildrenlogoUrl(String childrenlogoUrl) {
this.childrenlogoUrl = childrenlogoUrl;
}
public String getChildrenchildren() {
return childrenchildren;
}
public void setChildrenchildren(String childrenchildren) {
this.childrenchildren = childrenchildren;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getLogoUrl() {
return logoUrl;
}
public void setLogoUrl(String logoUrl) {
this.logoUrl = logoUrl;
}
}
class ChildrenBrand {
@ColumnWidth(10)
@ExcelProperty({"子品牌id"})
private Integer id ;
@ColumnWidth(10)
@ExcelProperty({"子品牌名称"})
private String label ;
@ColumnWidth(10)
@ExcelProperty({"子品牌logo"})
private String logoUrl;
@ColumnWidth(10)
@ExcelProperty({"子品牌"})
private String children;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getLogoUrl() {
return logoUrl;
}
public void setLogoUrl(String logoUrl) {
this.logoUrl = logoUrl;
}
public String getChildren() {
return children;
}
public void setChildren(String children) {
this.children = children;
}
}
\ No newline at end of file
package com.glsk.compute.brand;
/**
* @author fangfang
* @create 2024-03-07 22:16
*/
public class StringTruncator {
/**
* Truncate a string to a maximum length without breaking any multi-byte characters.
*
* @param inputString The string to be truncated.
* @param maxLength The maximum length of the resulting string.
* @return The truncated string.
*/
public static String truncateStringWithoutBreakingCharacters(String inputString, int maxLength) {
if (inputString == null || inputString.length() <= maxLength) {
return inputString;
}
// Convert the string to a character array
char[] chars = inputString.toCharArray();
int indexToTruncate = 0;
// Iterate over the characters to find a safe index to truncate
for (int i = 0; i < chars.length; i++) {
// Check if the current character is a surrogate pair (UTF-16)
if (Character.isHighSurrogate(chars[i])) {
// If it's a surrogate pair, move to the next character
if (i + 1 < chars.length && Character.isLowSurrogate(chars[i + 1])) {
i++;
}
}
// If the current character is not a surrogate pair or it's the second part of a surrogate pair
// Check if truncating at this index will result in a string of the desired length or shorter
if (i >= maxLength) {
indexToTruncate = i;
break;
}
}
// Truncate the string by creating a new string from the character array up to the safe index
return new String(chars, 0, indexToTruncate);
}
public static void main(String[] args) {
String longString = "这是一个非常长的中英文混合字符串,包含各种标点符号!1234567890\n\n\n" +
"fergrngjkrnf的时间反舰导弹\t\t12315545";
int maxLength = 50; // 设置截断的最大长度
String truncatedString = StringTruncator.truncateStringWithoutBreakingCharacters(longString, maxLength);
String ddd =truncateString(truncatedString,40);
System.out.println("Original String: " + longString);
System.out.println("Truncated String: " + truncatedString);
// System.out.println("ddd: " + ddd);
System.out.println("=======: " + longString.replaceAll("\n","").replaceAll("\t",""));
}
public static String truncateString(String inputString, int maxLength) {
if (inputString == null || inputString.length() <= maxLength) {
return inputString;
}
StringBuilder sb = new StringBuilder();
int currentLength = 0;
boolean insideWord = false; // Flag to track if we are inside a word
for (int i = 0; i < inputString.length(); i++) {
char c = inputString.charAt(i);
// Check if the character is a newline or a whitespace
if (Character.isWhitespace(c)) {
insideWord = false; // Reset the flag if we are at a whitespace
} else {
if (!insideWord && currentLength + 1 > maxLength) {
// If we are not inside a word and adding the next character would exceed the maxLength,
// truncate the string here
return sb.toString();
}
insideWord = true; // Set the flag to true if we are inside a word
}
// Add the character to the StringBuilder
sb.append(c);
currentLength++;
// Check if we have reached the maxLength, and if so, break the loop
if (currentLength > maxLength) {
break;
}
}
// If the string was truncated in the middle of a word, remove the last character to avoid splitting words
if (insideWord && sb.length() > 0) {
sb.setLength(sb.length() - 1);
}
return sb.toString();
}
}
\ No newline at end of file
This diff could not be displayed because it is too large.
//package com.glsk.compute.listen;
//
//import com.github.shyiko.mysql.binlog.BinaryLogClient;
//import com.github.shyiko.mysql.binlog.event.EventData;
//import com.github.shyiko.mysql.binlog.event.TableMapEventData;
//import com.glsk.compute.StaffStatic;
//import com.glsk.util.ConfigurationManager;
//import com.glsk.util.DateUtils;
//import com.google.common.collect.Queues;
//import lombok.extern.slf4j.Slf4j;
////import org.apache.tomcat.util.threads.ThreadPoolExecutor;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.stereotype.Component;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.*;
//import java.util.concurrent.ThreadPoolExecutor;
//import java.util.concurrent.Executors;
//
///**
// * @author fangfang
// * @create 2024-04-08 18:04
// */
//
//@Component
//@Slf4j //用于打印日志
//public class BinlogMonitor2 implements ApplicationRunner {
//
//
// @Override
// public void run(ApplicationArguments args) {
//
// BlockingQueue<String> queue01 = new LinkedBlockingQueue<>(10); // 创建一个容量为10的阻塞队列
//// BlockingQueue<String> queue02 = new LinkedBlockingQueue<>(10); // 创建一个容量为10的阻塞队列
// BlockingQueue<String> queue03 = new LinkedBlockingQueue<>(10); // 创建一个容量为10的阻塞队列
//
// //监听线程
// //项目启动完成连接bin-log
// Thread thread01=new Thread(() -> {
// String binlogip = ConfigurationManager.getProperty("binlogip");
// Integer binlogport =Integer.valueOf( ConfigurationManager.getProperty("binlogport"));
// String binlogdb = ConfigurationManager.getProperty("binlogdb");
// String binlogusername = ConfigurationManager.getProperty("binlogusername");
// String binlogpassword = ConfigurationManager.getProperty("binlogpassword");
//
// System.out.println("binlogip="+binlogip);
// System.out.println("binlogport="+binlogport);
// System.out.println("binlogdb="+binlogdb);
// System.out.println("binlogusername="+binlogusername);
// System.out.println("binlogpassword="+binlogpassword);
//
//
// log.info("监控BinLog服务已启动>>>>>>>>>>>>>>>>>>");
// BinaryLogClient logClient = new BinaryLogClient(
// binlogip, binlogport, binlogdb, binlogusername, binlogpassword
// );
//
// logClient.registerEventListener(event -> {
// EventData data = event.getData();
// if (data instanceof TableMapEventData) {
// //只要连接的MySQL发生的增删改的操作,则都会进入这里,无论哪个数据库
// TableMapEventData tableMapEventData = (TableMapEventData) data;
//
// //
// if(tableMapEventData.getDatabase().equals("dj_smartcarlife")){//不约束表名时,监听的是整个库
// if(tableMapEventData.getTable().equals("dj_car_life_goods_order")
// ||tableMapEventData.getTable().equals("dj_car_life_pay_order")
// ||tableMapEventData.getTable().equals("dj_car_life_staff_daily_report")
// ||tableMapEventData.getTable().equals("dj_car_life_staff_target_check")
// ||tableMapEventData.getTable().equals("dj_car_life_merchant_target_config")
// ||tableMapEventData.getTable().equals("dj_car_life_merchant_target_period_config")
// ||tableMapEventData.getTable().equals("dj_car_life_merchant_target_task_config")
// ||tableMapEventData.getTable().equals("dj_car_life_merchant_target_task_config_package")
// ){
//// if(tableMapEventData.getTable().equals("tmp")
//// ){
// // 生产者
// try {
//// String data02 = tableMapEventData.getTable()+"Data " + new Date().toString(); // 生产随机数据
// String data02 = tableMapEventData.getTable(); // 生产随机数据
// queue01.offer(data02); // 将数据放入队列,如果队列满,此操作会阻塞
// queue03.offer(data02); // 将数据放入队列,如果队列满,此操作会阻塞
// System.out.println("生产者(发生变化的表): " + data02);
// } catch (Exception e) {
// Thread.currentThread().interrupt(); // 重新中断线程
// }
//
// }
//
// }}
//
// });
//
// // 开始监听
// try {
// logClient.connect();
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// });
//
// // 创建消费者线程
// Thread thread02=new Thread(() -> {
// try {
// while (true) {
//
// //从队列中批量消费数据
// List<String> list = new ArrayList<>();
// Queues.drain(queue01, list, 10, 60, TimeUnit.SECONDS);//TimeUnit.MINUTES 5条为1批 不足5条时,在2分钟后刷新
// System.out.println("批量消费到的数据量是:{"+list.size()+"}, 数据是: {"+list+"}" );
// String[] arg ={"1970-01-01", DateUtils.getToday()};
//// IncreMerchantStatic.main(arg);
// Thread.sleep(20000);
// System.out.println("门店统计完成...");
// }
// } catch (Exception e) {
// Thread.currentThread().interrupt(); // 重新中断线程
// log.error("缓存队列批量消费异常:{}", e.getMessage());
// }
// });
//
//
//
// // 创建消费者线程
// Thread thread03= new Thread(() -> {
// try {
// while (true) {
// //从队列中批量消费数据
// List<String> list = new ArrayList<>();
// Queues.drain(queue03, list, 10, 30, TimeUnit.SECONDS);//TimeUnit.MINUTES 5条为1批 不足5条时,在1分钟后刷新
// System.out.println("批量消费到的数据量是:{"+list.size()+"}, 数据是: {"+list+"}" );
// String[] arg ={"1970-01-01", DateUtils.getToday()};
// StaffStatic.main(arg);
//// Thread.sleep(30000);
// System.out.println("business_analysis_staff统计完成");
//
// }
// } catch (Exception e) {
// Thread.currentThread().interrupt(); // 重新中断线程
// log.error("缓存队列批量消费异常:{}", e.getMessage());
// }
// });
//
//
//
//
//
// /**
// * 之前用工具类进行创建,有好多参数不能自己设置
// * 咱直接自己手动方式使用 ThreadPoolExecutor 创建一个线程池,自己设置参数
// * 参数一:核心线程数量 不能小于0
// * 参数二:最大线程数 不能小于0,数值大于等于核心线程数量
// * 参数三:空闲临时线程最大存活时间(数值) 不能小于0
// * 参数四:空闲临时线程最大存活时间(单位) 用TimeUnit这个枚举类表示
// * 参数五:任务队列,也就是一个堵塞队列 不能为null
// * 参数六:创建线程的工厂 不能为null
// * 参数七:任务的拒绝策略 不能为null
// */
// ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
// 3, // 核心线程数量
// 3, //最大线程数
// 0, //空闲临时线程最大存活时间(数值)
// TimeUnit.SECONDS ,//空闲临时线程最大存活时间(单位)MILLISECONDS SECONDS
// new ArrayBlockingQueue<>(1),//任务队列,也就是一个堵塞队列,也可以使用LinkedBlockingQueue这个阻塞队列
//// Executors.defaultThreadFactory(),//用线程池工具类Executors创建线程的工厂
// new ThreadPoolExecutor.DiscardPolicy()//任务的拒绝策略中其中一个,丢弃任务并抛出RejectedExecutionException
// );
//
//
// threadPoolExecutor.submit(thread01);
// threadPoolExecutor.submit(thread02);
// threadPoolExecutor.submit(thread03);
// System.out.println("线程池线程数量="+threadPoolExecutor.getPoolSize());
// System.out.println("正在执行任务的线程数量="+threadPoolExecutor.getActiveCount());
// System.out.println("等待执行的任务队列中的任务数量="+threadPoolExecutor.getQueue().size());
// System.out.println("已完成的任务数量="+threadPoolExecutor.getCompletedTaskCount());
//
//
////使用 Executors 执行器自动创建线程池。
//// ExecutorService pool = Executors.newFixedThreadPool(10);
//// pool.execute(thread01);
//// pool.execute(thread02);
//// pool.execute(thread03);
//
// }
//
//}
\ No newline at end of file
//package com.glsk.compute.listen;
//
//
////import org.apache.tomcat.util.threads.ThreadPoolExecutor;
//
///**
// * @author fangfang
// * @create 2024-04-08 18:04
// *
//java -cp appletBusinessAnalysis-1.0-SNAPSHOT.jar -Dloader.main=com.glsk.compute.listen.BinlogMonitor3 org.springframework.boot.loader.PropertiesLauncher
//BinlogMonitor4
// */
//
//import com.glsk.compute.StaffStatic;
//import com.glsk.util.DateUtils;
//import com.glsk.util.MybatisUtil;
//import org.apache.ibatis.session.SqlSession;
//import java.util.concurrent.*;
//
//
//public class BinlogMonitor4 {
// public static void main(String[] args) {
// // 创建连接池
// SqlSession smartcarlifeSession = null;
// SqlSession accountSession = null;
// SqlSession insertSession = null;
// try {
// smartcarlifeSession = MybatisUtil.getsqlSession("dj_smartcarlife");
// accountSession = MybatisUtil.getsqlSession("scrm_account");
// insertSession = MybatisUtil.getsqlSession("insert");
//
//
// // 创建 ThreadPoolExecutor,这里我们只需要3个线程
// ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
// 2, // 核心线程数
// 2, // 最大线程数
// 0, // 空闲线程存活时间
// TimeUnit.SECONDS,
// new ArrayBlockingQueue<>(2) ,// 任务队列
// new ThreadPoolExecutor.DiscardPolicy()
// );
//
//
// System.out.println("线程池线程数量="+threadPoolExecutor.getPoolSize());
// System.out.println("线程池线程最大数量="+threadPoolExecutor.getMaximumPoolSize());
// System.out.println("正在执行任务的线程数量="+threadPoolExecutor.getActiveCount());
// System.out.println("等待执行的任务队列中的任务数量="+threadPoolExecutor.getQueue().size());
// System.out.println("已完成的任务数量="+threadPoolExecutor.getCompletedTaskCount());
//
// // 创建监听器实例
// BinaryLogListener listener = new MyBinaryLogListener();
//
//// System.out.println(Thread.currentThread().getName()+"aaaaaaaaaaa");
//// try {
//// listener.startListening();
//// System.out.println("监听线程的线程名是="+Thread.currentThread().getName());
//// } catch (Exception e) {
//// e.printStackTrace();
//// }
//
//
// // 提交监听任务到线程池
// threadPoolExecutor.execute(() -> {
// try {
// listener.startListening();
// System.out.println("监听线程的线程名是="+Thread.currentThread().getName());
// } catch (Exception e) {
// e.printStackTrace();
// }
// });
//
//
// // 创建消费者线程
// Thread thread02=new Thread(() -> {
// try {
// while (true) {
// // 等待监听器通知
// synchronized (listener) {
// while (!listener.hasBinlogChanged()) {
// listener.wait(); // 等待直到有变动
// }
// listener.resetBinlogChanged(); // 重置变动状态
// }
// // 执行任务
// executeTask();
// }
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
// });
//
//
//
// // 提交任务线程到线程池
// threadPoolExecutor.execute(thread02);
//
//
//
//
//// // 提交任务线程到线程池
//// threadPoolExecutor.execute(() -> {
//// try {
//// while (true) {
//// // 等待监听器通知
//// synchronized (listener) {
//// while (!listener.hasBinlogChanged()) {
//// listener.wait(); // 等待直到有变动
//// }
//// listener.resetBinlogChanged(); // 重置变动状态
//// }
//// // 执行任务
//// executeTask();
//// }
//// } catch (InterruptedException e) {
//// Thread.currentThread().interrupt();
//// }
//// });
//// threadPoolExecutor.execute(() -> {
//// try {
//// while (true) {
//// // 等待监听器通知
//// synchronized (listener) {
//// while (!listener.hasBinlogChanged2()) {
//// listener.wait(); // 等待直到有变动
//// }
//// listener.resetBinlogChanged2(); // 重置变动状态
//// }
//// // 执行任务
//// executeTask2();
//// }
//// } catch (InterruptedException e) {
//// Thread.currentThread().interrupt();
//// }
//// });
//
//
//
// System.out.println("线程池线程数量="+threadPoolExecutor.getPoolSize());
// System.out.println("正在执行任务的线程数量="+threadPoolExecutor.getActiveCount());
// System.out.println("等待执行的任务队列中的任务数量="+threadPoolExecutor.getQueue().size());
// System.out.println("已完成的任务数量="+threadPoolExecutor.getCompletedTaskCount());
//
// threadPoolExecutor.shutdown();
// } catch (Exception e) {
// e.printStackTrace();
// }
//
//
//
//
// }
//
//// private static void executeTask(SqlSession finalSmartcarlifeSession, SqlSession finalAccountSession, SqlSession finalInsertSession) {
// private static void executeTask() {
// System.out.println("《门店维度统计》开始...");
// try {
// String[] arg ={"1970-01-01", DateUtils.getToday()};
// Test.main(arg);
// Thread.currentThread().join();
//
//// Thread.sleep(30000);
//// IncreMerchantStatic.main(arg);
//// IncreMerchantStatic.runJob(finalSmartcarlifeSession, finalAccountSession, finalInsertSession);
// System.out.println("《门店维度统计》结束...,线程名是="+Thread.currentThread().getName());
// } catch (Exception e) {
// Thread.currentThread().interrupt();
// }
// }
//
////
// private static void executeTask2() {
// System.out.println("《员工维度统计》开始...");
// try {
// String[] arg ={"1970-01-01", DateUtils.getToday()};
// StaffStatic.main(arg);
//// Test.main(arg);
// System.out.println("《员工维度统计》结束...,线程名是="+Thread.currentThread().getName());
// } catch (Exception e) {
// Thread.currentThread().interrupt();
// }
// }
//
//
//
//}
package com.glsk.compute.listen;
import com.github.shyiko.mysql.binlog.BinaryLogClient;
import com.github.shyiko.mysql.binlog.event.EventData;
import com.github.shyiko.mysql.binlog.event.TableMapEventData;
import com.glsk.util.ConfigurationManager;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
/**
* @author fangfang
* @create 2024-04-24 11:49
*/
// BinaryLogListener 接口
interface BinaryLogListener {
void startListening();
void stopListening();
void onBinlogChange(); // 通知变动
boolean hasBinlogChanged(); // 检查是否有变动
void resetBinlogChanged(); // 重置变动状态
void onBinlogChange2(); // 通知变动
boolean hasBinlogChanged2(); // 检查是否有变动
void resetBinlogChanged2(); // 重置变动状态
void onBinlogChange3(); // 通知变动
boolean hasBinlogChanged3(); // 检查是否有变动
void resetBinlogChanged3(); // 重置变动状态
void onBinlogChange4(); // 通知变动
boolean hasBinlogChanged4(); // 检查是否有变动
void resetBinlogChanged4(); // 重置变动状态
}
//@Slf4j
class MyBinaryLogListener implements BinaryLogListener {
private volatile boolean binlogChanged = false;
private volatile boolean binlogChanged02 = false;
private volatile boolean binlogChanged03 = false;
private volatile boolean binlogChanged04 = false;
private Thread listeningThread;
private volatile boolean running = true;
@Override
public void startListening() {
String binlogip = ConfigurationManager.getProperty("binlogip");
Integer binlogport =Integer.valueOf( ConfigurationManager.getProperty("binlogport"));
String binlogdb = ConfigurationManager.getProperty("binlogdb");
String binlogusername = ConfigurationManager.getProperty("binlogusername");
String binlogpassword = ConfigurationManager.getProperty("binlogpassword");
// System.out.println("binlogip="+binlogip);
// System.out.println("binlogport="+binlogport);
// System.out.println("binlogdb="+binlogdb);
// System.out.println("binlogusername="+binlogusername);
// System.out.println("binlogpassword="+binlogpassword);
// log.info("监控BinLog服务已启动>>>>>>>>>>>>>>>>>>");
BinaryLogClient logClient = new BinaryLogClient(
binlogip, binlogport, binlogdb, binlogusername, binlogpassword
);
listeningThread = new Thread(() -> {
logClient.registerEventListener(event -> {
EventData data = event.getData();
if (data instanceof TableMapEventData) {
//只要连接的MySQL发生的增删改的操作,则都会进入这里,无论哪个数据库
TableMapEventData tableMapEventData = (TableMapEventData) data;
if(tableMapEventData.getDatabase().equals("dj_smartcarlife")){//不约束表名时,监听的是整个库
if(tableMapEventData.getTable().equals("dj_car_life_goods_order")
||tableMapEventData.getTable().equals("dj_car_life_pay_order")
||tableMapEventData.getTable().equals("dj_car_life_staff_daily_report")
||tableMapEventData.getTable().equals("dj_car_life_staff_target_check")
||tableMapEventData.getTable().equals("dj_car_life_merchant_target_config")
||tableMapEventData.getTable().equals("dj_car_life_merchant_target_period_config")
||tableMapEventData.getTable().equals("dj_car_life_merchant_target_task_config")
||tableMapEventData.getTable().equals("dj_car_life_merchant_target_task_config_package")
||tableMapEventData.getTable().equals("dj_car_life_service_merchant_staff_allocation")
||tableMapEventData.getTable().equals("dj_car_life_shop_merchant_config")
){
// if(tableMapEventData.getTable().equals("tmp")){
// System.out.println(" binlog 有变动 ,变动的表 ="+tableMapEventData.getTable());
binlogChanged = true;//
binlogChanged02 = true;//
binlogChanged03 = true;//
binlogChanged04 = true;//
onBinlogChange(); // 通知任务线程
onBinlogChange2(); // 通知任务线程2
onBinlogChange3(); // 通知任务线程
onBinlogChange4(); // 通知任务线程2
}
}}
});
// 开始监听
try {
logClient.connect();
} catch (IOException e) {
e.printStackTrace();
}
// }
});
listeningThread.start();
}
@Override
public void stopListening() {
running = false;
try {
listeningThread.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
@Override
public void onBinlogChange() {
synchronized (this) {
if (binlogChanged) {
notify(); // 通知等待的任务线程
}
}
}
@Override
public boolean hasBinlogChanged() {
return binlogChanged;
}
@Override
public void resetBinlogChanged() {
binlogChanged = false;
}
@Override
public void onBinlogChange2() {
synchronized (this) {
if (binlogChanged02) {
notify(); // 通知等待的任务线程
}
}
}
@Override
public boolean hasBinlogChanged2() {
return binlogChanged02;
}
@Override
public void resetBinlogChanged2() {
binlogChanged02 = false;
}
@Override
public void onBinlogChange3() {
synchronized (this) {
if (binlogChanged03) {
notify(); // 通知等待的任务线程
}
}
}
@Override
public boolean hasBinlogChanged3() {
return binlogChanged03;
}
@Override
public void resetBinlogChanged3() {
binlogChanged03 = false;
}
@Override
public void onBinlogChange4() {
synchronized (this) {
if (binlogChanged04) {
notify(); // 通知等待的任务线程
}
}
}
@Override
public boolean hasBinlogChanged4() {
return binlogChanged04;
}
@Override
public void resetBinlogChanged4() {
binlogChanged04 = false;
}
}
package com.glsk.compute.listen;
import com.glsk.util.DateUtils;
import java.util.List;
import java.util.Map;
public class Test {
public static void main(String[] args) {
String wherecartypeids="and id in ()";
String sql="\n" +
" select distinct id,car_series_id ,energy_desc,\n" +
" (case\n" +
" when energy_desc in ('CNG','增程式','插电式混合动力','柴油+48V轻混系统','氢燃料','汽油+24V轻混系统','汽油+48V轻混系统','汽油+CNG','汽油+天然气','汽油电驱','油电混合','甲醇混动','纯电动') then '新能源'\n" +
" when energy_desc in ('柴油','汽油')then '燃油'\n" +
" else ''\n" +
" end\n" +
" )动力类型\n" +
" from platform_cartype where energy_desc is not null and energy_desc!='' and energy_desc not like '%-%'\n" +
""+wherecartypeids+" \n" +
" having 动力类型 is not null and 动力类型!=''\n" ;
System.out.println(sql);
String today= DateUtils.getToday();
//scrm
String scrmSql = " " +
"select a.*,ifnull(投保成本,0)投保成本,ifnull(上架成本,0)上架成本 ,ifnull(合计销售底价,0) 合计销售底价 from (\n" +
"\n" +
"\t\t\tselect \n" +
"\t\t\tseo.customer_name 车主名称,seo.contract_no 合同号,seo.success_date 提单成功时间,ifnull(seo.merchant_id,'') 商户ID,ifnull(seo.merchant_name,'') 店铺名称,\n" +
"\t\t\tifnull(sev.vehicle_brand_name,'') 车品牌,\n" +
"\t\t\tifnull(sev.vin,'') 车架号,\n" +
"\t\t\tifnull(sev.invoice_price/100,0) '车辆价格(元)',\n" +
"\t\t\tifnull(sev.invoice_price,0) 车价,ifnull(sev.vehicle_shape_id,'') 车型id,ifnull(sev.vehicle_shape_name,'') 车型,\n" +
"\t\t\tifnull(sev.vehicle_series_id,'') 车系id,ifnull(sev.vehicle_series_name,'') 车系名称,\n" +
"\t\t\tsp.package_name 产品名称,\n" +
"\t\t\tsp.package_code 产品编码,\n" +
"\t\t\tseo.service_period 服务期限,seo.effective_date 生效日期,seo.expiration_date 结束时间\n" +
"\t\t\tfrom (select * from service_equity_order where deleted_flag ='N') seo\n" +
"\t\t\tleft join (select * from service_equity_vehicle where deleted_flag ='N') sev on seo.contract_no = sev.contract_no \n" +
"\t\t\tleft join (select * from service_package where deleted_flag ='N') sp on seo.package_code = sp.package_code and sp.deleted_flag ='N'\n" +
"\t\t\twhere customer_name not like '%测试%' and customer_name not like '%TEST%'and customer_name not like '%test%'and customer_name not like '%张三%'\n" +
"\t\t\tand sev.deleted_flag ='N'and seo.deleted_flag='N' and sp.deleted_flag ='N'\n"+
"\t\t\tand customer_name not like '%ces%'and customer_name not like '%掌声%'and customer_name not like '%王炸%'\n" +
"\t\t\tand merchant_name not like '%测试%' \n" +
"\t\t\tand seo.order_status in(2,5,7,8,9,10,11)\n" +
"\t\t\tand (seo.data_source != 'dj' or seo.data_source is null )\n" +
"\t\t\tand seo.data_source != 'config'\n" +
"\t\t\tand seo.success_date <'"+today+"'\n" +
// "\t\t\torder by seo.contract_no\n" +
"\n" +
")a\n" +
"left join \n" +
"(\n" +
"\n" +
"\t\t\tselect e.contract_no,ifnull(sum( b.monthly_insurance_cost*12*e.service_period/100 ),0)投保成本 from \n" +
"\t\t\t(select * from service_equity_order where deleted_flag ='N') e \n" +
"\t\t\tleft join service_order_items_snapshot b on b.contract_no = e.contract_no\n" +
"\t\t\twhere e.deleted_flag ='N' and e.order_status in(2,5,7,8,9,10,11)\n" +
"\t\t\tand (e.data_source != 'dj' or e.data_source is null)\n" +
"\t\t\tgroup by contract_no\n" +
"\n" +
"\n" +
")投保成本 on a.合同号 = 投保成本.contract_no\n" +
"left join (\n" +
"\t\t\tselect contract_no ,sum(上架成本/100)上架成本, sum(合计销售底价/100) 合计销售底价 from (\n" +
"\t\t\tselect e.contract_no,\n" +
"\t\t\t(case when\n" +
"\t\t\t\t\tf.invoice_price >d.min_price and f.invoice_price <= d.max_price\n" +
"\t\t\t\t\tthen -- 车辆发票价格 须在服务项目配置范围内有效,\n" +
"\t\t\t\t\t\t\t\t(case when e.service_period=d.service_period then d.standard_shelf_cost*d.price_coefficient else 0 end\n" +
"\t\t\t) \n" +
"\t\t\t\t\telse 0 \n" +
"\t\t\tend ) 上架成本, -- 车辆发票价格 不在服务项目配置范围内\n" +
"\t\t\t(case when\n" +
"\t\t\t\t\tf.invoice_price >d.min_price and f.invoice_price <= d.max_price\n" +
"\t\t\t\t\tthen -- 车辆发票价格 须在服务项目配置范围内有效,\n" +
"\t\t\t\t\t\t\t\t(case when e.service_period=d.service_period then d.standard_sales_cost*d.price_coefficient else 0 end\n" +
"\t\t\t) \n" +
"\t\t\t\t\telse 0 \n" +
"\t\t\tend ) 合计销售底价\n" +
"\t\t\tfrom (select * from service_equity_order where deleted_flag ='N') e -- e.service_period,\n" +
"\t\t\tleft JOIN service_order_items_grade_config_snapshot soigs on e.contract_no = soigs.contract_no \n" +
"\t\t\tinner join (select * from service_items_grade_config where deleted_flag ='N') d on soigs.item_grade_config_id = d.id\n" +
"\t\t\tinner join (select * from service_equity_vehicle where deleted_flag ='N') f on e.contract_no=f.contract_no and f.deleted_flag ='N'\n" +
"\t\t\twhere e.deleted_flag ='N' and e.order_status in(2,5,7,8,9,10,11)\n" +
"\t\t\tand (e.data_source != 'dj' or e.data_source is null)\n" +
"\t\t\t)t GROUP BY contract_no\n" +
"\n" +
"\n" +
")上架成本 on a.合同号 = 上架成本.contract_no \n" +
" order by 合同号\n";
System.out.println("scrm_equity.scrmSql=" + scrmSql);
// System.out.println(merRanking.getMerchantid());
// for (ResponseDTO.MerRanking merRanking : detailList) {
// System.out.println(merRanking.getMerchantid()+">>>>>>>>>");
// }
//
//
// ResponseDTO.MerRanking data =new ResponseDTO.MerRanking();
// data.setMerchantid("111111");
//
// System.out.println(detailList.contains(data)+"xxxxxxx");
// MerchantStatic.queryMerchantData("1970-01-01", DateUtils.getToday());
// MerchantStatic.queryMerchantSupervision();//区域督导
// MerchantStatic.queryMerchantStaffFlowData("1970-01-01",DateUtils.getToday());//销售流量贡献
// MerchantStatic.queryMerchantSalesRanking("1970-01-01",DateUtils.getToday());//销售产值排行
// MerchantStatic.queryMerchantServiceBossRanking("1970-01-01",DateUtils.getToday());//服务商老板
// IncreMerchantStatic.queryMerchantData(DateUtils.getDay(1), DateUtils.getToday());
// IncreMerchantStatic.queryMerchantSupervision();//区域督导
// IncreMerchantStatic.queryMerchantStaffFlowData(DateUtils.getDay(1),DateUtils.getToday());//销售流量贡献
// IncreMerchantStatic.queryMerchantSalesRanking(DateUtils.getDay(1),DateUtils.getToday());//销售产值排行
// IncreMerchantStatic.queryMerchantServiceBossRanking(DateUtils.getDay(1),DateUtils.getToday());//服务商老板
// StaffStatic.queryStaffData("1970-01-01", DateUtils.getToday());
// StaffStatic.queryToStoreData("1970-01-01", DateUtils.getToday());
//
// IncreStaffStatic.queryStaffData(DateUtils.getDay(1), DateUtils.getToday());
// IncreStaffStatic.queryToStoreData(DateUtils.getDay(1), DateUtils.getToday());
// BoutiqueUpgradeMerchant.queryBoutiqueMerchantData("1970-01-01", DateUtils.getToday());
// BoutiqueUpgradeMerchant.queryMerchantSalesRanking("1970-01-01",DateUtils.getToday());//销售产值排行
// BoutiqueUpgradeMerchant.queryMerchantServiceBossRanking("1970-01-01",DateUtils.getToday());//服务商老板
// BoutiqueUpgradeMerchant.queryMerchantStaffFlowData("1970-01-01",DateUtils.getToday());//销售流量贡献
//
// IncreBoutiqueUpgradeMerchant.queryBoutiqueMerchantData(DateUtils.getDay(1), DateUtils.getToday());
// IncreBoutiqueUpgradeMerchant.queryMerchantSalesRanking(DateUtils.getDay(1), DateUtils.getToday());
// IncreBoutiqueUpgradeMerchant.queryMerchantServiceBossRanking(DateUtils.getDay(1), DateUtils.getToday());
// IncreBoutiqueUpgradeMerchant.queryMerchantStaffFlowData(DateUtils.getDay(1), DateUtils.getToday());
// BoutiqueUpgradeStaff.queryStaffData("1970-01-01", DateUtils.getToday());
// BoutiqueUpgradeStaff.queryToStoreData("1970-01-01", DateUtils.getToday());
// BoutiqueUpgradeStaff.queryProductData("1970-01-01", DateUtils.getToday());
//
// IncreBoutiqueUpgradeStaff.queryStaffData(DateUtils.getDay(1), DateUtils.getToday());
// IncreBoutiqueUpgradeStaff.queryToStoreData(DateUtils.getDay(1), DateUtils.getToday());
// IncreBoutiqueUpgradeStaff.queryProductData(DateUtils.getDay(1), DateUtils.getToday());
}
}
//package com.glsk.compute.listen.bak;
//
//
////import org.apache.tomcat.util.threads.ThreadPoolExecutor;
//
///**
// * @author fangfang
// * @create 2024-04-08 18:04
// *
//java -cp appletBusinessAnalysis-1.0-SNAPSHOT.jar -Dloader.main=com.glsk.compute.listen.BinlogMonitor3 org.springframework.boot.loader.PropertiesLauncher
//BinlogMonitor4
// */
//
//import com.glsk.compute.fullstaticdata.IncreMerchantStatic;
//import com.glsk.compute.fullstaticdata.StaffStatic;
//import com.glsk.compute.listen.BinaryLogListener;
//import com.glsk.compute.listen.MyBinaryLogListener;
//import com.glsk.util.DateUtils;
//
//import java.util.concurrent.ArrayBlockingQueue;
//import java.util.concurrent.ThreadPoolExecutor;
//import java.util.concurrent.TimeUnit;
//
//public class BinlogMonitor4 {
// public static void main(String[] args) {
// // 创建 ThreadPoolExecutor,这里我们只需要3个线程
// ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
// 3, // 核心线程数
// 3, // 最大线程数
// 0, // 空闲线程存活时间
// TimeUnit.SECONDS,
// new ArrayBlockingQueue<>(5) ,// 任务队列
// new ThreadPoolExecutor.DiscardPolicy()
// );
//
// // 创建监听器实例
// BinaryLogListener listener = new MyBinaryLogListener();
//
// // 提交监听任务到线程池
// threadPoolExecutor.execute(() -> {
// try {
// listener.startListening();
// } catch (Exception e) {
// e.printStackTrace();
// }
// });
//
//
// // 提交任务线程到线程池
// threadPoolExecutor.execute(() -> {
// try {
// while (true) {
// // 等待监听器通知
// synchronized (listener) {
// while (!listener.hasBinlogChanged()) {
// listener.wait(); // 等待直到有变动
// }
// listener.resetBinlogChanged(); // 重置变动状态
// }
// // 执行任务
// executeTask();
//
// }
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
// });
//
//
//
// threadPoolExecutor.execute(() -> {
// try {
// while (true) {
// // 等待监听器通知
// synchronized (listener) {
// while (!listener.hasBinlogChanged2()) {
// listener.wait(); // 等待直到有变动
// }
// listener.resetBinlogChanged2(); // 重置变动状态
// }
// // 执行任务
// executeTask2();
// }
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
// });
//
// }
//
// private static void executeTask() {
// System.out.println("《门店维度统计》开始...");
// try {
// String[] arg ={"1970-01-01", DateUtils.getToday()};
// IncreMerchantStatic.main(arg);
// System.out.println("《门店维度统计》结束...");
// } catch (Exception e) {
// Thread.currentThread().interrupt();
// }
// }
//
////
// private static void executeTask2() {
// System.out.println("《员工维度统计》开始...");
// try {
// String[] arg ={"1970-01-01", DateUtils.getToday()};
// StaffStatic.main(arg);
// System.out.println("《员工维度统计》结束...");
// } catch (Exception e) {
// Thread.currentThread().interrupt();
// }
// }
//
//}
//package com.glsk.compute.listen.bak;
//
//import com.github.shyiko.mysql.binlog.BinaryLogClient;
//import com.github.shyiko.mysql.binlog.event.EventData;
//import com.github.shyiko.mysql.binlog.event.TableMapEventData;
//import com.glsk.util.ConfigurationManager;
//import lombok.extern.slf4j.Slf4j;
//
//import java.io.IOException;
//
///**
// * @author fangfang
// * @create 2024-04-24 11:49
// */
//
//
//// BinaryLogListener 接口
//interface BinaryLogListener {
// void startListening();
// void stopListening();
// void onBinlogChange(); // 通知变动
// boolean hasBinlogChanged(); // 检查是否有变动
// void resetBinlogChanged(); // 重置变动状态
//
// void onBinlogChange2(); // 通知变动
// boolean hasBinlogChanged2(); // 检查是否有变动
// void resetBinlogChanged2(); // 重置变动状态
//
//
//}
//
//@Slf4j
//class MyBinaryLogListener implements BinaryLogListener {
// private volatile boolean binlogChanged = false;
// private volatile boolean binlogChanged02 = false;
// private Thread listeningThread;
// private volatile boolean running = true;
//
// @Override
// public void startListening() {
//
// String binlogip = ConfigurationManager.getProperty("binlogip");
// Integer binlogport =Integer.valueOf( ConfigurationManager.getProperty("binlogport"));
// String binlogdb = ConfigurationManager.getProperty("binlogdb");
// String binlogusername = ConfigurationManager.getProperty("binlogusername");
// String binlogpassword = ConfigurationManager.getProperty("binlogpassword");
//
// System.out.println("binlogip="+binlogip);
// System.out.println("binlogport="+binlogport);
// System.out.println("binlogdb="+binlogdb);
// System.out.println("binlogusername="+binlogusername);
// System.out.println("binlogpassword="+binlogpassword);
//
// log.info("监控BinLog服务已启动>>>>>>>>>>>>>>>>>>");
// BinaryLogClient logClient = new BinaryLogClient(
// binlogip, binlogport, binlogdb, binlogusername, binlogpassword
// );
//
////
//// // 开始监听
//// try {
//// logClient.connect();
//// } catch (IOException e) {
//// e.printStackTrace();
//// }
//
//
// listeningThread = new Thread(() -> {
//// while (running) {
//// String binlogip = ConfigurationManager.getProperty("binlogip");
//// Integer binlogport =Integer.valueOf( ConfigurationManager.getProperty("binlogport"));
//// String binlogdb = ConfigurationManager.getProperty("binlogdb");
//// String binlogusername = ConfigurationManager.getProperty("binlogusername");
//// String binlogpassword = ConfigurationManager.getProperty("binlogpassword");
////
//// System.out.println("binlogip="+binlogip);
//// System.out.println("binlogport="+binlogport);
//// System.out.println("binlogdb="+binlogdb);
//// System.out.println("binlogusername="+binlogusername);
//// System.out.println("binlogpassword="+binlogpassword);
////
//// log.info("监控BinLog服务已启动>>>>>>>>>>>>>>>>>>");
//// BinaryLogClient logClient = new BinaryLogClient(
//// binlogip, binlogport, binlogdb, binlogusername, binlogpassword
//// );
//
//
// logClient.registerEventListener(event -> {
// EventData data = event.getData();
// if (data instanceof TableMapEventData) {
// //只要连接的MySQL发生的增删改的操作,则都会进入这里,无论哪个数据库
// TableMapEventData tableMapEventData = (TableMapEventData) data;
//
// //
// if(tableMapEventData.getDatabase().equals("dj_smartcarlife")){//不约束表名时,监听的是整个库
//// if(tableMapEventData.getTable().equals("dj_car_life_goods_order")
//// ||tableMapEventData.getTable().equals("dj_car_life_pay_order")
//// ||tableMapEventData.getTable().equals("dj_car_life_staff_daily_report")
//// ||tableMapEventData.getTable().equals("dj_car_life_staff_target_check")
//// ||tableMapEventData.getTable().equals("dj_car_life_merchant_target_config")
//// ||tableMapEventData.getTable().equals("dj_car_life_merchant_target_period_config")
//// ||tableMapEventData.getTable().equals("dj_car_life_merchant_target_task_config")
//// ||tableMapEventData.getTable().equals("dj_car_life_merchant_target_task_config_package")
//// ){
//
// if(tableMapEventData.getTable().equals("tmp")){
// System.out.println(" binlog 有变动 ,变动的表 ="+tableMapEventData.getTable());
// binlogChanged = true;//
// binlogChanged02 = true;//
// onBinlogChange(); // 通知任务线程
// onBinlogChange2(); // 通知任务线程2
// }
//
// }}
//
// });
//
//
// // 开始监听
// try {
// logClient.connect();
// } catch (IOException e) {
// e.printStackTrace();
// }
//
//// }
// });
// listeningThread.start();
// }
//
//
//
//
//
// @Override
// public void stopListening() {
// running = false;
// try {
// listeningThread.join();
// } catch (InterruptedException e) {
// Thread.currentThread().interrupt();
// }
// }
//
// @Override
// public void onBinlogChange() {
// synchronized (this) {
// if (binlogChanged) {
// notify(); // 通知等待的任务线程
// }
// }
// }
//
// @Override
// public boolean hasBinlogChanged() {
// return binlogChanged;
// }
//
// @Override
// public void resetBinlogChanged() {
// binlogChanged = false;
// }
//
//
//
// @Override
// public void onBinlogChange2() {
// synchronized (this) {
// if (binlogChanged02) {
// notify(); // 通知等待的任务线程
// }
// }
// }
// @Override
// public boolean hasBinlogChanged2() {
// return binlogChanged02;
// }
//
// @Override
// public void resetBinlogChanged2() {
// binlogChanged02 = false;
// }
//
//
//
//
//
//
//}
package com.glsk.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 解决异步访问跨域
*/
//@Configuration
//public class CorsConfig {
//
// @Bean
// public WebMvcConfigurer corsConfigurer(){
// return new WebMvcConfigurer() {
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**")
// .allowedHeaders("*")
// .allowedMethods("*")
// .maxAge(86400L)
// .allowedOrigins("*");
// }
// };
// }
//
//
//// public class CorsConfig implements WebMvcConfigurer {
//// @Override
//// public void addCorsMappings(CorsRegistry registry) {
//// //本应用的所有方法都会去处理跨域请求
//// registry.addMapping("/**")
//// .allowedOrigins("*")
//// //允许远端访问的域名
////// .allowedOrigins("http://192.168.1.149:9527")
//// .allowedOrigins("*")
//// //允许请求的方法("POST", "GET", "PUT", "OPTIONS", "DELETE")
//// .allowedMethods("*")
//// //允许请求头
//// .allowedHeaders("*");
////
////
////
//// }
////
////
////
//// private CorsConfiguration buildConfig() {
//// CorsConfiguration corsConfiguration = new CorsConfiguration();
//// corsConfiguration.setAllowCredentials(true); //sessionid 多次访问一致
////
//// // 允许访问的客户端域名
//// List<String> allowedOriginPatterns = new ArrayList<>();
//// allowedOriginPatterns.add("*");
////
////// corsConfiguration.setAllowedOriginPatterns(allowedOriginPatterns);
//// corsConfiguration.setAllowedOrigins(allowedOriginPatterns);
//// corsConfiguration.addAllowedOrigin("*"); // 允许任何域名使用
//// corsConfiguration.addAllowedHeader("*"); // 允许任何头
//// corsConfiguration.addAllowedMethod("*"); // 允许任何方法(post、get等)
//// return corsConfiguration;
//// }
////
//// @Bean
//// public CorsFilter corsFilter() {
//// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//// source.registerCorsConfiguration("/**", buildConfig()); // 对接口配置跨域设置
////
//// CorsConfiguration corsConfiguration = new CorsConfiguration();
//// corsConfiguration.addAllowedHeader("*");
//// corsConfiguration.addAllowedOrigin("*");
//// corsConfiguration.addAllowedMethod("*");
//// corsConfiguration.setAllowCredentials(true);
//// source.registerCorsConfiguration("/**",corsConfiguration);
////
////
//// CorsFilter corsFilter = new CorsFilter(source);
////
////
//// return corsFilter;//new CorsFilter(source)
//// }
////
//
//}
/**
* 跨域配置
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").
allowedOrigins("*"). //允许跨域的域名,可以用*表示允许任何域名使用
// allowedOrigins("https://www.dustyblog.cn"). //允许跨域的域名,可以用*表示允许任何域名使用
allowedMethods("*"). //允许任何方法(post、get等)
allowedHeaders("*"). //允许任何请求头
allowCredentials(true). //带上cookie信息
exposedHeaders(HttpHeaders.SET_COOKIE).maxAge(3600L); //maxAge(3600)表明在3600秒内,不需要再发送预检验请求,可以缓存该结果
}
};
}
}
package com.glsk.config;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
//@ComponentScan("glsk.controller")
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.pathMapping("/")
.select() // 选择那些路径和api会生成document
.apis(RequestHandlerSelectors.any())// 对所有api进行监控
//不显示错误的接口地址
.paths(Predicates.not(PathSelectors.regex("/error*")))//错误路径不监控
.paths(PathSelectors.regex("/.*"))// 对根下所有路径进行监控
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("接口口文档档")
.contact(new Contact("romeo", "", "xxx@qq.com"))
.description("这是SWAGGER_2生成的接口文档")
.termsOfServiceUrl("NO terms of service")
.license("The Apache License, Version 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.version("v1.0")
.build();
}
/* @Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.pathMapping("/")
.select()// 选择那些路径和api会生成document
.apis(RequestHandlerSelectors.any())// 对所有api进行监控
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
//不显示错误的接口地址
.paths(Predicates.not(PathSelectors.regex("/error.*")))// 错误路径不监控
.paths(PathSelectors.regex("/.*"))// 对根下所有路径进行监控
// api过滤器,设置哪些接口会加载创建接口文档
//.apis(RequestHandlerSelectors.basePackage("com.xx.xx"))
// .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("服务接口文档")
.description("服务接口文档说明:xxx")
.contact(new Contact("55555", "", "jinglf@didihu.com.cn"))
.version("1.0.0")
.build();
}*/
// private ApiInfo apiInfo2() {
// return new ApiInfoBuilder().title("action-swagger")
// .description("swagger实战").termsOfServiceUrl("")
// .version("1.0").build();
// }
//
// @Bean
// public Docket customDocket() {
// return new Docket(DocumentationType.SWAGGER_2)
// .apiInfo(apiInfo())
// .pathMapping("/")
// .select()
// .apis(RequestHandlerSelectors.basePackage("glsk.controller"))//扫描的包路径
// .paths(Predicates.not(PathSelectors.regex("/error.*")))// 错误路径不监控
// .paths(PathSelectors.regex("/.*"))// 对根下所有路径进行监控
// .build();
// }
}
//package com.glsk.controller;
//
//import com.glsk.service.BusinessAnalysisService;
//import com.glsk.vo.*;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//
///**
// * @author fangfang
// * @create 2023-07-02 10:46
// */
//
//@CrossOrigin(origins = "*")
//@RestController
//@RequestMapping("/merchant")
//@Api(value = "经营分析--门店", tags = {"经营分析--门店"})
//public class MerchantController {
// protected final Logger logger = LoggerFactory.getLogger(getClass());
//
// @Autowired
// private BusinessAnalysisService businessAnalysisService;
//
//
//
// @GetMapping("/getMerchantList")
// @ApiOperation("获取门店列表")
// public RopResponse<ReqRet.MerchantListRet> getMerchantList(BusinessType business_type,String merchantname) {
// logger.info("getMerchantList:req=" );
//
// ReqRet.MerchantListRet ret = businessAnalysisService.getMerchantList(business_type,merchantname);
// return RopResponse.success(ret);
//
// }
//
//
//
// @GetMapping("/getMerchantWeekList")
// @ApiOperation("获取门店周列表")
// public RopResponse<ReqRet.WeekListRet> getMerchantWeekList(BusinessType business_type,String merchantid) {
// logger.info("getWeekList:req=" );
//
// ReqRet.WeekListRet ret = businessAnalysisService.getMerchantWeekList(business_type,merchantid);
// return RopResponse.success(ret);
//
// }
//
//
//
// @GetMapping("/queryMerchantOutputAndAtv")
// @ApiOperation("查询门店总产值和客单价")
// public RopResponse<ReqRet.MerchantOutputAndAtvRet> queryMerchantOutputAndAtv(String merchantid,BusinessType business_type,
// QueryType queryType , String startDay,String endDay) {
// logger.info("查询门店总产值和客单价:req=" );
// System.out.println("startDay>>>>>>>>>>>>"+startDay);
// System.out.println("endDay>>>>>>>>>>>>"+endDay);
// ReqRet.MerchantOutputAndAtvRet ret = businessAnalysisService.queryMerchantOutputAndAtv(merchantid, business_type,queryType,startDay,endDay);
// return RopResponse.success(ret);
//
// }
//
//
//
//
// @GetMapping("/queryMerchantOutputTrend")
// @ApiOperation("查询门店产值趋势")
// public RopResponse<ReqRet.OutputTrendRet> queryMerchantOutputTrend(String merchantid, BusinessType business_type,
// QueryType queryType , String startDay,String endDay) {
// logger.info("查询门店产值趋势:req=" );
// System.out.println("startDay>>>>>>>>>>>>"+startDay);
// System.out.println("endDay>>>>>>>>>>>>"+endDay);
// ReqRet.OutputTrendRet ret = businessAnalysisService.queryMerchantOutputTrend(merchantid,business_type,queryType,startDay,endDay);
// return RopResponse.success(ret);
//
// }
//
//
// @GetMapping("/queryMerchantBuyAndTostore")
// @ApiOperation("查询门店新车交付数、新车到店流量、售后到店流量、成交量")
// public RopResponse<ReqRet.MerchantBuyAndTostoreRet> queryMerchantBuyAndTostore(String merchantid,BusinessType business_type,
// QueryType queryType , String startDay,String endDay) {
// logger.info("queryMerchantBuyAndTostore:req=" );
//
// System.out.println("startDay>>>>>>>>>>>>"+startDay);
// System.out.println("endDay>>>>>>>>>>>>"+endDay);
// ReqRet.MerchantBuyAndTostoreRet ret = businessAnalysisService.queryMerchantBuyAndTostore(merchantid, business_type,queryType,startDay,endDay);
// return RopResponse.success(ret);
//
// }
//
//
//
//
//
//
// @GetMapping("/queryStaffRanking")
// @ApiOperation("查询员工排名")
// public RopResponse<ReqRet.StaffRankingRet> queryStaffRanking(String merchantid, BusinessType business_type,
// QueryType queryType , String startDay,String endDay,Rankfield rankfield,RankType rankType) {
// logger.info("queryStaffRanking:req=" );
// System.out.println("startDay>>>>>>>>>>>>"+startDay);
// System.out.println("endDay>>>>>>>>>>>>"+endDay);
// ReqRet.StaffRankingRet ret = businessAnalysisService.queryStaffRanking(merchantid,business_type,queryType,startDay,endDay,rankfield,rankType);
// return RopResponse.success(ret);
//
// }
//
//
//
// @GetMapping("/queryFlowContributeRanking")
// @ApiOperation("查询流量贡献排行")
// public RopResponse<ReqRet.FlowContributeRankingRet> queryFlowContributeRanking(String merchantid, BusinessType business_type,
// QueryType queryType , String startDay,String endDay,RankType rankType) {
// logger.info("queryFlowContributeRanking:req=" );
// System.out.println("startDay>>>>>>>>>>>>"+startDay);
// System.out.println("endDay>>>>>>>>>>>>"+endDay);
// ReqRet.FlowContributeRankingRet ret = businessAnalysisService.queryFlowContributeRanking(merchantid,business_type,queryType,startDay,endDay,rankType);
// return RopResponse.success(ret);
//
// }
//
//
//
//
//
//
//
//
//}
//package com.glsk.controller;
//
//import com.glsk.service.BusinessAnalysisService;
//import com.glsk.vo.*;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//import java.util.stream.Collectors;
//
//
///**
// * @author fangfang
// * @create 2023-07-02 10:46
// */
//
//@CrossOrigin(origins = "*")
//@RestController
//@RequestMapping("/overview")
//@Api(value = "经营分析--总览", tags = {"经营分析--总览"})
//public class OverviewController {
// protected final Logger logger = LoggerFactory.getLogger(getClass());
//
// @Autowired
// private BusinessAnalysisService businessAnalysisService;
//
//
// @GetMapping("/queryOutputAndMernum")
// @ApiOperation("查询门店产值和展业门店数")
// public RopResponse<ReqRet.OutputAndMernumRet> queryOutputAndMernum(String itemname, BusinessType business_type,
// QueryType queryType , String startDay,String endDay,String merchantids) {
// logger.info("queryOutputAndMernum:req=" );
//
// merchantids="";
//
// ReqRet.OutputAndMernumRet ret = businessAnalysisService.queryOutputAndMernum(itemname,business_type,queryType,startDay,endDay);
// return RopResponse.success(ret);
//
// }
//
// @GetMapping("/queryItemName")
// @ApiOperation("查询项目名称")
// public RopResponse<ReqRet.ItemNameRet> queryItemName() {
// logger.info("queryItemName:req=" );
//
// ReqRet.ItemNameRet ret = businessAnalysisService.queryItemName();
// return RopResponse.success(ret);
//
// }
// @GetMapping("/queryLasttimeStatc")
// @ApiOperation("查询数据最近统计时间")
// public RopResponse<ReqRet.LasttimeStatcRet> queryLasttimeStatc() {
// logger.info("queryLasttimeStatc:req=" );
//
// ReqRet.LasttimeStatcRet ret = businessAnalysisService.queryLasttimeStatc( );
// return RopResponse.success(ret);
//
// }
//
//
//
// @GetMapping("/queryOutputTrend")
// @ApiOperation("查询门店产值趋势")
// public RopResponse<ReqRet.OutputTrendRet> queryOutputTrend(String itemname, BusinessType business_type,
// QueryType queryType , String startDay,String endDay) {
// logger.info("queryOutputTrend:req=" );
// ReqRet.OutputTrendRet ret = businessAnalysisService.queryOutputTrend(itemname,business_type,queryType,startDay,endDay);
// return RopResponse.success(ret);
// }
//
//
// @GetMapping("/queryMerRanking")
// @ApiOperation("查询门店排名")
// public RopResponse<ReqRet.MerRankingRet> queryMerRanking(String itemname, BusinessType business_type,
// QueryType queryType , String startDay,String endDay,Rankfield rankfield,RankType rankType) {
// logger.info("queryMerRanking:req=" );
//
// ReqRet.MerRankingRet ret = businessAnalysisService.queryMerRanking(itemname,business_type,queryType,startDay,endDay,rankfield,rankType);
// return RopResponse.success(ret);
// }
//
//
// @GetMapping("/getWeekList")
// @ApiOperation("获取周列表")
// public RopResponse<ReqRet.WeekListRet> getWeekList(String itemname, BusinessType business_type) {
// logger.info("getWeekList:req=" );
//
// ReqRet.WeekListRet ret = businessAnalysisService.getWeekList(itemname,business_type);
// return RopResponse.success(ret);
//
// }
//
//
//
//
//
//
//
//
//}
//package com.glsk.controller;
//
//import com.glsk.service.BusinessAnalysisService;
//import com.glsk.vo.BusinessType;
//import com.glsk.vo.QueryType;
//import com.glsk.vo.ReqRet;
//import com.glsk.vo.RopResponse;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//
///**
// * @author fangfang
// * @create 2023-07-02 10:46
// */
//
//@CrossOrigin(origins = "*")
//@RestController
//@RequestMapping("/staff")
//@Api(value = "经营分析--员工", tags = {"经营分析--员工"})
//public class StaffController {
// protected final Logger logger = LoggerFactory.getLogger(getClass());
//
// @Autowired
// private BusinessAnalysisService businessAnalysisService;
//
//
// @GetMapping("/getStaffList")
// @ApiOperation("获取员工列表")
// public RopResponse<ReqRet.StaffListRet> getStaffList(String merchantid,BusinessType business_type,String staffid,String staffname) {
// logger.info("getStaffList:req=" );
//
// ReqRet.StaffListRet ret = businessAnalysisService.getStaffList(merchantid,business_type,staffid,staffname);
// return RopResponse.success(ret);
//
// }
//
// @GetMapping("/getStaffMerchantList")
// @ApiOperation("获取员工所在门店列表")
// public RopResponse<ReqRet.MerchantListRet> getStaffMerchantList(String merchantid,BusinessType business_type,String staffid) {
// logger.info("getMerchantList:req=" );
//
// ReqRet.MerchantListRet ret = businessAnalysisService.getStaffMerchantList(merchantid,business_type,staffid);
// return RopResponse.success(ret);
//
// }
//
//
//
// @GetMapping("/queryPerformanceFinishStatus")
// @ApiOperation("当前周期绩效完成情况")
// public RopResponse<ReqRet.PerformanceFinishStatusRet> queryPerformanceFinishStatus(String merchantid,String staffid,BusinessType business_type,
// QueryType queryType , String startDay,String endDay) {
// logger.info("queryPerformanceFinishStatus:req=" );
//
// ReqRet.PerformanceFinishStatusRet ret = businessAnalysisService.queryPerformanceFinishStatus(merchantid,staffid, business_type,queryType,startDay,endDay);
// return RopResponse.success(ret);
//
// }
//
// @GetMapping("/queryStaffOverview")
// @ApiOperation("员工总览信息")
// public RopResponse<ReqRet.StaffOverviewRet> queryStaffOverview(String merchantid, String staffid, BusinessType business_type,
// QueryType queryType , String startDay, String endDay) {
// logger.info("queryStaffOverview:req=" );
//
// ReqRet.StaffOverviewRet ret = businessAnalysisService.queryStaffOverview(merchantid,staffid, business_type,queryType,startDay,endDay);
// return RopResponse.success(ret);
//
// }
//
//
// @GetMapping("/queryStaffOutputTrend")
// @ApiOperation("查询员工产值趋势")
// public RopResponse<ReqRet.OutputTrendRet> queryStaffOutputTrend(String merchantid,String staffid, BusinessType business_type,
// QueryType queryType , String startDay,String endDay) {
// logger.info("queryStaffOutputTrend:req=" );
// ReqRet.OutputTrendRet ret = businessAnalysisService.queryStaffOutputTrend(merchantid,staffid,business_type,queryType,startDay,endDay);
// return RopResponse.success(ret);
//
// }
//
//
//
//
// @GetMapping("/getStaffWeekList")
// @ApiOperation("获取员工周列表")
// public RopResponse<ReqRet.WeekListRet> getStaffWeekList(BusinessType business_type, String merchantid, String staffid) {
// logger.info("getStaffWeekList:req=" );
//
// ReqRet.WeekListRet ret = businessAnalysisService.getStaffWeekList(business_type,merchantid,staffid);
// return RopResponse.success(ret);
//
// }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//}
package com.glsk.controller2;
import com.glsk.service.BoutiqueService;
import com.glsk.service.BusinessAnalysisService2;
import com.glsk.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Jinglf
* @create 2023-07-02 10:46
*/
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/merchant")
@Api(value = "经营分析--门店", tags = {"经营分析--门店"})
public class MerchantController {
protected final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private BusinessAnalysisService2 businessAnalysisService;
@Autowired
private BoutiqueService boutiqueService;
@GetMapping("/getMerchantList")
@ApiOperation("获取门店列表")
public RopResponse<ReqRet.MerchantListRet> getMerchantList(BusinessType business_type,String merchantname,String ids) {
logger.info("getMerchantList:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.MerchantListRet ret = boutiqueService.getMerchantList(business_type,merchantname,ids);
return RopResponse.success(ret);
}else {
ReqRet.MerchantListRet ret = businessAnalysisService.getMerchantList(business_type,merchantname,ids);
return RopResponse.success(ret);
}
}
@GetMapping("/getMerchantWeekList")
@ApiOperation("获取门店周列表")
public RopResponse<ReqRet.WeekListRet> getMerchantWeekList(BusinessType business_type,String merchantid) {
logger.info("getWeekList:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.WeekListRet ret = boutiqueService.getMerchantWeekList(business_type,merchantid);
return RopResponse.success(ret);
}else {
ReqRet.WeekListRet ret = businessAnalysisService.getMerchantWeekList(business_type,merchantid);
return RopResponse.success(ret);
}
}
@GetMapping("/queryMerchantOutputAndAtv")
@ApiOperation("查询门店总产值和客单价")
public RopResponse<ReqRet.MerchantOutputAndAtvRet> queryMerchantOutputAndAtv(String merchantid,BusinessType business_type,
QueryType queryType , String startDay,String endDay) {
logger.info("查询门店总产值和客单价:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.MerchantOutputAndAtvRet ret = boutiqueService.queryMerchantOutputAndAtv(merchantid, business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}else {
ReqRet.MerchantOutputAndAtvRet ret = businessAnalysisService.queryMerchantOutputAndAtv(merchantid, business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}
}
@GetMapping("/queryMerchantOutputTrend")
@ApiOperation("查询门店产值趋势")
public RopResponse<ReqRet.OutputTrendRet> queryMerchantOutputTrend(String merchantid, BusinessType business_type,
QueryType queryType , String startDay,String endDay) {
logger.info("查询门店产值趋势:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.OutputTrendRet ret = boutiqueService.queryMerchantOutputTrend(merchantid,business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}else {
ReqRet.OutputTrendRet ret = businessAnalysisService.queryMerchantOutputTrend(merchantid,business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}
}
@GetMapping("/queryMerchantBuyAndTostore")
@ApiOperation("查询门店新车交付数、新车到店流量、售后到店流量、成交量")
public RopResponse<ReqRet.MerchantBuyAndTostoreRet> queryMerchantBuyAndTostore(String merchantid,BusinessType business_type,
QueryType queryType , String startDay,String endDay) {
logger.info("queryMerchantBuyAndTostore:req=" );
System.out.println(business_type);
if(business_type.equals(BusinessType.qinggai)){
ReqRet.MerchantBuyAndTostoreRet ret = boutiqueService.queryMerchantBuyAndTostore(merchantid, business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}else {
ReqRet.MerchantBuyAndTostoreRet ret = businessAnalysisService.queryMerchantBuyAndTostore(merchantid, business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}
}
@GetMapping("/queryStaffRanking")
@ApiOperation("查询员工排名")
public RopResponse<ReqRet.StaffRankingRet> queryStaffRanking(String merchantid, BusinessType business_type,
QueryType queryType , String startDay,String endDay,Rankfield rankfield,RankType rankType) {
logger.info("queryStaffRanking:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.StaffRankingRet ret = boutiqueService.queryStaffRanking(merchantid,business_type,queryType,startDay,endDay,rankfield,rankType);
return RopResponse.success(ret);
}else {
ReqRet.StaffRankingRet ret = businessAnalysisService.queryStaffRanking(merchantid,business_type,queryType,startDay,endDay,rankfield,rankType);
return RopResponse.success(ret);
}
}
@GetMapping("/queryFlowContributeRanking")
@ApiOperation("查询流量贡献排行")
public RopResponse<ReqRet.FlowContributeRankingRet> queryFlowContributeRanking(String merchantid, BusinessType business_type,
QueryType queryType , String startDay,String endDay,RankType rankType) {
logger.info("queryFlowContributeRanking:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.FlowContributeRankingRet ret = boutiqueService.queryFlowContributeRanking(merchantid,business_type,queryType,startDay,endDay,rankType);
return RopResponse.success(ret);
}else {
ReqRet.FlowContributeRankingRet ret = businessAnalysisService.queryFlowContributeRanking(merchantid,business_type,queryType,startDay,endDay,rankType);
return RopResponse.success(ret);
}
}
@GetMapping("/queryServiceSupervisionSale")
@ApiOperation("门店+业务场景下的所属服务商老板、区域督导、销售名称")
public RopResponse<ReqRet.ServiceSupervisionSaleRet> queryServiceSupervisionSale(String merchantid, BusinessType business_type, String startDay,String endDay) {
logger.info("queryServiceSupervisionSale:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.ServiceSupervisionSaleRet ret = boutiqueService.queryServiceSupervisionSale(merchantid,business_type,startDay,endDay);
return RopResponse.success(ret);
}else {
ReqRet.ServiceSupervisionSaleRet ret = businessAnalysisService.queryServiceSupervisionSale(merchantid,business_type,startDay,endDay);
return RopResponse.success(ret);
}
}
@GetMapping("/queryProductOutput")
@ApiOperation("品类分析")
public RopResponse<ReqRet.ProductOutputRet> queryProductOutput(String merchantid, BusinessType business_type, String startDay,String endDay) {
logger.info("queryProductOutput:req=" );
if(!business_type.equals(BusinessType.qinggai)){
ReqRet.ProductOutputRet ret = new ReqRet.ProductOutputRet();
ret.setCode(-1);
ret.setMessage("请检查参数");
return RopResponse.success(ret);
}
ReqRet.ProductOutputRet ret = boutiqueService.queryProductOutput(merchantid,business_type,startDay,endDay);
return RopResponse.success(ret);
}
}
package com.glsk.controller2;
import com.glsk.service.BoutiqueService;
import com.glsk.service.BusinessAnalysisService2;
import com.glsk.vo.BusinessType;
import com.glsk.vo.QueryType;
import com.glsk.vo.ReqRet;
import com.glsk.vo.RopResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author fangfang
* @create 2023-07-02 10:46
*/
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/staff")
@Api(value = "经营分析--员工", tags = {"经营分析--员工"})
public class StaffController {
protected final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private BusinessAnalysisService2 businessAnalysisService;
@Autowired
private BoutiqueService boutiqueService;
@GetMapping("/getStaffList")
@ApiOperation("获取员工列表")
public RopResponse<ReqRet.StaffListRet> getStaffList(String merchantid,BusinessType business_type,String staffid,String staffname) {
logger.info("getStaffList:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.StaffListRet ret = boutiqueService.getStaffList(merchantid,business_type,staffid,staffname);
return RopResponse.success(ret);
}else {
ReqRet.StaffListRet ret = businessAnalysisService.getStaffList(merchantid,business_type,staffid,staffname);
return RopResponse.success(ret);
}
}
@GetMapping("/getStaffMerchantList")
@ApiOperation("获取员工所在门店列表")
public RopResponse<ReqRet.MerchantListRet> getStaffMerchantList(String merchantid,BusinessType business_type,String staffid,String ids) {
logger.info("getMerchantList:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.MerchantListRet ret = boutiqueService.getStaffMerchantList(merchantid,business_type,staffid, ids);
return RopResponse.success(ret);
}else {
ReqRet.MerchantListRet ret = businessAnalysisService.getStaffMerchantList(merchantid,business_type,staffid, ids);
return RopResponse.success(ret);
}
}
@GetMapping("/queryPerformanceFinishStatus")
@ApiOperation("当前周期绩效完成情况")
public RopResponse<ReqRet.PerformanceFinishStatusRet> queryPerformanceFinishStatus(String merchantid,String staffid,BusinessType business_type,
QueryType queryType , String startDay,String endDay) {
logger.info("queryPerformanceFinishStatus:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.PerformanceFinishStatusRet ret = boutiqueService.queryPerformanceFinishStatus(merchantid,staffid, business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}else {
ReqRet.PerformanceFinishStatusRet ret = businessAnalysisService.queryPerformanceFinishStatus(merchantid,staffid, business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}
}
@GetMapping("/queryStaffOverview")
@ApiOperation("员工总览信息")
public RopResponse<ReqRet.StaffOverviewRet> queryStaffOverview(String merchantid, String staffid, BusinessType business_type,
QueryType queryType , String startDay, String endDay) {
logger.info("queryStaffOverview:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.StaffOverviewRet ret = boutiqueService.queryStaffOverview(merchantid,staffid, business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}else {
ReqRet.StaffOverviewRet ret = businessAnalysisService.queryStaffOverview(merchantid,staffid, business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}
}
@GetMapping("/queryStaffOutputTrend")
@ApiOperation("查询员工产值趋势")
public RopResponse<ReqRet.OutputTrendRet> queryStaffOutputTrend(String merchantid,String staffid, BusinessType business_type,
QueryType queryType , String startDay,String endDay) {
logger.info("queryStaffOutputTrend:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.OutputTrendRet ret = boutiqueService.queryStaffOutputTrend(merchantid,staffid,business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}else {
ReqRet.OutputTrendRet ret = businessAnalysisService.queryStaffOutputTrend(merchantid,staffid,business_type,queryType,startDay,endDay);
return RopResponse.success(ret);
}
}
@GetMapping("/getStaffWeekList")
@ApiOperation("获取员工周列表")
public RopResponse<ReqRet.WeekListRet> getStaffWeekList(BusinessType business_type, String merchantid, String staffid) {
logger.info("getStaffWeekList:req=" );
if(business_type.equals(BusinessType.qinggai)){
ReqRet.WeekListRet ret = boutiqueService.getStaffWeekList(business_type,merchantid,staffid);
return RopResponse.success(ret);
}else {
ReqRet.WeekListRet ret = businessAnalysisService.getStaffWeekList(business_type,merchantid,staffid);
return RopResponse.success(ret);
}
}
}
package com.glsk.controller2;
import com.glsk.service.BoutiqueService;
import com.glsk.service.BusinessAnalysisService2;
import com.glsk.service.TalentAnalysisService;
import com.glsk.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Jinglf
* @create 2025-10-16 10:41
*/
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/talentAnalysis")
@Api(value = "人才分析", tags = {"人才分析"})
public class TalentAnalysisController {
protected final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private TalentAnalysisService talentAnalysisService;
@GetMapping("/getBasicData")
@ApiOperation("获取基础数据")
public RopResponse<ReqRet.TalentAnalysisBasicDataRet> getBasicData(ReqRet.TalentAnalysisBasicDataReq req) throws Exception {
logger.info("getBasicData:req={}",req.toString() );
System.out.println(req.getStaffId()+">>>>>>>>>>>>>>");
System.out.println(req.getStaffName()+">>>>>>>>>>>>>>");
System.out.println(req.getStaffPhone()+">>>>>>>>>>>>>>");
//进入时间 --埋点
//登录页面类型 BusinessType --埋点
// 查询时段 QueryType --埋点
ReqRet.TalentAnalysisBasicDataRet ret = talentAnalysisService.getBasicData(req);
return RopResponse.success(ret);
}
@GetMapping("/getSummaryRetentionAnalysis")
@ApiOperation("汇总留存分析")
public RopResponse<ReqRet.SummaryRetentionAnalysisRet> getSummaryRetentionAnalysis(ReqRet.SummaryRetentionAnalysisReq req) throws Exception {
logger.info("getSummaryRetentionAnalysis:req={}",req.toString() );
ReqRet.SummaryRetentionAnalysisRet ret = talentAnalysisService.getSummaryRetentionAnalysis(req);
return RopResponse.success(ret);
}
@GetMapping("/getSummaryRetentionAnalysisDetail")
@ApiOperation("汇总留存分析详细分析")
public RopResponse<ReqRet.SummaryRetentionAnalysisRet> getSummaryRetentionAnalysisDetail(ReqRet.SummaryRetentionAnalysisDetailReq req) throws Exception {
logger.info("getSummaryRetentionAnalysisDetail:req={}",req.toString() );
ReqRet.SummaryRetentionAnalysisRet ret = talentAnalysisService.getSummaryRetentionAnalysisDetail(req);
return RopResponse.success(ret);
}
@GetMapping("/getCurrentActivePersonnelAnalysis")
@ApiOperation("当前在职人数分析")
public RopResponse<ReqRet.SummaryRetentionAnalysisRet> getCurrentActivePersonnelAnalysis(ReqRet.SummaryRetentionAnalysisReq req) throws Exception {
logger.info("getCurrentActivePersonnelAnalysis:req={}",req.toString() );
ReqRet.SummaryRetentionAnalysisRet ret = talentAnalysisService.getCurrentActivePersonnelAnalysis(req);
return RopResponse.success(ret);
}
@GetMapping("/getCurrentActivePersonnelAnalysisDetail")
@ApiOperation("当前在职人数分析详细分析")
public RopResponse<ReqRet.SummaryRetentionAnalysisRet> getCurrentActivePersonnelAnalysisDetail(ReqRet.SummaryRetentionAnalysisDetailReq req) throws Exception {
logger.info("getCurrentActivePersonnelAnalysisDetail:req={}",req.toString() );
ReqRet.SummaryRetentionAnalysisRet ret = talentAnalysisService.getCurrentActivePersonnelAnalysisDetail(req);
return RopResponse.success(ret);
}
@GetMapping("/getResignEmployeelAnalysis")
@ApiOperation("离职人数分析")
public RopResponse<ReqRet.ResignEmployeelAnalysisRet> getResignEmployeelAnalysis(ReqRet.SummaryRetentionAnalysisReq req) throws Exception {
logger.info("getResignEmployeelAnalysis:req={}",req.toString() );
ReqRet.ResignEmployeelAnalysisRet ret = talentAnalysisService.getResignEmployeelAnalysis(req);
return RopResponse.success(ret);
}
@GetMapping("/getResignEmployeelAnalysisDetail")
@ApiOperation("离职人数分析详细分析")
public RopResponse<ReqRet.ResignEmployeelAnalysisRet> getResignEmployeelAnalysisDetail(ReqRet.SummaryRetentionAnalysisDetailReq req) throws Exception {
logger.info("getResignEmployeelAnalysisDetail:req={}",req.toString() );
ReqRet.ResignEmployeelAnalysisRet ret = talentAnalysisService.getResignEmployeelAnalysisDetail(req);
return RopResponse.success(ret);
}
}
package com.glsk.data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author fangfang
* @create 2024-01-26 16:59
*/
@Data
@HeadStyle(fillForegroundColor=12)
public class MerchantPerformance {
@ApiModelProperty(value = "服务商",required=true)
@ExcelProperty({"服务商"})
@HeadStyle(fillForegroundColor=31)
private String servicename;
@ApiModelProperty(value = "门店名称",required=true)
@ExcelProperty({"门店名称"})
@HeadStyle(fillForegroundColor=31)
private String merchantname;
@ApiModelProperty(value = "门店品牌",required=true)
@ExcelProperty({"门店品牌"})
@HeadStyle(fillForegroundColor=31)
private String brand;
@ApiModelProperty(value = "展业时间",required=true)
@ExcelProperty({"展业时间"})
@HeadStyle(fillForegroundColor=31)
private String starttime;
@ApiModelProperty(value = "展业天数",required=true)
@ExcelProperty({"展业天数"})
@HeadStyle(fillForegroundColor=31)
private String startday;
@ApiModelProperty(value = "业务类型",required=true)
@ExcelProperty({"业务类型"})
@HeadStyle(fillForegroundColor=31)
private String businesstype;
@ApiModelProperty(value = "区域督导",required=true)
@ExcelProperty({"区域督导"})
@HeadStyle(fillForegroundColor=31)
private String supervisor;
@ApiModelProperty(value = "业务负责人",required=true)
@ExcelProperty({"业务负责人"})
@HeadStyle(fillForegroundColor=31)
private String director;
@ApiModelProperty(value = "驻店零售",required=true)
@ExcelProperty({"驻店零售"})
@HeadStyle(fillForegroundColor=31)
private String salesman;
@ApiModelProperty(value = "新车交付数",required=true)
@ExcelProperty({"门店业绩指标","新车交付数"})
@HeadStyle(fillForegroundColor=41)
private Integer newcarnum;
@ApiModelProperty(value = "到店流量",required=true)
@ExcelProperty({"门店业绩指标","到店流量"})
@HeadStyle(fillForegroundColor=41)
private Integer tostore;
@ApiModelProperty(value = "引流率",required=true)
@ExcelProperty({"门店业绩指标","引流率"})
@HeadStyle(fillForegroundColor=41)
private Integer yinliulv;
@ApiModelProperty(value = "门店产值",required=true)
@ExcelProperty({"门店业绩指标","门店产值"})
@HeadStyle(fillForegroundColor=41)
private Integer meroutput;
@ApiModelProperty(value = "转化率",required=true)
@ExcelProperty({"门店业绩指标","转化率"})
@HeadStyle(fillForegroundColor=41)
private Integer zhuanhualv;
@ApiModelProperty(value = "客单价",required=true)
@ExcelProperty({"门店业绩指标","客单价"})
@HeadStyle(fillForegroundColor=41)
private Integer atv;
@ApiModelProperty(value = "订单数",required=true)
@ExcelProperty({"门店业绩指标","订单数"})
@HeadStyle(fillForegroundColor=41)
private Integer ordernum;
@ApiModelProperty(value = "服务商收入",required=true)
@ExcelProperty({"门店业绩指标","服务商收入"})
@HeadStyle(fillForegroundColor=41)
private Integer serviceincome;
public String getServicename() {
return servicename;
}
public void setServicename(String servicename) {
this.servicename = servicename;
}
public String getMerchantname() {
return merchantname;
}
public void setMerchantname(String merchantname) {
this.merchantname = merchantname;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getStarttime() {
return starttime;
}
public void setStarttime(String starttime) {
this.starttime = starttime;
}
public String getStartday() {
return startday;
}
public void setStartday(String startday) {
this.startday = startday;
}
public String getBusinesstype() {
return businesstype;
}
public void setBusinesstype(String businesstype) {
this.businesstype = businesstype;
}
public String getSupervisor() {
return supervisor;
}
public void setSupervisor(String supervisor) {
this.supervisor = supervisor;
}
public String getDirector() {
return director;
}
public void setDirector(String director) {
this.director = director;
}
public String getSalesman() {
return salesman;
}
public void setSalesman(String salesman) {
this.salesman = salesman;
}
public Integer getNewcarnum() {
return newcarnum;
}
public void setNewcarnum(Integer newcarnum) {
this.newcarnum = newcarnum;
}
public Integer getTostore() {
return tostore;
}
public void setTostore(Integer tostore) {
this.tostore = tostore;
}
public Integer getYinliulv() {
return yinliulv;
}
public void setYinliulv(Integer yinliulv) {
this.yinliulv = yinliulv;
}
public Integer getMeroutput() {
return meroutput;
}
public void setMeroutput(Integer meroutput) {
this.meroutput = meroutput;
}
public Integer getZhuanhualv() {
return zhuanhualv;
}
public void setZhuanhualv(Integer zhuanhualv) {
this.zhuanhualv = zhuanhualv;
}
public Integer getAtv() {
return atv;
}
public void setAtv(Integer atv) {
this.atv = atv;
}
public Integer getOrdernum() {
return ordernum;
}
public void setOrdernum(Integer ordernum) {
this.ordernum = ordernum;
}
public Integer getServiceincome() {
return serviceincome;
}
public void setServiceincome(Integer serviceincome) {
this.serviceincome = serviceincome;
}
}
package com.glsk.entity;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.Data;
/**
* business_analysis_employee_flow
*/
@Data
@HeadStyle(fillForegroundColor=12)
public class EmployeeFlowData {
private String stat_date;//统计日期
private String staff_id;//员工id
private String staff_name;//'员工姓名'
private String staff_phone;//'员工手机号'
private String merchant_id;//门店商户号
private String merchant_name;//门店名称
private String business_type;//'业务类型'
private String ordernum;//订单数(升级订单数)
private String total_ordernum;//升级战败总订单数
private String daily_contribution_traffic;//'统计日当日贡献流量'
private String created_date;//'数据创建时间(查询生成时间)'
public String getStat_date() {
return stat_date;
}
public void setStat_date(String stat_date) {
this.stat_date = stat_date;
}
public String getStaff_id() {
return staff_id;
}
public void setStaff_id(String staff_id) {
this.staff_id = staff_id;
}
public String getStaff_name() {
return staff_name;
}
public void setStaff_name(String staff_name) {
this.staff_name = staff_name;
}
public String getStaff_phone() {
return staff_phone;
}
public void setStaff_phone(String staff_phone) {
this.staff_phone = staff_phone;
}
public String getMerchant_id() {
return merchant_id;
}
public void setMerchant_id(String merchant_id) {
this.merchant_id = merchant_id;
}
public String getMerchant_name() {
return merchant_name;
}
public void setMerchant_name(String merchant_name) {
this.merchant_name = merchant_name;
}
public String getBusiness_type() {
return business_type;
}
public void setBusiness_type(String business_type) {
this.business_type = business_type;
}
public String getOrdernum() {
return ordernum;
}
public void setOrdernum(String ordernum) {
this.ordernum = ordernum;
}
public String getTotal_ordernum() {
return total_ordernum;
}
public void setTotal_ordernum(String total_ordernum) {
this.total_ordernum = total_ordernum;
}
public String getDaily_contribution_traffic() {
return daily_contribution_traffic;
}
public void setDaily_contribution_traffic(String daily_contribution_traffic) {
this.daily_contribution_traffic = daily_contribution_traffic;
}
public String getCreated_date() {
return created_date;
}
public void setCreated_date(String created_date) {
this.created_date = created_date;
}
}
package com.glsk.entity;
/**
* @author fangfang
* @create 2023-03-16 15:31
*/
public class MemberOrderMonthly {
private String statMonth = null;
private String moduleName = null;
private Integer orderNum = 0;
private Double priceMonthly = 0.0;
private Double averPriceMonthly= 0.0;
public String getStatMonth() {
return statMonth;
}
public void setStatMonth(String statMonth) {
this.statMonth = statMonth;
}
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public Double getPriceMonthly() {
return priceMonthly;
}
public void setPriceMonthly(Double priceMonthly) {
this.priceMonthly = priceMonthly;
}
public Double getAverPriceMonthly() {
return averPriceMonthly;
}
public void setAverPriceMonthly(Double averPriceMonthly) {
this.averPriceMonthly = averPriceMonthly;
}
}
package com.glsk.entity;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.Data;
/**
business_analysis_staff_tostore
*/
@Data
@HeadStyle(fillForegroundColor=12)
public class MerchantBuyNum {
private String stat_date;//统计日期
private String merchant_id;//门店商户号
private String buynum ;//'新车交付数'
private String created_date;//'数据创建时间(查询生成时间)'
public String getStat_date() {
return stat_date;
}
public void setStat_date(String stat_date) {
this.stat_date = stat_date;
}
public String getMerchant_id() {
return merchant_id;
}
public void setMerchant_id(String merchant_id) {
this.merchant_id = merchant_id;
}
public String getBuynum() {
return buynum;
}
public void setBuynum(String buynum) {
this.buynum = buynum;
}
public String getCreated_date() {
return created_date;
}
public void setCreated_date(String created_date) {
this.created_date = created_date;
}
}
package com.glsk.entity;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.Data;
/**
business_analysis_overview
*/
@Data
@HeadStyle(fillForegroundColor=12)
public class MerchantStaticData {
private String stat_date;//统计日期
private String merchant_id;//门店商户号
private String merchant_name;//门店名称
private String business_type;//'业务类型'
private String item_name;//'项目名称'
private String output;//'门店产值'
private String ordernum;//订单数(升级订单数)
private String total_ordernum;//升级战败总订单数
private String to_store;//'新车到店流量'
private String aftersales_to_store ;//'售后到店流量'
private String buynum ;//'新车交付数'
private String created_date;//'数据创建时间(查询生成时间)'
public String getStat_date() {
return stat_date;
}
public void setStat_date(String stat_date) {
this.stat_date = stat_date;
}
public String getMerchant_id() {
return merchant_id;
}
public void setMerchant_id(String merchant_id) {
this.merchant_id = merchant_id;
}
public String getMerchant_name() {
return merchant_name;
}
public void setMerchant_name(String merchant_name) {
this.merchant_name = merchant_name;
}
public String getBusiness_type() {
return business_type;
}
public void setBusiness_type(String business_type) {
this.business_type = business_type;
}
public String getItem_name() {
return item_name;
}
public void setItem_name(String item_name) {
this.item_name = item_name;
}
public String getOutput() {
return output;
}
public void setOutput(String output) {
this.output = output;
}
public String getOrdernum() {
return ordernum;
}
public void setOrdernum(String ordernum) {
this.ordernum = ordernum;
}
public String getTotal_ordernum() {
return total_ordernum;
}
public void setTotal_ordernum(String total_ordernum) {
this.total_ordernum = total_ordernum;
}
public String getTo_store() {
return to_store;
}
public void setTo_store(String to_store) {
this.to_store = to_store;
}
public String getAftersales_to_store() {
return aftersales_to_store;
}
public void setAftersales_to_store(String aftersales_to_store) {
this.aftersales_to_store = aftersales_to_store;
}
public String getBuynum() {
return buynum;
}
public void setBuynum(String buynum) {
this.buynum = buynum;
}
public String getCreated_date() {
return created_date;
}
public void setCreated_date(String created_date) {
this.created_date = created_date;
}
}
package com.glsk.entity;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.Data;
/**
business_analysis_staff
*/
@Data
@HeadStyle(fillForegroundColor=12)
public class StaffStaticData {
private String stat_date;//统计日期
private String staff_id;//员工id
private String staff_name;//'员工姓名'
private String staff_phone;//'员工手机号'
private String merchant_id;//门店商户号
private String merchant_name;//门店名称
private String business_type;//'业务类型'
private String output;//'门店产值'
private String ordernum;//订单数(升级订单数)
private String total_ordernum;//升级战败总订单数
private String to_store;//'新车到店流量'
private String aftersales_to_store ;//'售后到店流量'
private String buynum ;//'新车交付数'
private Integer finishday =0;//'完成日报天数'
private String totalday;//'总天数'
private String targetzhuanhualv;//'绩效周期内目标转化率'
private String targetatv;//'绩效周期内目标客单价'
private String targetstartday;//'绩效目标里定义的开始时间'
private String targetendday;//'绩效目标里定义的结束时间'
private String check_month_period;//'考核月度和考核周期'
private String daily_contribution_traffic;//'统计日当日贡献流量'
private String created_date;//'数据创建时间(查询生成时间)'
public String getCheck_month_period() {
return check_month_period;
}
public void setCheck_month_period(String check_month_period) {
this.check_month_period = check_month_period;
}
public String getStat_date() {
return stat_date;
}
public void setStat_date(String stat_date) {
this.stat_date = stat_date;
}
public String getStaff_id() {
return staff_id;
}
public void setStaff_id(String staff_id) {
this.staff_id = staff_id;
}
public String getStaff_name() {
return staff_name;
}
public void setStaff_name(String staff_name) {
this.staff_name = staff_name;
}
public String getStaff_phone() {
return staff_phone;
}
public void setStaff_phone(String staff_phone) {
this.staff_phone = staff_phone;
}
public String getMerchant_id() {
return merchant_id;
}
public void setMerchant_id(String merchant_id) {
this.merchant_id = merchant_id;
}
public String getMerchant_name() {
return merchant_name;
}
public void setMerchant_name(String merchant_name) {
this.merchant_name = merchant_name;
}
public String getBusiness_type() {
return business_type;
}
public void setBusiness_type(String business_type) {
this.business_type = business_type;
}
public String getOutput() {
return output;
}
public void setOutput(String output) {
this.output = output;
}
public String getOrdernum() {
return ordernum;
}
public void setOrdernum(String ordernum) {
this.ordernum = ordernum;
}
public String getTotal_ordernum() {
return total_ordernum;
}
public void setTotal_ordernum(String total_ordernum) {
this.total_ordernum = total_ordernum;
}
public String getTo_store() {
return to_store;
}
public void setTo_store(String to_store) {
this.to_store = to_store;
}
public String getAftersales_to_store() {
return aftersales_to_store;
}
public void setAftersales_to_store(String aftersales_to_store) {
this.aftersales_to_store = aftersales_to_store;
}
public String getBuynum() {
return buynum;
}
public void setBuynum(String buynum) {
this.buynum = buynum;
}
public Integer getFinishday() {
return finishday;
}
public void setFinishday(Integer finishday) {
this.finishday = finishday;
}
public String getTotalday() {
return totalday;
}
public void setTotalday(String totalday) {
this.totalday = totalday;
}
public String getTargetzhuanhualv() {
return targetzhuanhualv;
}
public void setTargetzhuanhualv(String targetzhuanhualv) {
this.targetzhuanhualv = targetzhuanhualv;
}
public String getTargetatv() {
return targetatv;
}
public void setTargetatv(String targetatv) {
this.targetatv = targetatv;
}
public String getTargetstartday() {
return targetstartday;
}
public void setTargetstartday(String targetstartday) {
this.targetstartday = targetstartday;
}
public String getTargetendday() {
return targetendday;
}
public void setTargetendday(String targetendday) {
this.targetendday = targetendday;
}
public String getDaily_contribution_traffic() {
return daily_contribution_traffic;
}
public void setDaily_contribution_traffic(String daily_contribution_traffic) {
this.daily_contribution_traffic = daily_contribution_traffic;
}
public String getCreated_date() {
return created_date;
}
public void setCreated_date(String created_date) {
this.created_date = created_date;
}
}
package com.glsk.entity;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import lombok.Data;
/**
business_analysis_staff_tostore
*/
@Data
@HeadStyle(fillForegroundColor=12)
public class StaffToStoreData {
private String stat_date;//统计日期
private String staff_id;//员工id
private String merchant_id;//门店商户号
private String business_type;//'业务类型'
private String to_store;//'新车到店流量'
private String aftersales_to_store ;//'售后到店流量'
private String buynum ;//'新车交付数'
private String created_date;//'数据创建时间(查询生成时间)'
public String getStat_date() {
return stat_date;
}
public void setStat_date(String stat_date) {
this.stat_date = stat_date;
}
public String getStaff_id() {
return staff_id;
}
public void setStaff_id(String staff_id) {
this.staff_id = staff_id;
}
public String getMerchant_id() {
return merchant_id;
}
public void setMerchant_id(String merchant_id) {
this.merchant_id = merchant_id;
}
public String getBusiness_type() {
return business_type;
}
public void setBusiness_type(String business_type) {
this.business_type = business_type;
}
public String getTo_store() {
return to_store;
}
public void setTo_store(String to_store) {
this.to_store = to_store;
}
public String getAftersales_to_store() {
return aftersales_to_store;
}
public void setAftersales_to_store(String aftersales_to_store) {
this.aftersales_to_store = aftersales_to_store;
}
public String getBuynum() {
return buynum;
}
public void setBuynum(String buynum) {
this.buynum = buynum;
}
public String getCreated_date() {
return created_date;
}
public void setCreated_date(String created_date) {
this.created_date = created_date;
}
}
package com.glsk.mapper;
import com.glsk.entity.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface DatavMapper {
List<Map> sqlBySelf(String sql);
void batchInsertOrUpdateStaffStaticData(StaffStaticData data);
void batchInsertOrUpdateStaffToStoreData(StaffToStoreData data);
void batchInsertOrUpdateMerchantBuyNum(MerchantBuyNum data);
void batchInsertOrUpdateMerchantStaticData(MerchantStaticData data);
void batchInsertOrUpdateMerchantStaticDatatmp(MerchantStaticData data);
void batchInsertOrUpdateEmployeeFlowData(EmployeeFlowData data);
}
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
package com.glsk.service;
import com.glsk.vo.ReqRet;
import com.glsk.vo.WarningType;
/**
* @author fangfang
* @create 2024-09-14 10:20
*/
public class Test {
public static void main(String[] args) {
}
}
package com.glsk.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;
public class ConfigurationManager {
static Properties prop =new Properties();
static{
try {
InputStream in = ConfigurationManager.class.getClassLoader().getResourceAsStream("config/my.properties");
prop.load(new InputStreamReader(in,"UTF-8"));
} catch (IOException e) {
e.printStackTrace();
}
}
public static String getProperty(String key) {
return prop.getProperty(key);
}
public static void main(String[] args) {
String staff_name = ConfigurationManager.getProperty("spring.datasource.dj_smartcarlife.jdbc-url");
System.out.println("staff_name="+staff_name);
// binlogip=192.168.1.39
// binlogport=3306
// binlogdb=dj_smartcarlife
// binlogusername=insurance_user
// binlogpassword=123456
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
// String sql01 = ConfigurationManager.getProperty("base.stat.bgnTime");
// System.out.println("sql01="+sql01);
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
}
}
package com.glsk.util;
import com.alibaba.druid.pool.DruidDataSource;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger;
public class MybatisUtil {
private static Logger logger = Logger.getLogger("MybatisUtil");
private static AtomicInteger count = new AtomicInteger();
public static void main(String[] args)throws Exception{
//数据源first
// SqlSession sessionfirst = MybatisUtil.getsqlSession("first");
// ShopmallGoodsMapper dj_smartcarlife = sessionfirst.getMapper(ShopmallGoodsMapper.class);
// getsqlSession("gh_scrm_entmicro");
}
public static String username ="";
public static String password ="";
public static String driverClassName ="";
public static String url ="";
public static SqlSession getsqlSession(String propName) throws Exception {
//获取相关信息
username = ConfigurationManager.getProperty("spring.datasource."+propName+".username");
password = ConfigurationManager.getProperty("spring.datasource."+propName+".password");
driverClassName = ConfigurationManager.getProperty("spring.datasource."+propName+".driver-class-name");
url = ConfigurationManager.getProperty("spring.datasource."+propName+".jdbc-url");
DruidDataSource dataSource = new DruidDataSource();
dataSource.setUrl(url);
dataSource.setDriverClassName(driverClassName);
dataSource.setUsername(username);
dataSource.setPassword(password);
// dataSource.setTestOnBorrow(false);
//
// dataSource.setLogAbandoned(true);//minEvictableldleTimeMillis
//
// dataSource.setRemoveAbandoned(false);
// dataSource.setRemoveAbandonedTimeout(60);
//
// dataSource.setPhyTimeoutMillis(10000);
//
// dataSource.setMinEvictableIdleTimeMillis(10000);
// dataSource.setMaxEvictableIdleTimeMillis(20000);
// dataSource.setTimeBetweenEvictionRunsMillis(5000);
// dataSource.setKeepAliveBetweenTimeMillis(30000);
//
// dataSource.setKeepAlive(true);
dataSource.setInitialSize(3);
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
// bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*/*"));
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*"));
SqlSessionFactory sqlSessionFactory = bean.getObject();
return sqlSessionFactory.openSession();
}
}
package com.glsk.util;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Mysql连接,可以跨机器使用数据库连接
*/
public class MysqlMutiConn {
private static HashMap<String, Connection> mutiConnection = new HashMap<>();
public static void addConnection(String name, String url) {
try {
Connection connection = DriverManager.getConnection(url);
mutiConnection.put(name, connection);
} catch (SQLException e) {
e.printStackTrace();
}
}
public static Connection getConnection(String name) {
return mutiConnection.get(name);
}
public static void close(Connection connection) {
try {
connection.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
public static void executeUpdate(Connection connection, String sql) {
PreparedStatement pstmt = null;
try {
connection.setAutoCommit(false);
pstmt = connection.prepareStatement(sql);
pstmt.executeUpdate();
connection.commit();
} catch (SQLException throwables) {
throwables.printStackTrace();
} finally {
try {
pstmt.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
}
public static void executeQuery(Connection connection, String sql, QueryCallback callback) {
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = connection.prepareStatement(sql);
rs = pstmt.executeQuery();
callback.process(rs);
rs.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public static ArrayList<ArrayList<String>> executeQuery(Connection connection, String sql, int columns) {
try {
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
ArrayList<ArrayList<String>> result = new ArrayList<>();
while (rs.next()) {
String temp = "";
ArrayList<String> colList = new ArrayList<>();
for (int i = 1; i <= columns; i++) {
colList.add(rs.getString(i));
}
result.add(colList);
}
rs.close();
ps.close();
return result;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
// 流式查询
public static void executeFlowQuery(Connection connection, String sql, QueryCallback callback) {
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = connection.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
pstmt.setFetchSize(Integer.MIN_VALUE);
pstmt.setFetchDirection(ResultSet.FETCH_REVERSE);
rs = pstmt.executeQuery();
callback.process(rs);
rs.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public static interface QueryCallback {
void process(ResultSet rs) throws Exception;
}
public static void main(String[] args) {
MysqlMutiConn.addConnection("querySession", "jdbc:mysql://192.168.1.39:3306/dj_smartcarlife?user=insurance_user&password=123456&useSSL=false&serverTimezone=UTC&characterEncoding=utf-8");
MysqlMutiConn.addConnection("insertSession", "jdbc:mysql://192.168.3.227:3306/dj_smartcarlife?user=dev_admin&password=1f7e1ed2&useSSL=false&serverTimezone=UTC&characterEncoding=utf-8");
Connection querySession = MysqlMutiConn.getConnection("querySession");
Connection insertSession = MysqlMutiConn.getConnection("insertSession");
String sql01="select order_code from dj_smartcarlife.dj_car_life_pay_order ";
MysqlMutiConn.executeQuery(querySession, sql01, 1);
}
}
package com.glsk.util;
import java.sql.Connection;
import java.sql.DriverManager;
/**
* @author fangfang
* @create 2024-04-26 16:13
*/
public class MysqlUtils {
public static Connection getConnection(String propName) throws Exception {
String username = ConfigurationManager.getProperty("spring.datasource." + propName + ".username");
String password = ConfigurationManager.getProperty("spring.datasource." + propName + ".password");
String driverClassName = ConfigurationManager.getProperty("spring.datasource." + propName + ".driver-class-name");
String url = ConfigurationManager.getProperty("spring.datasource." + propName + ".jdbc-url");
Class.forName("com.mysql.cj.jdbc.Driver");//20240619
// Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(url, username, password);
return conn;
}
}
package com.glsk.util;
import com.glsk.mapper.DatavMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
public class SqlSessionUtils {
private SqlSessionUtils() {
}
private static SqlSessionFactory factory;
private static ThreadLocal<SqlSession> localSessions = new ThreadLocal<SqlSession>();
static {
SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
try (InputStream inputStream = Resources.getResourceAsStream("mybatis-conf.xml")) {
factory = builder.build(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
}
public static SqlSession getSqlSession(String ss) {
SqlSession session = factory.openSession();
localSessions.set(session);
return session;
}
public static SqlSessionFactory getSqlSessionFactory() {
return factory;
}
public static void closeSession() {
//从容器中得到会话
SqlSession session = localSessions.get();
//如果会话不会为空,则关闭会话,并且从容器中删除会话对象
if (session != null) {
session.close();
localSessions.remove();
}
}
public static void main(String[] args) {
SqlSession sqlSession = getSqlSession("dashboard_bi");
DatavMapper datavMapper = sqlSession.getMapper(DatavMapper.class);
// String sql01="select stat_date,merchant_id,merchant_name from dj_smart_bi_merchant_base";
// List<Map> maps = datavMapper.sqlBySelf(sql01);
String sql02="select count(1)num from student";
List<Map> maps02 = datavMapper.sqlBySelf(sql02);
for (Map map : maps02) {
System.out.println(String.valueOf(map.get("num")));
}
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println(maps02);
System.out.println();
System.out.println();
System.out.println();
}
}
//package com.glsk.util;
//
//import java.sql.*;
//
//import static com.glsk.compute.listen.Test.getsql01;
//
///**
// * @author fangfang
// * @create 2024-04-26 15:47
// */
//public class Test02 {
//
// public static void main(String[] args) throws Exception {
// Connection connQuery = getConnection("dj_smartcarlife");
// Connection connInsert = getConnection("insert");
// //获取sql
// String sql01 = getsql01("1970-01-01", "2024-04-25");
// //预编译
// PreparedStatement st = connQuery.prepareStatement(sql01);
// // 执行查询并获取结果
// ResultSet rs = st.executeQuery(sql01);
//
//
// //插入sql
// String sql = "insert into business_analysis_overview_tmp(stat_date,merchant_id,merchant_name,business_type," +
// "item_name,output,ordernum,total_ordernum,to_store,aftersales_to_store,buynum,created_date)values(?,?,?,?,?,?,?,?,?,?,?,?)";//?:占位符
// PreparedStatement ps = connInsert.prepareStatement(sql);
//
// // 遍历结果集
// while (rs.next()) {
// ps.setString(1, rs.getString("statdate")==null?"":rs.getString("statdate"));
// ps.setString(2, rs.getString("4s店商户号"));
// ps.setString(3, rs.getString("服务门店"));
// ps.setString(4, rs.getString("业务类型"));
// ps.setString(5, "赛力斯项目");
// ps.setString(6, rs.getString("个人产值"));
// ps.setString(7, rs.getString("升级订单数"));
// ps.setString(8, rs.getString("升级战败订单总数"));
// ps.setString(9, rs.getString("新车到店流量"));
// ps.setString(10, rs.getString("售后到店流量"));
// ps.setString(11, rs.getString("新车交付数"));
// ps.setString(12, rs.getString("created_date"));
//
// //6.执行操作
// ps.executeUpdate();
// }
// // 关闭结果集、Statement和连接
// rs.close();
// //关闭PreparedStatement
// ps.close();
// st.close();
// //关闭连接
// connQuery.close();
// connInsert.close();
// System.out.println("已关闭");
// }
//
//
//
// public static Connection getConnection(String propName) throws Exception {
// String username = ConfigurationManager.getProperty("spring.datasource." + propName + ".username");
// String password = ConfigurationManager.getProperty("spring.datasource." + propName + ".password");
// String driverClassName = ConfigurationManager.getProperty("spring.datasource." + propName + ".driver-class-name");
// String url = ConfigurationManager.getProperty("spring.datasource." + propName + ".jdbc-url");
// Class.forName("com.mysql.cj.jdbc.Driver");
// Connection conn = DriverManager.getConnection(url, username, password);
// return conn;
// }
//
//}
//
//
//
//class Conninfo{
// private String username;
// private String password;
// private String driverClassName;
// private String url;
//
// @Override
// public String toString() {
// return "Conn{" +
// "username='" + username + '\'' +
// ", password='" + password + '\'' +
// ", driverClassName='" + driverClassName + '\'' +
// ", url='" + url + '\'' +
// '}';
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public String getDriverClassName() {
// return driverClassName;
// }
//
// public void setDriverClassName(String driverClassName) {
// this.driverClassName = driverClassName;
// }
//
// public String getUrl() {
// return url;
// }
//
// public void setUrl(String url) {
// this.url = url;
// }
//}
//
//
package com.glsk.vo;
/** 轻改业务性质
* # 业务性质(1:直营渠道,2:直营4S店,3:合资收购(已废弃),4:投资收购-利丰,5:投资收购-内蒙古,6:服务商投资)
* @author fangfang
* @create 2024-03-27 15:40
*/
public enum BusinessAttribute {
all,//全部
qudao,//直营渠道
shop4s,//直营4S店
// lifeng,//投资收购-利丰
// neimenggu,//投资收购-内蒙古
hezi,
fuwushang//服务商投资
}
package com.glsk.vo;
/**
* @author fangfang
* @create 2024-03-27 15:40
*/
public enum BusinessType {
quanyi,
yanbao,
qinggai,
all
}
package com.glsk.vo;
/**
* @author fangfang
* @create 2025-10-16 11:03
*/
public enum JobNameEnum {
retailsalesman //驻店零售
}
package com.glsk.vo;
/**
* @author fangfang
* @create 2024-03-27 15:42
*/
public enum QueryType {
day,
week,
month,
year,
self
}
package com.glsk.vo;
/**
* @author fangfang
* @create 2024-03-29 10:58
*/
public enum RankType {
//排序方式
asc,//升序排序
desc //降序排序
}
package com.glsk.vo;
/**
* @author fangfang
* @create 2024-03-29 10:59
*/
public enum Rankfield {
output,
atv,
yinliulv,
zhuanhualv,
shentoulv
}
package com.glsk.vo;
/**
* @author fangfang
* @create 2023-04-24 13:54
*/
public class RequestDTO {
}
package com.glsk.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(
description = "响应信息"
)
public class RopResponse<T> {
private static final String SUCCESS_CODE = "0";
private static final String FAILED_CODE = "-1";
@ApiModelProperty(
name = "code",
notes = "响应状态(0:成功;1:失败)",
dataType = "string",
required = true,
example = "0"
)
private String code;
@ApiModelProperty(
name = "errId",
notes = "错误码",
dataType = "string",
required = true
)
private String errId;
@ApiModelProperty(
name = "message",
notes = "错误描述",
dataType = "string",
example = "成功"
)
private String message;
@ApiModelProperty(
name = "data",
notes = "成功返回数据",
dataType = "object"
)
private T data;
public RopResponse() {
}
public String getCode() {
return this.code;
}
public RopResponse<T> setCode(String code) {
this.code = code;
return this;
}
public String getMessage() {
return this.message;
}
public RopResponse<T> setMessage(String message) {
this.message = message;
return this;
}
public T getData() {
return this.data;
}
public RopResponse<T> setData(T data) {
this.data = data;
return this;
}
public String getErrId() {
return this.errId;
}
public RopResponse<T> setErrId(String errId) {
this.errId = errId;
return this;
}
public static <T> RopResponse<T> error(String message) {
return (new RopResponse()).setCode("-1").setMessage(message);
}
public static <T> RopResponse<T> error(String errId, String message) {
return (new RopResponse()).setCode("-1").setErrId(errId).setMessage(message);
}
public static <T> RopResponse<T> error(String errId, String message, T data) {
return (new RopResponse()).setCode("-1").setErrId(errId).setMessage(message).setData(data);
}
public static <T> RopResponse<T> success(T data) {
return (new RopResponse()).setCode("0").setData(data).setMessage("调用服务成功!");
}
public String toString() {
return "RopResponse [code=" + this.code + ", errId=" + this.errId + ", message=" + this.message + ", data=" + this.data + "]";
}
}
package com.glsk.vo;
/**
* @author fangfang
* @create 2025-10-16 13:39
*/
public enum TalentAnalysisIndicatorType {
resignReason,//离职原因
xueli,//学历
siling,//司龄
gender,//性别
age//年龄
}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!