| | |
| | | <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> |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | |
| | | @ApiModelProperty(value = "是否驶出月台(0:否 1:是)") |
| | | private int isOut; |
| | | |
| | | @ApiModelProperty(value = "0配送中,1已送达,3异常签收") |
| | | @ApiModelProperty(value = "0配送中,1已送达,2异常签收") |
| | | private int status; |
| | | |
| | | @ApiModelProperty(value = "无法送达的原因") |
New file |
| | |
| | | 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; |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | * 订单表数据处理层 |
| | | * @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}") |
| | |
| | | |
| | | @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); |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | |
| | | //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.*; |
| | |
| | | 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; |
| | |
| | | IPage<OrderTask> page2(Page initMpPage); |
| | | |
| | | IPage<OrderTask> page3(Page initMpPage, QueryWrapper<OrderTask> wrapper); |
| | | |
| | | List<OrderStatusCount> countStatus(OrderStatusCount orderStatusCount); |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
old mode 100755
new mode 100644
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |