TASK:mixi;
This commit is contained in:
@@ -68,6 +68,11 @@ public class MiTuExportScheduledTask {
|
||||
// getBestSell();
|
||||
// getData();
|
||||
// dailySalesIncentiveStatistics();
|
||||
updateProductStock();
|
||||
}
|
||||
|
||||
private void updateProductStock() {
|
||||
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
|
||||
@@ -580,7 +580,7 @@ public class PythonService {
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
Map<String, Object> content = Maps.newHashMap();
|
||||
content.put("input_message", "recommend an outfit");
|
||||
content.put("user_id", "user123");
|
||||
content.put("user_id", aiRecommendDTO.getUserId());
|
||||
content.put("image_urls", "http://localhost:5001/chat");
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Function;
|
||||
import com.mixi.common.config.exception.BusinessException;
|
||||
import com.mixi.common.response.PageBaseResponse;
|
||||
import com.mixi.common.tasks.mituExportEntity.Transaction;
|
||||
import com.mixi.common.utils.CopyUtil;
|
||||
import com.mixi.mapper.SalesRecordMapper;
|
||||
import com.mixi.mapper.TaskConditionMapper;
|
||||
@@ -27,9 +28,14 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -108,10 +114,79 @@ public class SalesIncentivesServiceImpl extends ServiceImpl<TaskRuleMapper, Task
|
||||
.groupBy("salesman_name")
|
||||
.orderByDesc("SUM(incentive_num)");
|
||||
|
||||
List<SalesRecord> salesRecords = salesRecordMapper.selectList(queryWrapper);
|
||||
return CopyUtil.copyList(salesRecords, SalesRankingVO.class);
|
||||
}
|
||||
List<String> salesNameList = getSalesNameList();
|
||||
|
||||
List<SalesRecord> salesRecords = salesRecordMapper.selectList(queryWrapper);
|
||||
List<String> collect = salesRecords.stream().map(SalesRecord::getSalesmanName).collect(Collectors.toList());
|
||||
List<SalesRankingVO> salesRankingVOS = CopyUtil.copyList(salesRecords, SalesRankingVO.class);
|
||||
List<String> result = salesNameList.stream()
|
||||
.filter(salesName -> !collect.contains(salesName))
|
||||
.collect(Collectors.toList());
|
||||
for (String s : result) {
|
||||
SalesRankingVO salesRankingVO = new SalesRankingVO();
|
||||
salesRankingVO.setIncentiveNum(0);
|
||||
salesRankingVO.setSalesmanName(s);
|
||||
salesRankingVOS.add(salesRankingVO);
|
||||
}
|
||||
|
||||
return salesRankingVOS;
|
||||
}
|
||||
static final String JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
|
||||
static final String DB_URL = "jdbc:sqlserver://118.142.0.178:1550;databaseName=Hayman_prod";
|
||||
// 数据库凭据
|
||||
static final String USER = "user01";
|
||||
static final String PASS = "haySIS-0522";
|
||||
private List<String> getSalesNameList() {
|
||||
List<String> result = new ArrayList<>();
|
||||
// 获取今日日期
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
// 获取昨日日期
|
||||
LocalDate yesterday = today.minusDays(30);
|
||||
|
||||
// 格式化日期
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
String todayStr = today.format(formatter);
|
||||
String yesterdayStr = yesterday.format(formatter);
|
||||
// List<Transaction> result = new ArrayList<>();
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
try {
|
||||
// 注册 JDBC 驱动器
|
||||
Class.forName(JDBC_DRIVER);
|
||||
|
||||
// 打开一个连接
|
||||
System.out.println("连接数据库...");
|
||||
conn = DriverManager.getConnection(DB_URL, USER, PASS);
|
||||
|
||||
// 执行查询
|
||||
System.out.println("创建声明...");
|
||||
stmt = conn.createStatement();
|
||||
String sql;
|
||||
sql = "SELECT saleman_name FROM v_MZG016A\n" +
|
||||
"WHERE trx_date >= '" + yesterdayStr + "'\n" +
|
||||
"AND trx_date < '" + todayStr + "'\n" +
|
||||
"GROUP BY saleman_name";
|
||||
|
||||
ResultSet rs = stmt.executeQuery(sql);
|
||||
// 处理结果集
|
||||
while (rs.next()) {
|
||||
String salemanName = rs.getString("saleman_name");
|
||||
result.add(salemanName);
|
||||
}
|
||||
|
||||
// 清理环境
|
||||
rs.close();
|
||||
stmt.close();
|
||||
conn.close();
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
// 处理异常
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("查询执行完成!");
|
||||
return result;
|
||||
|
||||
}
|
||||
private List<TaskCondition> getTaskConditionListByTaskId(Long id) {
|
||||
QueryWrapper<TaskCondition> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TaskCondition::getTaskId, id);
|
||||
|
||||
Reference in New Issue
Block a user