yanyang #32

Merged
yanyang merged 2 commits from yanyang into master 2023-12-20 15:09:14 +08:00
28 changed files with 1541 additions and 559 deletions
Showing only changes of commit 259970a317 - Show all commits

View File

@ -2,14 +2,14 @@ spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
#MySQL-local #MySQL-local
url: jdbc:mysql://10.0.1.249:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true # url: jdbc:mysql://10.0.1.249:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: cigs4 # username: cigs4
password: 1qazxsw2 # password: 1qazxsw2
#MySQL-remote #MySQL-remote
# url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: root username: root
# password: 1qaz@WSX3edc$RFV password: 1qaz@WSX3edc$RFV
# #Oracle # #Oracle
# driver-class-name: oracle.jdbc.OracleDriver # driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@192.168.10.10:1521:xe # url: jdbc:oracle:thin:@192.168.10.10:1521:xe
@ -66,15 +66,15 @@ dynamic:
# username: root # username: root
# password: 1qaz@WSX3edc$RFV # password: 1qaz@WSX3edc$RFV
## camline系统 - remote ## camline系统 - remote
# camline:
# driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: root
# password: 1qaz@WSX3edc$RFV
#
#camline系统 - local
camline: camline:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.0.1.23:3306/synapse?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: offline_data username: root
password: tpvmfab4 password: 1qaz@WSX3edc$RFV
#
#camline系统 - local
# camline:
# driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://10.0.1.23:3306/synapse?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: offline_data
# password: tpvmfab4

View File

@ -2,7 +2,7 @@ spring:
datasource: datasource:
#MySQL #MySQL
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://mysql.picaiba.com:30307/ym_pass?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root username: root
password: 1qaz@WSX3edc$RFV password: 1qaz@WSX3edc$RFV
# #Oracle # #Oracle

View File

@ -33,8 +33,8 @@ spring:
enabled: true enabled: true
redis: redis:
database: 6 database: 6
#host: 127.0.0.1 host: 127.0.0.1
host: 10.0.1.249 #host: 10.0.1.249
#host: 192.168.0.102 #host: 192.168.0.102
port: 6379 port: 6379
password: '' # 密码(默认为空) password: '' # 密码(默认为空)

View File

@ -19,7 +19,7 @@ public class CodeGenerator {
@Test @Test
public void test(){ public void test(){
mybatisPlusGenerator(new String[]{"t_wo_power_level"}); mybatisPlusGenerator(new String[]{"t_working_time"});
} }
public static void mybatisPlusGenerator(String[] include){ public static void mybatisPlusGenerator(String[] include){

View File

@ -0,0 +1,116 @@
package com.cnbm.generator.code.controller;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils;
import com.cnbm.common.utils.Result;
import com.cnbm.common.validator.AssertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.generator.code.dto.WorkingTimeDTO;
import com.cnbm.generator.code.excel.WorkingTimeExcel;
import com.cnbm.generator.code.service.WorkingTimeServiceBiz;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 班次时间段 前端控制器
*
* @author codeGenerator
* @since 2023-12-20
*/
@RestController
@RequestMapping("/code/workingTime")
@Api(tags="班次时间段 表")
public class WorkingTimeController {
@Autowired
private WorkingTimeServiceBiz workingTimeService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class)
})
@PreAuthorize("@ex.hasAuthority('code:workingTime:page')")
public Result<PageData<WorkingTimeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<WorkingTimeDTO> page = workingTimeService.page(params);
return new Result<PageData<WorkingTimeDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:workingTime:info')")
public Result<WorkingTimeDTO> get(@PathVariable("id") Long id){
WorkingTimeDTO data = workingTimeService.get(id);
return new Result<WorkingTimeDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:workingTime:save')")
public Result<Long> save(@RequestBody WorkingTimeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
workingTimeService.save(dto);
return new Result<Long>().ok(dto.getId());
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:workingTime:update')")
public Result<Long> update(@RequestBody WorkingTimeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
workingTimeService.update(dto);
return new Result<Long>().ok(dto.getId());
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:workingTime:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
workingTimeService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:workingTime:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WorkingTimeDTO> list = workingTimeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, WorkingTimeExcel.class);
}
}

View File

@ -0,0 +1,65 @@
package com.cnbm.generator.code.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.math.BigDecimal;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-20
*/
@Data
@ApiModel(value = "班次时间段 表DTO对象")
public class WorkingTimeDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
private Long id;
@ApiModelProperty(value = "班次名 ,A/B/C...")
private String orderName;
@ApiModelProperty(value = "班次开始时间, 0点 - 24点")
private LocalDateTime beginTime;
@ApiModelProperty(value = "班次结束时间, 0点 - 24点")
private LocalDateTime endTime;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
private Integer valid;
@ApiModelProperty(value = "创建人")
private Long creatorId;
@ApiModelProperty(value = "创建人姓名")
private String creatorName;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新人")
private Long updaterId;
@ApiModelProperty(value = "更新人姓名")
private String updaterName;
@ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "版本号")
private Integer version;
}

View File

@ -0,0 +1,93 @@
package com.cnbm.generator.code.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 班次时间段
* </p>
*
* @author codeGenerator
* @since 2023-12-20
*/
@Data
@TableName("t_working_time")
@ApiModel(value = "WorkingTime对象", description = "班次时间段 表")
public class WorkingTime implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("班次名 ,A/B/C...")
private String orderName;
@ApiModelProperty("班次开始时间, 0点 - 24点")
private LocalDateTime beginTime;
@ApiModelProperty("班次结束时间, 0点 - 24点")
private LocalDateTime endTime;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
@TableLogic
private Integer valid;
@ApiModelProperty("创建人")
private Long creatorId;
@ApiModelProperty("创建人姓名")
private String creatorName;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("更新人")
private Long updaterId;
@ApiModelProperty("更新人姓名")
private String updaterName;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("版本号")
private Integer version;
public static final String ID = "id";
public static final String ORDER_NAME = "order_name";
public static final String BEGIN_TIME = "begin_time";
public static final String END_TIME = "end_time";
public static final String REMARK = "remark";
public static final String VALID = "valid";
public static final String CREATOR_ID = "creator_id";
public static final String CREATOR_NAME = "creator_name";
public static final String CREATE_TIME = "create_time";
public static final String UPDATER_ID = "updater_id";
public static final String UPDATER_NAME = "updater_name";
public static final String UPDATE_TIME = "update_time";
public static final String VERSION = "version";
}

View File

@ -0,0 +1,46 @@
package com.cnbm.generator.code.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.util.Date;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-20
*/
@Data
public class WorkingTimeExcel {
@Excel(name = "ID")
private Long id;
@Excel(name = "班次名 ,A/B/C...")
private String orderName;
@Excel(name = "班次开始时间, 0点 - 24点")
private LocalDateTime beginTime;
@Excel(name = "班次结束时间, 0点 - 24点")
private LocalDateTime endTime;
@Excel(name = "备注")
private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
private Integer valid;
@Excel(name = "创建人")
private Long creatorId;
@Excel(name = "创建人姓名")
private String creatorName;
@Excel(name = "创建时间")
private LocalDateTime createTime;
@Excel(name = "更新人")
private Long updaterId;
@Excel(name = "更新人姓名")
private String updaterName;
@Excel(name = "更新时间")
private LocalDateTime updateTime;
@Excel(name = "版本号")
private Integer version;
}

View File

@ -0,0 +1,16 @@
package com.cnbm.generator.code.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.generator.code.entity.WorkingTime;
import org.apache.ibatis.annotations.Mapper;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-20
*/
@Mapper
public interface WorkingTimeMapper extends BaseDao<WorkingTime> {
}

View File

@ -0,0 +1,20 @@
<?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="com.cnbm.generator.code.mapper.WorkingTimeMapper">
<resultMap type="com.cnbm.generator.code.entity.WorkingTime" id="WorkingTimeMap">
<id column="id" property="id" />
<id column="order_name" property="orderName" />
<id column="begin_time" property="beginTime" />
<id column="end_time" property="endTime" />
<id column="remark" property="remark" />
<id column="valid" property="valid" />
<id column="creator_id" property="creatorId" />
<id column="creator_name" property="creatorName" />
<id column="create_time" property="createTime" />
<id column="updater_id" property="updaterId" />
<id column="updater_name" property="updaterName" />
<id column="update_time" property="updateTime" />
<id column="version" property="version" />
</resultMap>
</mapper>

View File

@ -0,0 +1,7 @@
-- 菜单初始SQL
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1737360876993064962, 1067246875800000035, '班次时间段 表', 'code/workingTime', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064963, 1737360876993064962, '查看', NULL, 'code:workingTime:page,code:workingTime:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064964, 1737360876993064962, '新增', NULL, 'code:workingTime:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064965, 1737360876993064962, '修改', NULL, 'code:workingTime:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064966, 1737360876993064962, '删除', NULL, 'code:workingTime:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1737360876993064967, 1737360876993064962, '导出', NULL, 'code:workingTime:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());

View File

@ -0,0 +1,15 @@
package com.cnbm.generator.code.service;
import com.cnbm.common.service.CrudService;
import com.cnbm.generator.code.dto.WorkingTimeDTO;
import com.cnbm.generator.code.entity.WorkingTime;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-20
*/
public interface WorkingTimeServiceBiz extends CrudService<WorkingTime, WorkingTimeDTO> {
}

View File

@ -0,0 +1,34 @@
package com.cnbm.generator.code.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.generator.code.dto.WorkingTimeDTO;
import com.cnbm.generator.code.mapper.WorkingTimeMapper;
import com.cnbm.generator.code.entity.WorkingTime;
import com.cnbm.generator.code.service.WorkingTimeServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-20
*/
@Service
public class WorkingTimeServiceBizImpl extends CrudServiceImpl<WorkingTimeMapper, WorkingTime, WorkingTimeDTO> implements WorkingTimeServiceBiz {
@Override
public QueryWrapper<WorkingTime> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<WorkingTime> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -127,4 +128,11 @@ public class PrintModelController {
return new Result<String>().ok(code); return new Result<String>().ok(code);
} }
@GetMapping("getByLineBody/{lineBody}")
@ApiOperation("依据line_body 查询is_enable==1 && type==2 limit 1的数据")
public Result<PrintModelDTO> getByLineBody(@PathVariable("lineBody") Integer lineBody){
PrintModelDTO dto = printModelService.getByLineBody(lineBody);
return new Result<PrintModelDTO>().ok(dto);
}
} }

View File

@ -0,0 +1,125 @@
package com.cnbm.packing.controller;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils;
import com.cnbm.common.utils.Result;
import com.cnbm.common.validator.AssertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.packing.dto.WorkingTimeDTO;
import com.cnbm.packing.excel.WorkingTimeExcel;
import com.cnbm.packing.service.WorkingTimeServiceBiz;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* 班次时间段 前端控制器
*
* @author packingGenerator
* @since 2023-12-19
*/
@RestController
@RequestMapping("/packing/workingTime")
@Api(tags="班次时间段 表")
public class WorkingTimeController {
@Autowired
private WorkingTimeServiceBiz workingTimeService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class)
})
@PreAuthorize("@ex.hasAuthority('packing:workingTime:page')")
public Result<PageData<WorkingTimeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<WorkingTimeDTO> page = workingTimeService.page(params);
return new Result<PageData<WorkingTimeDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('packing:workingTime:info')")
public Result<WorkingTimeDTO> get(@PathVariable("id") Long id){
WorkingTimeDTO data = workingTimeService.get(id);
return new Result<WorkingTimeDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('packing:workingTime:save')")
public Result<Long> save(@RequestBody WorkingTimeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
workingTimeService.save(dto);
return new Result<Long>().ok(dto.getId());
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('packing:workingTime:update')")
public Result<Long> update(@RequestBody WorkingTimeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
workingTimeService.update(dto);
return new Result<Long>().ok(dto.getId());
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('packing:workingTime:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
workingTimeService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('packing:workingTime:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WorkingTimeDTO> list = workingTimeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, WorkingTimeExcel.class);
}
@GetMapping("getOrderName")
@ApiOperation("查询时间匹配的班次名称")
public Result<String> getOrderName(@RequestBody LocalDateTime time){
String orderName = workingTimeService.getOrderName(time);
return new Result<String>().ok(orderName);
}
}

View File

@ -80,4 +80,10 @@ public class PrintModelDTO implements Serializable {
@ApiModelProperty(value = "是否启用0 停用1 启用") @ApiModelProperty(value = "是否启用0 停用1 启用")
private Integer isEnable; private Integer isEnable;
@ApiModelProperty(value = "场景前端传字符串过来目前固定这几个DZ BIPV")
private String scenes;
@ApiModelProperty(value = "产品等级,目前固定这几个 : A1 A2 A3 A4 NK")
private String productGrade;
} }

View File

@ -0,0 +1,63 @@
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-19
*/
@Data
@ApiModel(value = "班次时间段 表DTO对象")
public class WorkingTimeDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
private Long id;
@ApiModelProperty(value = "班次名 ,A/B/C...")
private String orderName;
@ApiModelProperty(value = "班次开始时间, 0点 - 24点")
private LocalDateTime beginTime;
@ApiModelProperty(value = "班次结束时间, 0点 - 24点")
private LocalDateTime endTime;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
private Integer valid;
@ApiModelProperty(value = "创建人")
private Long creatorId;
@ApiModelProperty(value = "创建人姓名")
private String creatorName;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新人")
private Long updaterId;
@ApiModelProperty(value = "更新人姓名")
private String updaterName;
@ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "版本号")
private Integer version;
}

View File

@ -81,6 +81,12 @@ public class PrintModel implements Serializable {
@ApiModelProperty("是否启用0 停用1 启用") @ApiModelProperty("是否启用0 停用1 启用")
private Integer isEnable; private Integer isEnable;
@ApiModelProperty("场景前端传字符串过来目前固定这几个DZ BIPV")
private String scenes;
@ApiModelProperty("产品等级,目前固定这几个 : A1 A2 A3 A4 NK")
private String productGrade;
public static final String ID = "ID"; public static final String ID = "ID";
@ -120,4 +126,8 @@ public class PrintModel implements Serializable {
public static final String IS_ENABLE = "is_enable"; public static final String IS_ENABLE = "is_enable";
public static final String SCENES = "scenes";
public static final String PRODUCT_GRADE = "product_grade";
} }

View File

@ -0,0 +1,94 @@
package com.cnbm.packing.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 班次时间段
* </p>
*
* @author codeGenerator
* @since 2023-12-19
*/
@Data
@TableName("t_working_time")
@ApiModel(value = "WorkingTime对象", description = "班次时间段 表")
public class WorkingTime implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("班次名 ,A/B/C...")
private String orderName;
@ApiModelProperty("班次开始时间, 0点 - 24点")
private LocalDateTime beginTime;
@ApiModelProperty("班次结束时间, 0点 - 24点")
private LocalDateTime endTime;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
@TableLogic
private Integer valid;
@ApiModelProperty("创建人")
private Long creatorId;
@ApiModelProperty("创建人姓名")
private String creatorName;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("更新人")
private Long updaterId;
@ApiModelProperty("更新人姓名")
private String updaterName;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("版本号")
private Integer version;
public static final String ID = "id";
public static final String ORDER_NAME = "order_name";
public static final String BEGIN_TIME = "begin_time";
public static final String END_TIME = "end_time";
public static final String REMARK = "remark";
public static final String VALID = "valid";
public static final String CREATOR_ID = "creator_id";
public static final String CREATOR_NAME = "creator_name";
public static final String CREATE_TIME = "create_time";
public static final String UPDATER_ID = "updater_id";
public static final String UPDATER_NAME = "updater_name";
public static final String UPDATE_TIME = "update_time";
public static final String VERSION = "version";
}

View File

@ -0,0 +1,43 @@
package com.cnbm.packing.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-19
*/
@Data
public class WorkingTimeExcel {
@Excel(name = "ID")
private Long id;
@Excel(name = "班次名 ,A/B/C...")
private String orderName;
@Excel(name = "班次开始时间, 0点 - 24点")
private LocalDateTime beginTime;
@Excel(name = "班次结束时间, 0点 - 24点")
private LocalDateTime endTime;
@Excel(name = "备注")
private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
private Integer valid;
@Excel(name = "创建人")
private Long creatorId;
@Excel(name = "创建人姓名")
private String creatorName;
@Excel(name = "创建时间")
private LocalDateTime createTime;
@Excel(name = "更新人")
private Long updaterId;
@Excel(name = "更新人姓名")
private String updaterName;
@Excel(name = "更新时间")
private LocalDateTime updateTime;
@Excel(name = "版本号")
private Integer version;
}

View File

@ -0,0 +1,23 @@
package com.cnbm.packing.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.dto.WorkingTimeDTO;
import com.cnbm.packing.entity.WorkingTime;
import org.apache.ibatis.annotations.Mapper;
import java.time.LocalDateTime;
import java.util.List;
/**
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-15
*/
@Mapper
public interface WorkingTimeMapper extends BaseDao<WorkingTime> {
List<WorkingTimeDTO> list();
}

View File

@ -30,4 +30,6 @@ public interface PrintModelServiceBiz extends CrudService<PrintModel, PrintModel
List<PrintModelDTO> list(); List<PrintModelDTO> list();
String getCode(); String getCode();
PrintModelDTO getByLineBody(Integer lineBody);
} }

View File

@ -0,0 +1,34 @@
package com.cnbm.packing.service;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.WorkingTimeDTO;
import com.cnbm.packing.dto.WorkingTimeDTO;
import com.cnbm.packing.entity.WorkingTime;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-19
*/
public interface WorkingTimeServiceBiz extends CrudService<WorkingTime, WorkingTimeDTO> {
PageData<WorkingTimeDTO> page (Map<String, Object> params);
WorkingTimeDTO get(Long id);
void save(WorkingTimeDTO dto);
void update(WorkingTimeDTO dto);
void delete(Long[] ids);
List<WorkingTimeDTO> list();
String getOrderName(LocalDateTime time);
}

View File

