From 86c3614c6780b3214ad70ec51011da077113022b Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期一, 18 四月 2022 16:34:54 +0800
Subject: [PATCH] 最新版本
---
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java | 50 ++++++++
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask2.java | 21 ---
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTask2Controller.java | 18 ++
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderDealScheduleImpl.java | 142 +++++++++++-----------
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/HistoryOrder.java | 81 +++++++++++++
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java | 3
6 files changed, 221 insertions(+), 94 deletions(-)
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java
index 8cba742..b1cbb90 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java
@@ -43,7 +43,8 @@
@RequestMapping(value = "/getAll", method = RequestMethod.GET)
@ApiOperation(value = "鑾峰彇鍏ㄩ儴鏁版嵁")
public Result<List<Area>> getAll() {
-
+ QueryWrapper<Area> wrapper = new QueryWrapper<>();
+ wrapper.orderByAsc("name");
List<Area> list = iAreaService.list();
return new ResultUtil<List<Area>>().setData(list);
}
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTask2Controller.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTask2Controller.java
index 5be2972..8469616 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTask2Controller.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTask2Controller.java
@@ -49,9 +49,21 @@
@RequestMapping(value = "/getByPage", method = RequestMethod.GET)
@ApiOperation(value = "鍒嗛〉鑾峰彇")
- public Result<IPage<OrderTask2>> getByPage(PageVo page) {
-
- IPage<OrderTask2> data = iOrderTask2Service.page(PageUtil.initMpPage(page));
+ public Result<IPage<OrderTask2>> getByPage(PageVo page,String sendDate,String userName,String customerName,Integer status) {
+ QueryWrapper<OrderTask2> wrapper = new QueryWrapper<>();
+ if(StrUtil.isNotEmpty(sendDate)){
+ wrapper.eq("send_date",sendDate);
+ }
+ if(StrUtil.isNotEmpty(userName)){
+ wrapper.like("user_name","%"+userName+"%");
+ }
+ if(StrUtil.isNotEmpty(customerName)){
+ wrapper.like("customer_name","%"+customerName+"%");
+ }
+ if(status!=null){
+ wrapper.eq("status",status);
+ }
+ IPage<OrderTask2> data = iOrderTask2Service.page(PageUtil.initMpPage(page),wrapper);
return new ResultUtil<IPage<OrderTask2>>().setData(data);
}
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java
index 8f83c38..9678cc0 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/pc/StatisticController.java
@@ -5,12 +5,15 @@
import cn.exrick.xboot.core.common.utils.ResultUtil;
import cn.exrick.xboot.core.common.vo.PageVo;
import cn.exrick.xboot.core.common.vo.Result;
+import cn.exrick.xboot.core.entity.User;
+import cn.exrick.xboot.core.service.UserService;
import cn.exrick.xboot.your.entity.*;
import cn.exrick.xboot.your.service.*;
import cn.exrick.xboot.your.util.HaiKangPost;
import cn.exrick.xboot.your.vo.AlarmVo;
import cn.exrick.xboot.your.vo.PreviewURLsVo;
import cn.exrick.xboot.your.vo.TalkURLsVo;
+import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
@@ -20,9 +23,11 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -66,7 +71,10 @@
private ICustomerService iCustomerService;
@Autowired
- private ICustomerReceiveService iCustomerReceiveService;
+ private IOrderTask2Service iOrderTask2Service;
+
+ @Autowired
+ private UserService userService;
@Autowired
private IDuoZhengService iDuoZhengService;
@@ -338,4 +346,44 @@
map.put("children",childrens);
return new ResultUtil<Object>().setData(map);
}
+
+ @RequestMapping(value = "/test", method = RequestMethod.GET)
+ @ApiOperation(value = "娴嬭瘯鎺ュ彛锛屾病鐢�")
+ public String test(){
+ List<OrderTask> list = iOrderTaskService.list();
+
+ List<OrderTask2> list2 = new ArrayList<>();
+ for(OrderTask orderTask:list){
+ OrderTask2 orderTask2 = new OrderTask2();
+ BeanUtil.copyProperties(orderTask,orderTask2);
+
+ if(orderTask.getUserId()!=null){
+ orderTask2.setUserName(getUser(orderTask.getUserId()));
+ }
+ if(orderTask.getCustomerId()!=null){
+ orderTask2.setCustomerName(getCustomer(orderTask.getCustomerId()));
+ }
+ list2.add(orderTask2);
+ }
+ iOrderTask2Service.saveBatch(list2);
+ return list.size()+"ok";
+ }
+
+ private String getUser(String id){
+ User user = userService.get(id);
+ if(user!=null){
+ return user.getNickname();
+ }else{
+ return null;
+ }
+ }
+
+ private String getCustomer(String id){
+ Customer customer = iCustomerService.getById(id);
+ if(customer!=null){
+ return customer.getName();
+ }else{
+ return null;
+ }
+ }
}
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask2.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask2.java
index 857837b..27af356 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask2.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask2.java
@@ -28,7 +28,7 @@
@TableName("t_order_task2")
@ApiModel(value = "璁㈠崟浠诲姟鍘嗗彶琛�")
public class OrderTask2 extends XbootBaseEntity {
- //鍙瓨鏀鹃厤閫佸畬鐨勮鍗�
+
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "璁㈠崟鍙�")
@@ -100,33 +100,18 @@
@ApiModelProperty(value = "鑰楁椂 姣")
private int time;
- @Transient
- @TableField(exist = false)
@ApiModelProperty(value = "鍟嗘埛鍚嶇О")
private String customerName;
- @Transient
- @TableField(exist = false)
- @ApiModelProperty(value = "鍟嗘埛")
- private Customer customer;
+ @ApiModelProperty(value = "閰嶉�佷汉")
+ private String userName;
- @Transient
- @TableField(exist = false)
@ApiModelProperty(value = "杞︾墝鍙�")
private String carNo;
- @Transient
- @TableField(exist = false)
@ApiModelProperty(value = "鍖哄煙鍚嶇О")
private String areaName;
- @Transient
- @TableField(exist = false)
@ApiModelProperty(value = "鍒嗘鍚嶇О")
private String areaSectionName;
-
- @Transient
- @TableField(exist = false)
- @ApiModelProperty(value = "璁㈠崟璇︽儏")
- private List<OrderDetail> orderDetails;
}
\ No newline at end of file
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/HistoryOrder.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/HistoryOrder.java
new file mode 100644
index 0000000..6422c2f
--- /dev/null
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/HistoryOrder.java
@@ -0,0 +1,81 @@
+package cn.exrick.xboot.your.schedulings;
+import cn.exrick.xboot.core.entity.User;
+import cn.exrick.xboot.core.service.UserService;
+import cn.exrick.xboot.your.entity.*;
+import cn.exrick.xboot.your.service.*;
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+//鍚屾鍘嗗彶鏁版嵁
+@Component
+public class HistoryOrder{
+
+ @Autowired
+ private IOrderTaskService iOrderTaskService;
+
+ @Autowired
+ private IOrderTask2Service iOrderTask2Service;
+
+ @Autowired
+ private UserService userService;
+
+ @Autowired
+ private ICustomerService iCustomerService;
+
+ @Scheduled(cron="0 30 21 * * ?")//姣忔櫄涓嬪崍9鐐瑰崐鐐规墽琛�
+ public void execute(){
+ String day = getDay(0);
+ QueryWrapper<OrderTask> wrapper = new QueryWrapper<>();
+ wrapper.eq("send_Date",day);
+ List<OrderTask> list = iOrderTaskService.list(wrapper);
+
+ List<OrderTask2> list2 = new ArrayList<>();
+ for(OrderTask orderTask:list){
+ OrderTask2 orderTask2 = new OrderTask2();
+ BeanUtil.copyProperties(orderTask,orderTask2);
+
+ orderTask2.setUserName(getUser(orderTask.getUserId()));
+ orderTask2.setCustomerName(getCustomer(orderTask.getCustomerId()));
+ list2.add(orderTask2);
+ }
+ iOrderTask2Service.saveBatch(list2);
+ }
+
+ private String getUser(String id){
+ User user = userService.get(id);
+ if(user!=null){
+ return user.getNickname();
+ }else{
+ return null;
+ }
+ }
+
+ private String getCustomer(String id){
+ Customer customer = iCustomerService.getById(id);
+ if(customer!=null){
+ return customer.getName();
+ }else{
+ return null;
+ }
+ }
+
+ private String getDay(int day){
+ Date dNow = new Date(); //褰撳墠鏃堕棿
+ Calendar calendar = Calendar.getInstance(); //寰楀埌鏃ュ巻
+ calendar.setTime(dNow);//鎶婂綋鍓嶆椂闂磋祴缁欐棩鍘�
+ calendar.add(Calendar.DAY_OF_MONTH, day); //璁剧疆涓哄墠n澶�
+ Date dBefore = calendar.getTime(); //寰楀埌鍓嶄竴澶╃殑鏃堕棿
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); //璁剧疆鏃堕棿鏍煎紡
+ String defaultStartDate = sdf.format(dBefore);
+ return defaultStartDate;
+ }
+}
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderDealScheduleImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderDealScheduleImpl.java
index a78ba90..b95adad 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderDealScheduleImpl.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/OrderDealScheduleImpl.java
@@ -1,71 +1,71 @@
-package cn.exrick.xboot.your.schedulings;
-import cn.exrick.xboot.your.entity.*;
-import cn.exrick.xboot.your.service.*;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-//鍒犻櫎鍘嗗彶鏁版嵁
-@Component
-public class OrderDealScheduleImpl {
-
- @Autowired
- private IOrderTaskOriginalService iOrderTaskOriginalService;
-
- @Autowired
- private IOrderDetailOriginalService iOrderDetailOriginalService;
-
- @Autowired
- private IOrderTaskService iOrderTaskService;
-
- @Autowired
- private IOrderDetailService iOrderDetailService;
-
- @Autowired
- private IDuoZhengService iDuoZhengService;
-
- @Scheduled(cron="0 0 21 * * ?")//姣忔櫄涓嬪崍9鐐规墽琛�
- //@Scheduled(cron="0 33 17 * * ?")//娴嬭瘯
- public void execute(){
- String day = getDay(-8);
- QueryWrapper<OrderTask> wrapper = new QueryWrapper<>();
- wrapper.lt("send_Date",day);
- iOrderTaskService.remove(wrapper);
-
- QueryWrapper<OrderDetail> wrapper2 = new QueryWrapper<>();
- wrapper2.lt("create_time",day+" 00:00:00");
- iOrderDetailService.remove(wrapper2);
-
- String day2 = getDay(-30);
- QueryWrapper<OrderTaskOriginal> wrapper3 = new QueryWrapper<>();
- wrapper3.lt("create_time",day2+" 00:00:00");
- iOrderTaskOriginalService.remove(wrapper3);
-
- QueryWrapper<OrderDetailOriginal> wrapper4 = new QueryWrapper<>();
- wrapper4.lt("create_time",day2+" 00:00:00");
- iOrderDetailOriginalService.remove(wrapper4);
-
- QueryWrapper<DuoZheng> wrapper5 = new QueryWrapper<>();
- iDuoZhengService.remove(wrapper5);
-
- List<DuoZheng> list = iDuoZhengService.getYiHuDuoZheng();
- iDuoZhengService.saveBatch(list);
- }
-
- private String getDay(int day){
- Date dNow = new Date(); //褰撳墠鏃堕棿
- Calendar calendar = Calendar.getInstance(); //寰楀埌鏃ュ巻
- calendar.setTime(dNow);//鎶婂綋鍓嶆椂闂磋祴缁欐棩鍘�
- calendar.add(Calendar.DAY_OF_MONTH, day); //璁剧疆涓哄墠n澶�
- Date dBefore = calendar.getTime(); //寰楀埌鍓嶄竴澶╃殑鏃堕棿
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); //璁剧疆鏃堕棿鏍煎紡
- String defaultStartDate = sdf.format(dBefore);
- return defaultStartDate;
- }
-}
+//package cn.exrick.xboot.your.schedulings;
+//import cn.exrick.xboot.your.entity.*;
+//import cn.exrick.xboot.your.service.*;
+//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.scheduling.annotation.Scheduled;
+//import org.springframework.stereotype.Component;
+//
+//import java.text.SimpleDateFormat;
+//import java.util.Calendar;
+//import java.util.Date;
+//import java.util.List;
+//
+////鍒犻櫎鍘嗗彶鏁版嵁
+//@Component
+//public class OrderDealScheduleImpl {
+//
+// @Autowired
+// private IOrderTaskOriginalService iOrderTaskOriginalService;
+//
+// @Autowired
+// private IOrderDetailOriginalService iOrderDetailOriginalService;
+//
+// @Autowired
+// private IOrderTaskService iOrderTaskService;
+//
+// @Autowired
+// private IOrderDetailService iOrderDetailService;
+//
+// @Autowired
+// private IDuoZhengService iDuoZhengService;
+//
+// @Scheduled(cron="0 0 21 * * ?")//姣忔櫄涓嬪崍9鐐规墽琛�
+// //@Scheduled(cron="0 33 17 * * ?")//娴嬭瘯
+// public void execute(){
+// String day = getDay(-15);
+// QueryWrapper<OrderTask> wrapper = new QueryWrapper<>();
+// wrapper.lt("send_Date",day);
+// iOrderTaskService.remove(wrapper);
+//
+// QueryWrapper<OrderDetail> wrapper2 = new QueryWrapper<>();
+// wrapper2.lt("create_time",day+" 00:00:00");
+// iOrderDetailService.remove(wrapper2);
+//
+// String day2 = getDay(-30);
+// QueryWrapper<OrderTaskOriginal> wrapper3 = new QueryWrapper<>();
+// wrapper3.lt("create_time",day2+" 00:00:00");
+// iOrderTaskOriginalService.remove(wrapper3);
+//
+// QueryWrapper<OrderDetailOriginal> wrapper4 = new QueryWrapper<>();
+// wrapper4.lt("create_time",day2+" 00:00:00");
+// iOrderDetailOriginalService.remove(wrapper4);
+//
+// QueryWrapper<DuoZheng> wrapper5 = new QueryWrapper<>();
+// iDuoZhengService.remove(wrapper5);
+//
+// List<DuoZheng> list = iDuoZhengService.getYiHuDuoZheng();
+// iDuoZhengService.saveBatch(list);
+// }
+//
+// private String getDay(int day){
+// Date dNow = new Date(); //褰撳墠鏃堕棿
+// Calendar calendar = Calendar.getInstance(); //寰楀埌鏃ュ巻
+// calendar.setTime(dNow);//鎶婂綋鍓嶆椂闂磋祴缁欐棩鍘�
+// calendar.add(Calendar.DAY_OF_MONTH, day); //璁剧疆涓哄墠n澶�
+// Date dBefore = calendar.getTime(); //寰楀埌鍓嶄竴澶╃殑鏃堕棿
+// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); //璁剧疆鏃堕棿鏍煎紡
+// String defaultStartDate = sdf.format(dBefore);
+// return defaultStartDate;
+// }
+//}
--
Gitblit v1.9.1