pom.xml
@@ -197,4 +197,4 @@ </dependencies> </dependencyManagement> </project> </project> xboot-modules/xboot-your/pom.xml
@@ -17,7 +17,18 @@ <artifactId>artemis-http-client</artifactId> <version>1.1.2</version> </dependency> <!-- Excel导入导出插件--> <dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> <version>2.2.2</version> </dependency> <!--<!– Excel导入导出插件 –>--> <!--<dependency>--> <!--<groupId>com.wuwenze</groupId>--> <!--<artifactId>ExcelKit</artifactId>--> <!--<version>2.0.72</version>--> <!--</dependency>--> <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/OrderTaskController.java
@@ -13,6 +13,7 @@ import cn.exrick.xboot.your.service.*; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; @@ -22,6 +23,9 @@ import org.springframework.web.bind.annotation.*; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -102,23 +106,23 @@ // } private String getFormatDate(String sendTime){ if(StrUtil.isNotEmpty(sendTime)){ private String getFormatDate(String sendTime) { if (StrUtil.isNotEmpty(sendTime)) { return sendTime; }else{ } else { return DateUtil.format(new Date(), "yyyy-MM-dd"); } } public Area getArea(String userId){ public Area getArea(String userId) { QueryWrapper<Car> carQueryWrapper = new QueryWrapper<Car>(); carQueryWrapper.eq("user_id",userId).or().eq("follow_user_id",userId); carQueryWrapper.eq("user_id", userId).or().eq("follow_user_id", userId); Car one = iCarService.getOne(carQueryWrapper); if(one==null){ if (one == null) { return null; }else{ } else { QueryWrapper<Area> wrapper = new QueryWrapper<Area>(); wrapper.eq("car_id",one.getId()); wrapper.eq("car_id", one.getId()); Area area = iAreaService.getOne(wrapper); return area; } @@ -128,28 +132,28 @@ @ApiOperation(value = "获取今日任务统计信息") public Result<Object> getAll(String sendTime) { Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ if (area == null) { return ResultUtil.error("请联系管理员绑定该车辆"); } QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); String format = getFormatDate(sendTime); wrapper2.eq("area_id",area.getId()); wrapper2.eq("send_date",format); wrapper2.eq("area_id", area.getId()); wrapper2.eq("send_date", format); List<OrderTask> list = iOrderTaskService.list(wrapper2); int sum = iOrderTaskService.sum(area.getId(),format); int sum = iOrderTaskService.sum(area.getId(), format); Map<String,Object> map = new HashMap<String,Object>(); map.put("count",list.size()); map.put("sum",sum); map.put("name",""); if(list.size()>0){ Map<String, Object> map = new HashMap<String, Object>(); map.put("count", list.size()); map.put("sum", sum); map.put("name", ""); if (list.size() > 0) { OrderTask orderTask = list.get(0); String areaSectionId = orderTask.getAreaSectionId(); AreaSection a = iAreaSectionService.getById(areaSectionId); Area area2 = iAreaService.getById(orderTask.getAreaId()); map.put("name",area2.getName()+a.getName()); map.put("name", area2.getName() + a.getName()); list.clear(); } return new ResultUtil<Object>().setData(map); @@ -159,7 +163,7 @@ @ApiOperation(value = "获取今日配送任务详情列表") public Result<List<OrderTask>> getTodayOrder(String sendTime) { Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ if (area == null) { return ResultUtil.error("请联系管理员绑定该车辆"); } @@ -169,11 +173,11 @@ // wrapper2.eq("a.send_date",format); // wrapper2.orderByAsc("a.seq").orderByAsc("a.status"); //List<OrderTask> list = iOrderTaskService.list2(wrapper2); wrapper2.eq("area_id",area.getId()); wrapper2.eq("send_date",format); wrapper2.eq("area_id", area.getId()); wrapper2.eq("send_date", format); wrapper2.orderByAsc("seq").orderByAsc("status"); List<OrderTask> list = iOrderTaskService.list(wrapper2); for(OrderTask obj:list){ for (OrderTask obj : list) { obj.setCode(obj.getLinker()); } return new ResultUtil<List<OrderTask>>().setData(list); @@ -181,24 +185,24 @@ @RequestMapping(value = "/getTodayOrderDetail", method = RequestMethod.GET) @ApiOperation(value = "获取当前配送商户详情") public Result<OrderTask> getTodayOrderDetail(String orderId,String sendTime) { public Result<OrderTask> getTodayOrderDetail(String orderId, String sendTime) { OrderTask orderTask = new OrderTask(); if(!StrUtil.isEmpty(orderId)){ if (!StrUtil.isEmpty(orderId)) { orderTask = iOrderTaskService.getById(orderId); if(orderTask.getStatus()!=0){ if (orderTask.getStatus() != 0) { return ResultUtil.error("此商户已配送"); } }else{ } else { Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ if (area == null) { return ResultUtil.error("请联系管理员绑定该车辆"); } QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); String format = getFormatDate(sendTime); wrapper2.eq("area_id",area.getId()); wrapper2.eq("send_date",format); wrapper2.eq("status",0); wrapper2.eq("area_id", area.getId()); wrapper2.eq("send_date", format); wrapper2.eq("status", 0); //wrapper2.orderByAsc("seq"); PageVo page = new PageVo(); @@ -206,18 +210,18 @@ page.setOrder("asc"); page.setPageSize(1); page.setPageNumber(0); List<OrderTask> list = iOrderTaskService.page(PageUtil.initMpPage(page),wrapper2).getRecords(); List<OrderTask> list = iOrderTaskService.page(PageUtil.initMpPage(page), wrapper2).getRecords(); //List<OrderTask> list = iOrderTaskService.list(wrapper2); if(list.size()>0){ if (list.size() > 0) { orderTask = list.get(0); }else{ } else { return new ResultUtil<OrderTask>().setData(null); } } orderTask.setCustomer(iCustomerService.getById(orderTask.getCustomerId())); QueryWrapper<OrderDetail> wrapper3 = new QueryWrapper<OrderDetail>(); wrapper3.eq("order_id",orderTask.getId()); wrapper3.eq("order_id", orderTask.getId()); orderTask.setOrderDetails(iOrderDetailService.list(wrapper3)); return new ResultUtil<OrderTask>().setData(orderTask); @@ -228,31 +232,31 @@ public Result<Object> getTodayOtherInfo(String sendTime) { Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ if (area == null) { return ResultUtil.error("请联系管理员绑定该车辆"); } QueryWrapper<OrderTask> wrapper2 = new QueryWrapper<OrderTask>(); String format = getFormatDate(sendTime); wrapper2.eq("area_id",area.getId()); wrapper2.eq("send_date",format); wrapper2.ne("status",0); wrapper2.eq("area_id", area.getId()); wrapper2.eq("send_date", format); wrapper2.ne("status", 0); wrapper2.orderByAsc("seq"); int count = iOrderTaskService.count(wrapper2); QueryWrapper<OrderTask> wrapper4 = new QueryWrapper<OrderTask>(); wrapper4.eq("area_id",area.getId()); wrapper4.eq("send_date",format); wrapper4.eq("area_id", area.getId()); wrapper4.eq("send_date", format); int count2 = iOrderTaskService.count(wrapper4); Map<String,Object> map = new HashMap<>(); map.put("num",count+"/"+count2); Map<String, Object> map = new HashMap<>(); map.put("num", count + "/" + count2); QueryWrapper<OrderTask> wrapper5 = new QueryWrapper<OrderTask>(); wrapper5.ne("status",0); wrapper5.eq("send_date",format); wrapper5.ne("status", 0); wrapper5.eq("send_date", format); PageVo page = new PageVo(); page.setSort("updateTime"); @@ -261,35 +265,35 @@ page.setPageNumber(0); IPage<OrderTask> data = iOrderTaskService.page(PageUtil.initMpPage(page), wrapper5); String content = ""; if(data.getRecords().size()>0){ if (data.getRecords().size() > 0) { String userId = data.getRecords().get(0).getUserId(); User user = userService.get(userId); QueryWrapper<OrderTask> wrapper6 = new QueryWrapper<OrderTask>(); wrapper6.eq("user_id",userId); wrapper6.eq("send_date",format); wrapper6.ne("status",0); wrapper6.eq("user_id", userId); wrapper6.eq("send_date", format); wrapper6.ne("status", 0); int count6 = iOrderTaskService.count(wrapper6); if(count6>0){ content+=user.getNickname()+"已配送"+count6+"单"; if (count6 > 0) { content += user.getNickname() + "已配送" + count6 + "单"; } } map.put("content",content); map.put("content", content); map.put("lng",""); map.put("lat",""); map.put("lng", ""); map.put("lat", ""); String deptId = securityUtil.getCurrUser().getDepartmentId(); if(StrUtil.isNotEmpty(deptId)){ if (StrUtil.isNotEmpty(deptId)) { Department department = departmentService.get(deptId); map.put("lng",department.getLng()); map.put("lat",department.getLat()); map.put("lng", department.getLng()); map.put("lat", department.getLat()); } return new ResultUtil<Object>().setData(map); } @RequestMapping(value = "/addImg", method = RequestMethod.POST) @ApiOperation(value = "上传门头照") public Object saveOrUpdate(String orderId,String imgUrl) { public Object saveOrUpdate(String orderId, String imgUrl) { OrderTask orderTask = iOrderTaskService.getById(orderId); orderTask.setImg(imgUrl); iOrderTaskService.saveOrUpdate(orderTask); @@ -298,14 +302,14 @@ @RequestMapping(value = "/signFor", method = RequestMethod.POST) @ApiOperation(value = "签收") public Object signFor(String orderId,int status,String content,String customerReceiveId,int time,String carId) { if(status==1){ if(StrUtil.isEmpty(customerReceiveId)){ public Object signFor(String orderId, int status, String content, String customerReceiveId, int time, String carId) { if (status == 1) { if (StrUtil.isEmpty(customerReceiveId)) { return ResultUtil.error("正常签收,接货人id必填"); } } if(StrUtil.isEmpty(carId)){ if (StrUtil.isEmpty(carId)) { return ResultUtil.error("车辆id不能为空"); } OrderTask orderTask = iOrderTaskService.getById(orderId); @@ -313,14 +317,14 @@ orderTask.setUserId(securityUtil.getCurrUser().getId()); orderTask.setTime(time); orderTask.setCarId(carId); if(StrUtil.isNotEmpty(customerReceiveId)){ if (StrUtil.isNotEmpty(customerReceiveId)) { orderTask.setCustomerReceiveId(customerReceiveId); } if(!StrUtil.isEmpty(content)){ if (!StrUtil.isEmpty(content)) { orderTask.setRemarks(content); }else{ if(status==2){ } else { if (status == 2) { return ResultUtil.error("请填写异常签收原因"); } } @@ -337,13 +341,13 @@ return ResultUtil.success("添加成功"); } private void saveLog(){ private void saveLog() { QueryWrapper<OrderLog> wp = new QueryWrapper<>(); wp.eq("type",2); wp.eq("type", 2); OrderLog one = iOrderLogService.getOne(wp); if(one!=null){ one.setNum(one.getNum()+1); }else{ if (one != null) { one.setNum(one.getNum() + 1); } else { one = new OrderLog(); one.setNum(1); one.setType(2); @@ -355,13 +359,13 @@ @ApiOperation(value = "获取踏勘商户") public Result<List<Customer>> getTaKan() { Area area = getArea(securityUtil.getCurrUser().getId()); if(area==null){ if (area == null) { return ResultUtil.error("请联系管理员绑定该车辆"); } QueryWrapper<Customer> wrapper2 = new QueryWrapper<Customer>(); wrapper2.eq("area_id",area.getId()); wrapper2.eq("kstatus",0); wrapper2.eq("area_id", area.getId()); wrapper2.eq("kstatus", 0); List<Customer> list = iCustomerService.list(wrapper2); return new ResultUtil<List<Customer>>().setData(list); } @@ -393,4 +397,25 @@ } return ResultUtil.success("批量通过id删除数据成功"); } @GetMapping("/outExcel")// 导出的不是中间表 @ApiOperation(value = "导出签收统计信息表", notes = "导出签收统计信息表") public void export1(OrderStatusCount orderStatusCount, HttpServletResponse response) throws IOException { List<OrderStatusCount> orderStatus = this.iOrderTaskService.countStatus(orderStatusCount); response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("utf-8"); String fileName = URLEncoder.encode("签收数量统计报表", "UTF-8"); String fileName2 = new String(fileName.getBytes("UTF-8"), "ISO8859-1"); // response.setHeader("Content-dispostion", "attachment;filename="+fileName+".xls"); response.setHeader("Content-disposition", "attachment;filename=" + fileName2 + ".xlsx"); EasyExcel.write(response.getOutputStream(), OrderStatusCount.class). sheet(0).doWrite(orderStatus); } @GetMapping(value = "/count") public Result<List<OrderStatusCount>> getAll(OrderStatusCount orderStatusCount) { List<OrderStatusCount> data = this.iOrderTaskService.countStatus(orderStatusCount); ; return new ResultUtil<List<OrderStatusCount>>().setData(data); } } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/SignCountController.java
New file @@ -0,0 +1,103 @@ package cn.exrick.xboot.your.controller; import cn.exrick.xboot.core.common.utils.PageUtil; 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.your.entity.OrderStatusCount; import cn.exrick.xboot.your.entity.QueryRequest; import cn.exrick.xboot.your.entity.SignCount; import cn.exrick.xboot.your.service.ISignCountService; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; import java.util.List; /** * @author whj */ @Slf4j @RestController @Api(tags = "状态统计报表接口") @RequestMapping("/xboot/signCount") @Transactional public class SignCountController { @Autowired private ISignCountService iSignCountService; @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) @ApiOperation(value = "通过id获取") public Result<SignCount> get(@PathVariable String id) { SignCount signCount = iSignCountService.getById(id); return new ResultUtil<SignCount>().setData(signCount); } @RequestMapping(value = "/getAll", method = RequestMethod.GET) @ApiOperation(value = "获取全部数据") public Result<List<SignCount>> getAll() { List<SignCount> list = iSignCountService.list(); return new ResultUtil<List<SignCount>>().setData(list); } @RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "分页获取") public Result<IPage<SignCount>> getByPage(PageVo page) { IPage<SignCount> data = iSignCountService.page(PageUtil.initMpPage(page)); return new ResultUtil<IPage<SignCount>>().setData(data); } @RequestMapping(value = "/insertOrUpdate", method = RequestMethod.POST) @ApiOperation(value = "编辑或更新数据") public Result<SignCount> saveOrUpdate(SignCount signCount) { if (iSignCountService.saveOrUpdate(signCount)) { return new ResultUtil<SignCount>().setData(signCount); } return new ResultUtil<SignCount>().setErrorMsg("操作失败"); } @RequestMapping(value = "/delByIds", method = RequestMethod.POST) @ApiOperation(value = "批量通过id删除") public Result<Object> delAllByIds(@RequestParam String[] ids) { for (String id : ids) { iSignCountService.removeById(id); } return ResultUtil.success("批量通过id删除数据成功"); } @GetMapping("/outExcels") @ApiOperation(value = "导出签收统计信息表", notes = "导出签收统计信息表") public void export1(OrderStatusCount orderStatusCount, HttpServletResponse response,QueryRequest queryRequest) throws IOException { List<OrderStatusCount> orderStatus = this.iSignCountService.signCounts(orderStatusCount,queryRequest).getRecords(); response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("utf-8"); String fileName = URLEncoder.encode("签收数量统计报表", "UTF-8"); String fileName2 = new String(fileName.getBytes("UTF-8"), "ISO8859-1"); // response.setHeader("Content-dispostion", "attachment;filename="+fileName+".xls"); response.setHeader("Content-disposition", "attachment;filename=" + fileName2 + ".xlsx"); EasyExcel.write(response.getOutputStream(),OrderStatusCount.class). sheet(0).doWrite(orderStatus); } @GetMapping(value = "/selectBySign") public Result<IPage<OrderStatusCount>> signCounts(OrderStatusCount orderStatusCount,QueryRequest queryRequest) { IPage<OrderStatusCount> data = this.iSignCountService.signCounts(orderStatusCount,queryRequest); return new ResultUtil<IPage<OrderStatusCount>>().setData(data); } } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/TaskController.java
New file @@ -0,0 +1,114 @@ package cn.exrick.xboot.your.controller.wx; import cn.exrick.xboot.core.common.utils.ObjectUtil; import cn.exrick.xboot.core.common.utils.ResultUtil; import cn.exrick.xboot.your.entity.OrderStatusCount; import cn.exrick.xboot.your.entity.SignCount; import cn.exrick.xboot.your.entity.Suggest; import cn.exrick.xboot.your.service.IOrderTaskService; import cn.exrick.xboot.your.service.ISignCountService; import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import javax.rmi.CORBA.Util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.UUID; @Component @Configuration //1.主要用于标记配置类,兼备Component的效果。 @EnableScheduling @AllArgsConstructor public class TaskController { private IOrderTaskService iOrderTaskService; private ISignCountService iSignCountService; //3.添加定时任务 // @Scheduled(cron = "0/5 * * * * ?") // @Scheduled(cron = "0 */1 * * * ?") // @Scheduled(cron = "0 0 2 * * ?")//每天凌晨两点执行一次 @Scheduled(cron = " 0 0 */1 * * ?")//每小时执行一次 //或直接指定时间间隔,例如:5秒 //@Scheduled(fixedRate=5000) private void configureTasks() { System.err.println("执行存储数据定时任务时间: " + LocalDateTime.now()); OrderStatusCount orderStatusCount = new OrderStatusCount(); List<OrderStatusCount> StatusCounts = iOrderTaskService.countStatus(orderStatusCount); if (StatusCounts != null && StatusCounts.size() != 0) { List<SignCount> list = iSignCountService.list(); for (OrderStatusCount statusCount : StatusCounts) { SignCount signCount = new SignCount(); boolean flag = false; for (SignCount signCountS : list) { if (signCountS.getTaskId().equals(statusCount.getId())) { signCount.setId(signCountS.getId()); signCount.setCarName(statusCount.getCarName()); signCount.setAmount(statusCount.getAmount()); signCount.setSignCount(statusCount.getSignCount()); signCount.setAbnormalSign(statusCount.getAbnormalSign()); signCount.setBatch(statusCount.getBatch()); signCount.setLine(statusCount.getLine()); signCount.setNotSignCount(statusCount.getNotSignCount()); String SendDate=getBeforeOneDayByStringDate(statusCount.getSendDate()); signCount.setSendDate(SendDate); signCount.setProportion(statusCount.getProportion()); signCount.setUserName(statusCount.getUserName()); signCount.setTaskId(statusCount.getId()); iSignCountService.saveOrUpdate(signCount); System.out.println("更新成功"); flag = true; break; } } if (flag) { continue; } signCount.setCarName(statusCount.getCarName()); signCount.setAmount(statusCount.getAmount()); signCount.setSignCount(statusCount.getSignCount()); signCount.setAbnormalSign(statusCount.getAbnormalSign()); signCount.setBatch(statusCount.getBatch()); signCount.setLine(statusCount.getLine()); signCount.setNotSignCount(statusCount.getNotSignCount()); String SendDate=getBeforeOneDayByStringDate(statusCount.getSendDate()); signCount.setSendDate(SendDate); signCount.setProportion(statusCount.getProportion()); signCount.setUserName(statusCount.getUserName()); signCount.setTaskId(statusCount.getId()); if (iSignCountService.saveOrUpdate(signCount)) { System.out.println("定时存储成功"); } } } } private String getBeforeOneDayByStringDate(String dateString) { String times = ""; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date d; try { d = format.parse(dateString); Calendar calendar = Calendar.getInstance(); calendar.setTime(d); calendar.add(Calendar.DAY_OF_MONTH, -1); // 在当前日基础上-1 String format1 = format.format(calendar.getTime()); times = format1; //获取String类型的时间 } catch (ParseException e) { e.printStackTrace(); } return times; } } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderStatusCount.java
New file @@ -0,0 +1,83 @@ package cn.exrick.xboot.your.entity; import cn.exrick.xboot.core.base.XbootBaseEntity; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ContentLoopMerge; import com.baomidou.mybatisplus.annotation.TableField; import lombok.Data; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Entity; @Data //@Excel("签收状态统计报表") public class OrderStatusCount { // @ContentLoopMerge(eachRow = 5) @ExcelProperty("车号") @TableField(value = "carName") private String carName; // @ContentLoopMerge(eachRow = 5) @ExcelProperty("线路") @TableField(value = "line") private String line; @ExcelProperty("批次") @TableField(value = "batch") private String batch; @ExcelProperty("总数量") @TableField(value = "amount") private String amount; @ExcelProperty("未签收") @TableField(value = "notSignCount") private String notSignCount; @ExcelProperty("签收") @TableField(value = "signCount") private String signCount; @ExcelProperty("异常签收") @TableField(value = "abnormalSign") private String abnormalSign; @ExcelProperty("签收率") @TableField(value = "proportion") private String proportion; @ExcelProperty("日期") @ColumnWidth(20) private String sendDate; // 1 按日查询 3按月查询 @ExcelIgnore private String StatisticalType; //开始时间 @ExcelIgnore private String sendDateStart; // 结束时间 @ExcelIgnore private String sendDateEnd; @ExcelIgnore private String id; @ExcelIgnore private String taskId; @ExcelIgnore private String carId; @ExcelIgnore private String carNo; @ExcelIgnore private String name; @ExcelIgnore private String userName; @ExcelIgnore private String carTime; @ExcelIgnore private String oneBatch; @ExcelIgnore private String twoBatch; @ExcelIgnore private String threeBatch; @ExcelIgnore private String fourBatch; @ExcelIgnore private String fiveBatch; @ExcelIgnore private String sendMonth; } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderTask.java
@@ -80,7 +80,7 @@ @ApiModelProperty(value = "是否驶出月台(0:否 1:是)") private int isOut; @ApiModelProperty(value = "0配送中,1已送达,3异常签收") @ApiModelProperty(value = "0配送中,1已送达,2异常签收") private int status; @ApiModelProperty(value = "无法送达的原因") xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/QueryRequest.java
New file @@ -0,0 +1,36 @@ package cn.exrick.xboot.your.entity; import lombok.Data; import lombok.ToString; import java.io.Serializable; /** * @author hbcf */ @Data @ToString public class QueryRequest implements Serializable { private static final long serialVersionUID = -4869594085374385813L; /** * 当前页面数据量 */ private int pageSize = 2000; /** * 当前页码 */ private int pageNum = 1; /** * 排序字段 */ private String field; /** * 排序规则,asc升序,desc降序 */ private String order; } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/SignCount.java
New file @@ -0,0 +1,80 @@ package cn.exrick.xboot.your.entity; import cn.exrick.xboot.core.base.XbootBaseEntity; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.experimental.Accessors; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import org.springframework.data.annotation.CreatedDate; import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.Entity; import javax.persistence.Table; import java.math.BigDecimal; import java.util.Date; /** * @author whj */ @Data @Table(name = "t_sign") @TableName("t_sign") @ApiModel(value = "状态统计表") public class SignCount { // private static final long serialVersionUID = 1L; @ExcelProperty("车号" ) @ApiModelProperty(value = "车号") private String carName; @ExcelProperty("线路" ) @TableField(value = "line" ) private String line; @ExcelProperty("批次" ) @TableField(value = "batch" ) private String batch; @ExcelProperty("总数量" ) @ApiModelProperty(value = "总数量") private String amount; @ExcelProperty("未签收" ) private String notSignCount; @ExcelProperty("签收" ) private String signCount; @ExcelProperty("异常签收" ) private String abnormalSign; @ExcelProperty("签收率" ) @TableField(value = "proportion" ) private String proportion; @ExcelProperty("日期" ) private String sendDate; @ExcelIgnore private String id; @ExcelIgnore private String userName; @ExcelIgnore private String sendDateStart; @ExcelIgnore private String sendDateEnd; @ExcelIgnore private String taskId; @ExcelIgnore private String carNo; @ExcelIgnore private String name; @CreatedDate @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "创建时间") @TableField(fill = FieldFill.INSERT) @ExcelIgnore private Date createTime; } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java
@@ -1,6 +1,7 @@ package cn.exrick.xboot.your.mapper; import cn.exrick.xboot.your.entity.AddOil; import cn.exrick.xboot.your.entity.OrderStatusCount; import cn.exrick.xboot.your.entity.Suggest; import cn.exrick.xboot.your.vo.Month; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -18,6 +19,7 @@ * 订单表数据处理层 * @author whj */ //@Repository public interface OrderTaskMapper extends BaseMapper<OrderTask> { @Select("SELECT sum(num) FROM t_order_task where area_id=#{arg0} and DATE_FORMAT(send_date,'%Y-%m-%d')=#{arg1}") @@ -87,4 +89,6 @@ @Select("SELECT o.*,c.name as customerName FROM t_order_task o LEFT JOIN t_customer c ON o.customer_id=c.id ${ew.customSqlSegment}") IPage<OrderTask> page3(Page initMpPage,@Param(Constants.WRAPPER) QueryWrapper<OrderTask> wrapper); List<OrderStatusCount> countStatus( OrderStatusCount orderStatusCount); } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/SignCountMapper.java
New file @@ -0,0 +1,22 @@ package cn.exrick.xboot.your.mapper; import cn.exrick.xboot.your.entity.OrderStatusCount; import cn.exrick.xboot.your.entity.QueryRequest; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.exrick.xboot.your.entity.SignCount; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Param; import java.util.List; /** * 状态统计表数据处理层 * @author whj */ public interface SignCountMapper extends BaseMapper<SignCount> { IPage<OrderStatusCount> signCounts( @Param("bo")OrderStatusCount orderStatusCount, Page<OrderStatusCount> page); IPage<OrderStatusCount> signCount( @Param("bo")OrderStatusCount orderStatusCount,Page<OrderStatusCount> page); } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/CarLocationScheduleImpl.java
@@ -1,4 +1,4 @@ //package cn.exrick.xboot.your.schedulings; package cn.exrick.xboot.your.schedulings;//package cn.exrick.xboot.your.schedulings; //import cn.exrick.xboot.your.entity.Car; //import cn.exrick.xboot.your.entity.CarLocation; //import cn.exrick.xboot.your.service.*; xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java
@@ -1,5 +1,6 @@ package cn.exrick.xboot.your.service; import cn.exrick.xboot.your.entity.OrderStatusCount; import cn.exrick.xboot.your.entity.Suggest; import cn.exrick.xboot.your.vo.Month; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -39,4 +40,6 @@ IPage<OrderTask> page2(Page initMpPage); IPage<OrderTask> page3(Page initMpPage, QueryWrapper<OrderTask> wrapper); List<OrderStatusCount> countStatus(OrderStatusCount orderStatusCount); } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ISignCountService.java
New file @@ -0,0 +1,18 @@ package cn.exrick.xboot.your.service; import cn.exrick.xboot.your.entity.OrderStatusCount; import cn.exrick.xboot.your.entity.QueryRequest; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import cn.exrick.xboot.your.entity.SignCount; import java.util.List; /** * 状态统计表接口 * @author whj */ public interface ISignCountService extends IService<SignCount> { IPage<OrderStatusCount> signCounts(OrderStatusCount orderStatusCount, QueryRequest queryRequest); } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java
@@ -1,5 +1,6 @@ package cn.exrick.xboot.your.serviceimpl; import cn.exrick.xboot.your.entity.OrderStatusCount; import cn.exrick.xboot.your.entity.Suggest; import cn.exrick.xboot.your.mapper.OrderTaskMapper; import cn.exrick.xboot.your.entity.OrderTask; @@ -91,4 +92,9 @@ public IPage<OrderTask> page3(Page initMpPage, QueryWrapper<OrderTask> wrapper) { return orderTaskMapper.page3(initMpPage,wrapper); } @Override public List<OrderStatusCount> countStatus(OrderStatusCount orderStatusCount) { return this.orderTaskMapper.countStatus(orderStatusCount); } } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ISignCountServiceImpl.java
New file @@ -0,0 +1,49 @@ package cn.exrick.xboot.your.serviceimpl; import cn.exrick.xboot.your.entity.OrderStatusCount; import cn.exrick.xboot.your.entity.QueryRequest; import cn.exrick.xboot.your.mapper.SignCountMapper; import cn.exrick.xboot.your.entity.SignCount; import cn.exrick.xboot.your.service.ISignCountService; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; /** * 状态统计表接口实现 * @author whj */ @Slf4j @Service @Transactional public class ISignCountServiceImpl extends ServiceImpl<SignCountMapper, SignCount> implements ISignCountService { @Autowired private SignCountMapper signCountMapper; @Override public IPage<OrderStatusCount> signCounts(OrderStatusCount orderStatusCount,QueryRequest queryRequest) { Page<OrderStatusCount> page = new Page<>(); if (org.apache.commons.lang3.StringUtils.isNotBlank(queryRequest.getPageSize() + "") && (queryRequest.getPageSize() != 0)) { page.setCurrent(queryRequest.getPageNum()); page.setSize(queryRequest.getPageSize()); } else { page.setCurrent(0); page.setSize(-1); } if(StringUtil.isNotBlank(orderStatusCount.getStatisticalType())){ return this.signCountMapper.signCounts(orderStatusCount,page); } return this.signCountMapper.signCount(orderStatusCount,page); } } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/FindHistoryGpsRequest.javaold mode 100755 new mode 100644
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/PlaybackURLsVo.javaold mode 100755 new mode 100644
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/PreviewURLsVo.javaold mode 100755 new mode 100644
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/TalkURLsVo.javaold mode 100755 new mode 100644
xboot-modules/xboot-your/src/main/resources/mapper/OrderTaskMapper.xml
@@ -1,5 +1,79 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cn.exrick.xboot.your.mapper.OrderTaskMapper"> <select id="countStatus" resultType="cn.exrick.xboot.your.entity.OrderStatusCount"> SELECT <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '1'.toString()"> DATE(DATE_FORMAT(DATE_SUB(a.send_date,INTERVAL 1 DAY),'%Y-%m-%d')) warntime, </if> <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '2'.toString()"> WEEK(DATE_FORMAT(DATE_SUB(a.send_date,INTERVAL 1 DAY),'%Y-%m-%d')) warntime, </if> <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '3'.toString()"> MONTH(DATE_FORMAT(DATE_SUB(a.send_date,INTERVAL 1 DAY),'%Y-%m-%d')) warntime, </if> <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '4'.toString()"> YEAR(DATE_FORMAT(DATE_SUB(a.send_date,INTERVAL 1 DAY),'%Y-%m-%d')) warntime, </if> b.car_no AS carName, c.NAME AS line, d.NAME AS batch, a.send_date, e.nickname as username, a.id, count( a.area_section_id ) AS amount, sum( CASE WHEN a.STATUS = 0 THEN 1 ELSE 0 END ) AS notSignCount, sum( CASE WHEN a.STATUS = 1 THEN 1 ELSE 0 END ) AS signCount , ( count( a.status = 1 OR NULL )/ count(a.status >= 0 OR NULL ) * 100 ) AS proportion FROM t_order_task a LEFT JOIN t_car b ON a.car_id = b.id LEFT JOIN t_area c ON a.area_id = c.id LEFT JOIN t_area_ection d ON a.area_section_id = d.id LEFT JOIN t_user e ON e.id = b.user_id <where> 1=1 <if test="carId != null and carId != ''" > AND a.car_id = #{carId} </if> <if test="carNo != null and carNo != ''" > AND b.car_no = #{carNo} </if> <if test="name != null and name != ''" > AND d.NAME = #{name} </if> <if test="sendDate != null and sendDate != ''"> AND DATE_FORMAT(a.send_date,'%Y-%m-%d') = #{sendDate} </if> <if test="sendDateStart != null and sendDateStart != ''"> AND send_date >= #{createTimeFrom} </if> <if test="sendDateEnd != null and sendDateEnd != ''"> AND send_date < #{createTimeTo} </if> </where> GROUP BY <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '1'.toString()"> DATE(a.send_date), </if> <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '2'.toString()"> WEEK(a.send_date,1), </if> <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '3'.toString()"> MONTH(a.send_date), </if> <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '4'.toString()"> YEAR(a.send_date), </if> a.area_section_id, b.car_no, c.NAME, d.NAME, a.send_date ORDER BY c.NAME ASC, a.send_date asc </select> </mapper> xboot-modules/xboot-your/src/main/resources/mapper/SignCountMapper.xml
New file @@ -0,0 +1,139 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cn.exrick.xboot.your.mapper.SignCountMapper"> <select id="signCounts" resultType="cn.exrick.xboot.your.entity.OrderStatusCount"> SELECT <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '1'.toString()"> DATE(DATE_FORMAT(send_date,'%Y-%m-%d') ) sendDate, amount, abnormal_sign as abnormalSign, not_sign_count as notSignCount, sign_count as signCount , CONCAT_WS( '',ROUND(proportion,0), '%') as proportion, </if> <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '2'.toString()"> WEEK(DATE_FORMAT(DATE_SUB(send_date,INTERVAL 1 DAY),'%Y-%m-%d')) sendDate, </if> <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '3'.toString()"> CONCAT_WS('',YEAR(send_date),'年',MONTH(DATE_FORMAT(send_date,'%Y-%m-%d')),'月')sendDate, sum(amount), sum(abnormal_sign) AS abnormalSign, sum(not_sign_count) AS notSignCount, sum(sign_count )AS signCount, CONCAT_WS( '',ROUND(AVG(proportion),0), '%') as proportion, </if> <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '4'.toString()"> YEAR(DATE_FORMAT(DATE_SUB(send_date,INTERVAL 1 DAY),'%Y-%m-%d')) sendDate, </if> car_name, (CASE `batch` WHEN '01段' THEN batch ELSE 0 END) as 'oneBatch', (CASE `batch` WHEN '02段' THEN batch ELSE 0 END) as 'twoBatch', (CASE `batch` WHEN '03段' THEN batch ELSE 0 END) as 'threeBatch', (CASE `batch` WHEN '04段' THEN batch ELSE 0 END) as 'fourBatch', (CASE `batch` WHEN '05段' THEN batch ELSE 0 END) as 'fiveBatch', line, batch, user_name as userName FROM t_sign <where> 1=1 <if test="bo.line != null and bo.line != ''" > AND line = #{bo.line} </if> <if test="bo.carName != null and bo.carName != ''" > AND car_name like CONCAT ('%',#{bo.carName},'%') </if> <if test="bo.batch != null and bo.batch != ''" > AND batch = #{bo.batch} </if> <if test="bo.userName != null and bo.userName != ''" > AND user_name = #{bo.userName} </if> <if test="bo.sendDate != null and bo.sendDate != ''"> AND DATE_FORMAT(send_date,'%Y-%m-%d') = #{bo.sendDate} </if> <if test="bo.sendDateStart != null and bo.sendDateStart != ''"> AND send_date >= #{bo.sendDateStart} </if> <if test="bo.sendDateEnd != null and bo.sendDateEnd != ''"> AND send_date <= #{bo.sendDateEnd} </if> </where> GROUP BY <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '1'.toString()"> DATE(send_date), </if> <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '2'.toString()"> WEEK(send_date,1), </if> <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '3'.toString()"> MONTH(send_date), </if> <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '4'.toString()"> YEAR(send_date), </if> car_name, line, batch ORDER BY line ASC, send_date asc </select> <select id="signCount" resultType="cn.exrick.xboot.your.entity.OrderStatusCount"> SELECT DATE_FORMAT(send_date,'%Y-%m-%d') as sendDate, (CASE `batch` WHEN '01段' THEN batch ELSE 0 END) as 'oneBatch', (CASE `batch` WHEN '02段' THEN batch ELSE 0 END) as 'twoBatch', (CASE `batch` WHEN '03段' THEN batch ELSE 0 END) as 'threeBatch', (CASE `batch` WHEN '04段' THEN batch ELSE 0 END) as 'fourBatch', (CASE `batch` WHEN '05段' THEN batch ELSE 0 END) as 'fiveBatch', CONCAT_WS('',YEAR(send_date),'年',MONTH(send_date),'月')sendMonth, amount, abnormal_sign as abnormalSign, not_sign_count as notSignCount, sign_count as signCount , CONCAT_WS( '',ROUND(proportion,0), '%') as proportion, car_name, line, batch, user_name as userName FROM t_sign <where> 1=1 <if test="bo.line != null and bo.line != ''" > AND line = #{bo.line} </if> <if test="bo.carName != null and bo.carName != ''" > AND car_name like CONCAT ('%',#{bo.carName},'%') </if> <if test="bo.batch != null and bo.batch != ''" > AND batch = #{bo.batch} </if> <if test="bo.userName != null and bo.userName != ''" > AND user_name = #{bo.userName} </if> <if test="bo.sendDate != null and bo.sendDate != ''"> AND DATE_FORMAT(send_date,'%Y-%m-%d') = #{bo.sendDate} </if> <if test="bo.sendDateStart != null and bo.sendDateStart != ''"> AND send_date >= #{bo.sendDateStart} </if> <if test="bo.sendDateEnd != null and bo.sendDateEnd != ''"> AND send_date <= #{bo.sendDateEnd} </if> </where> GROUP BY DATE(send_date), car_name, line, batch ORDER BY line ASC, send_date asc </select> </mapper> xboot-modules/xboot-your/xboot-your.iml
File was deleted