@ -107,5 +107,18 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
return CodeGeneratorHelper.getPrintModelCode(); return CodeGeneratorHelper.getPrintModelCode();
} }
@Override
public PrintModelDTO getByLineBody(Integer lineBody){
QueryWrapper<PrintModel> wrapper = new QueryWrapper<>();
wrapper.eq(ObjectUtils.isNotNull(lineBody), PrintModel.LINE_BODY, lineBody);
wrapper.eq(PrintModel.IS_ENABLE,1);
wrapper.eq(PrintModel.TYPE,2);
List<PrintModel> list = mapper.selectList(wrapper);
PrintModel entity = new PrintModel();
if(list.size()>0){
entity = list.get(0);
}
return ConvertUtils.sourceToTarget(entity, PrintModelDTO.class);
}
} }

View File

@ -0,0 +1,122 @@
package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.WorkingTimeDTO;
import com.cnbm.packing.entity.WorkingTime;
import com.cnbm.packing.mapper.WorkingTimeMapper;
import com.cnbm.packing.service.WorkingTimeServiceBiz;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 班次时间段
*
* @author codeGenerator
* @since 2023-12-19
*/
@Service
public class WorkingTimeServiceBizImpl extends CrudServiceImpl<WorkingTimeMapper, WorkingTime, WorkingTimeDTO> implements WorkingTimeServiceBiz {
@Autowired
private WorkingTimeMapper mapper;
@Override
public QueryWrapper<WorkingTime> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<WorkingTime> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
@Override
public PageData<WorkingTimeDTO> page (Map<String, Object> params){
IPage<WorkingTime> page = baseDao.selectPage(
getPage(params, WorkingTime.CREATE_TIME, false),
getWrapper(params)
);
return getPageData(page, WorkingTimeDTO.class);
}
@Override
public WorkingTimeDTO get(Long id) {
WorkingTime entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, WorkingTimeDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(WorkingTimeDTO dto) {
WorkingTime entity = ConvertUtils.sourceToTarget(dto, WorkingTime.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(WorkingTimeDTO dto) {
WorkingTime entity = ConvertUtils.sourceToTarget(dto, WorkingTime.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long[] ids) {
//删除
deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<WorkingTimeDTO> list() {
List<WorkingTimeDTO> list = mapper.list();
return list;
}
@Override
public String getOrderName(LocalDateTime time) {
LocalTime localTime = time.toLocalTime();
List<WorkingTimeDTO> resultList = new ArrayList<>();
List<WorkingTimeDTO> listAll = mapper.list();
for(WorkingTimeDTO dto : listAll){
LocalTime beginTime = dto.getBeginTime().toLocalTime();
LocalTime endTime = dto.getEndTime().toLocalTime();
if(beginTime.isBefore(endTime)) {
if (localTime.isBefore(endTime) && localTime.isAfter(beginTime)) {
resultList.add(dto);
}
}
else if(localTime.isAfter(endTime)||localTime.isBefore(beginTime)){
resultList.add(dto);
}
}
String orderName = null;
if(resultList.size()>0){
orderName = resultList.get(0).getOrderName();
}
return orderName;
}
}

View File

@ -22,6 +22,8 @@
<id column="CONTENT" property="content" /> <id column="CONTENT" property="content" />
<id column="line_body" property="lineBody" /> <id column="line_body" property="lineBody" />
<id column="is_enable" property="isEnable" /> <id column="is_enable" property="isEnable" />
<id column="scenes" property="scenes" />
<id column="product_grade" property="productGrade" />
</resultMap> </resultMap>
<select id="list" resultType="com.cnbm.packing.dto.PrintModelDTO"> <select id="list" resultType="com.cnbm.packing.dto.PrintModelDTO">

View File

@ -0,0 +1,25 @@
<?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="com.cnbm.packing.mapper.WorkingTimeMapper">
<resultMap type="com.cnbm.packing.entity.WorkingTime" id="WorkingTimeMap">
<id column="id" property="id" />
<id column="order_name" property="orderName" />
<id column="begin_time" property="beginTime" />
<id column="end_time" property="endTime" />
<id column="remark" property="remark" />
<id column="valid" property="valid" />
<id column="creator_id" property="creatorId" />
<id column="creator_name" property="creatorName" />
<id column="create_time" property="createTime" />
<id column="updater_id" property="updaterId" />
<id column="updater_name" property="updaterName" />
<id column="update_time" property="updateTime" />
<id column="version" property="version" />
</resultMap>
<select id="list" resultType="com.cnbm.packing.dto.WorkingTimeDTO">
select * from t_working_time
order by id asc
</select>
</mapper>