修改bug
This commit is contained in:
parent
59bd151743
commit
e62ac287bb
|
@ -0,0 +1,181 @@
|
|||
package org.jeecg.modules.kc.kcJieci.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.kc.kcJieci.entity.KcJieci;
|
||||
import org.jeecg.modules.kc.kcJieci.service.IKcJieciService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: kc_jieci
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="kc_jieci")
|
||||
@RestController
|
||||
@RequestMapping("/kcJieci/kcJieci")
|
||||
@Slf4j
|
||||
public class KcJieciController extends JeecgController<KcJieci, IKcJieciService> {
|
||||
@Autowired
|
||||
private IKcJieciService kcJieciService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param kcJieci
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "kc_jieci-分页列表查询")
|
||||
@ApiOperation(value="kc_jieci-分页列表查询", notes="kc_jieci-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<KcJieci>> queryPageList(KcJieci kcJieci,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<KcJieci> queryWrapper = QueryGenerator.initQueryWrapper(kcJieci, req.getParameterMap());
|
||||
Page<KcJieci> page = new Page<KcJieci>(pageNo, pageSize);
|
||||
IPage<KcJieci> pageList = kcJieciService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param kcJieci
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "kc_jieci-添加")
|
||||
@ApiOperation(value="kc_jieci-添加", notes="kc_jieci-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody KcJieci kcJieci) {
|
||||
kcJieciService.save(kcJieci);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param kcJieci
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "kc_jieci-编辑")
|
||||
@ApiOperation(value="kc_jieci-编辑", notes="kc_jieci-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody KcJieci kcJieci) {
|
||||
kcJieciService.updateById(kcJieci);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "kc_jieci-通过id删除")
|
||||
@ApiOperation(value="kc_jieci-通过id删除", notes="kc_jieci-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
kcJieciService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "kc_jieci-批量删除")
|
||||
@ApiOperation(value="kc_jieci-批量删除", notes="kc_jieci-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.kcJieciService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "kc_jieci-通过id查询")
|
||||
@ApiOperation(value="kc_jieci-通过id查询", notes="kc_jieci-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<KcJieci> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
KcJieci kcJieci = kcJieciService.getById(id);
|
||||
if(kcJieci==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(kcJieci);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param kcJieci
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, KcJieci kcJieci) {
|
||||
return super.exportXls(request, kcJieci, KcJieci.class, "kc_jieci");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("kcJieci:kc_jieci:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, KcJieci.class);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value="kc_jieci-首页获取节次信息", notes="kc_jieci-首页获取节次信息")
|
||||
@GetMapping(value = "/getIndexJcList")
|
||||
public Result<List<KcJieci>> getIndexJcList(KcJieci kcJieci) {
|
||||
List<KcJieci> pageList = kcJieciService.getIndexJcList(kcJieci);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package org.jeecg.modules.kc.kcJieci.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: kc_jieci
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("kc_jieci")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="kc_jieci对象", description="kc_jieci")
|
||||
public class KcJieci implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Integer id;
|
||||
/**节次*/
|
||||
@Excel(name = "节次", width = 15)
|
||||
@ApiModelProperty(value = "节次")
|
||||
private java.lang.String jieci;
|
||||
/**节次开始时间*/
|
||||
@Excel(name = "节次开始时间", width = 15)
|
||||
@ApiModelProperty(value = "节次开始时间")
|
||||
private java.lang.String hhks;
|
||||
/**节次结束时间*/
|
||||
@Excel(name = "节次结束时间", width = 15)
|
||||
@ApiModelProperty(value = "节次结束时间")
|
||||
private java.lang.String hhjs;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String kssj;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String type;
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.kc.kcJieci.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.kc.kcJieci.entity.KcJieci;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: kc_jieci
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface KcJieciMapper extends BaseMapper<KcJieci> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?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="org.jeecg.modules.kc.kcJieci.mapper.KcJieciMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.kc.kcJieci.service;
|
||||
|
||||
import org.jeecg.modules.kc.kcJieci.entity.KcJieci;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: kc_jieci
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IKcJieciService extends IService<KcJieci> {
|
||||
|
||||
List<KcJieci> getIndexJcList(KcJieci kcJieci);
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package org.jeecg.modules.kc.kcJieci.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.kc.kcJieci.entity.KcJieci;
|
||||
import org.jeecg.modules.kc.kcJieci.mapper.KcJieciMapper;
|
||||
import org.jeecg.modules.kc.kcJieci.service.IKcJieciService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: kc_jieci
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-04-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class KcJieciServiceImpl extends ServiceImpl<KcJieciMapper, KcJieci> implements IKcJieciService {
|
||||
|
||||
@Override
|
||||
public List<KcJieci> getIndexJcList(KcJieci kcJieci) {
|
||||
QueryWrapper<KcJieci> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.apply("LENGTH(jieci)>2");
|
||||
queryWrapper.orderByAsc("id");
|
||||
List<KcJieci> list = baseMapper.selectList(queryWrapper);
|
||||
List<KcJieci> resList = new ArrayList<>();
|
||||
String dqsj = DateUtils.getDate("HHmm");//获取当前时间的小时和分钟
|
||||
String minDate = list.get(0).getHhks();//最小开始时间
|
||||
String maxDate = list.get(5).getHhjs();//最大结束时间
|
||||
String dqkssj = "";//当前开始时间
|
||||
String dqjc = "";//当前节次
|
||||
String xyjkssj = "";//当前开始时间
|
||||
String xyjjc = "";//当前节次
|
||||
if(Integer.parseInt(dqsj)<Integer.parseInt(minDate)){
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//设置格式
|
||||
Calendar calendar = Calendar.getInstance(); //创建Calendar 的实例
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1); //当前时间减去一天,即一天前的时间
|
||||
//如果当前时间小于第一节开始时间则当前时间赋值为昨天,节次为最后一节
|
||||
dqkssj = simpleDateFormat.format(calendar.getTime());
|
||||
dqjc = list.get(5).getJieci();
|
||||
//下一节赋值为当天第一节
|
||||
xyjkssj = DateUtils.getDate("yyyy-MM-dd");
|
||||
xyjjc = list.get(0).getJieci();
|
||||
}else{
|
||||
if(Integer.parseInt(dqsj)>Integer.parseInt(maxDate)){
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//设置格式
|
||||
Calendar calendar = Calendar.getInstance(); //创建Calendar 的实例
|
||||
calendar.add(Calendar.DAY_OF_MONTH, +1); //当前时间减去一天,即一天前的时间
|
||||
//如果当前时间大于最后一节课则赋值给最后一节课
|
||||
dqkssj = DateUtils.getDate("yyyy-MM-dd");
|
||||
dqjc = list.get(5).getJieci();
|
||||
//下一节课赋值给明天第一节
|
||||
xyjkssj = simpleDateFormat.format(calendar.getTime());
|
||||
xyjjc = list.get(0).getJieci();
|
||||
}else{
|
||||
for(int i=0;i<list.size();i++){
|
||||
String kssj = "";
|
||||
String jssj = "";
|
||||
if(i==list.size()-1){
|
||||
kssj = list.get(i).getHhks();
|
||||
jssj = "23:59";
|
||||
}else{
|
||||
kssj = list.get(i).getHhks();
|
||||
jssj = list.get(i+1).getHhks();
|
||||
}
|
||||
if(Integer.parseInt(dqsj)>=Integer.parseInt(kssj)&&Integer.parseInt(dqsj)<Integer.parseInt(jssj)){
|
||||
dqkssj = DateUtils.getDate("yyyy-MM-dd");
|
||||
dqjc = list.get(i).getJieci();
|
||||
xyjkssj = DateUtils.getDate("yyyy-MM-dd");
|
||||
xyjjc = list.get(i+1).getJieci();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
KcJieci kcJieciRes = new KcJieci();
|
||||
kcJieciRes.setKssj(dqkssj);
|
||||
kcJieciRes.setJieci(dqjc);
|
||||
kcJieciRes.setType("1");
|
||||
resList.add(kcJieciRes);
|
||||
kcJieciRes = new KcJieci();
|
||||
kcJieciRes.setKssj(xyjkssj);
|
||||
kcJieciRes.setJieci(xyjjc);
|
||||
kcJieciRes.setType("2");
|
||||
resList.add(kcJieciRes);
|
||||
return resList;
|
||||
}
|
||||
}
|
|
@ -71,6 +71,7 @@ public class KcKetangbiaoController extends JeecgController<KcKetangbiao, IKcKet
|
|||
HttpServletRequest req) {
|
||||
QueryWrapper<KcKetangbiao> queryWrapper = QueryGenerator.initQueryWrapper(kcKetangbiao, req.getParameterMap());
|
||||
queryWrapper.apply(StringUtils.isNotBlank(kcKetangbiao.getYwmc())," (skjs like '%"+kcKetangbiao.getYwmc()+"%' or kcmc like '%"+kcKetangbiao.getYwmc()+"%')");
|
||||
queryWrapper.ne(StringUtils.isNotBlank(kcKetangbiao.getYwskxs()),"skxs",kcKetangbiao.getYwskxs());
|
||||
Page<KcKetangbiao> page = new Page<KcKetangbiao>(pageNo, pageSize);
|
||||
IPage<KcKetangbiao> pageList = kcKetangbiaoService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
|
|
|
@ -242,4 +242,6 @@ public class KcKetangbiao implements Serializable {
|
|||
|
||||
@TableField(exist = false)
|
||||
private java.lang.String ywmc;
|
||||
@TableField(exist = false)
|
||||
private java.lang.String ywskxs;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue