欣影管理平台时间任务修改新增删除

jni
liuguijing 2 years ago
parent 834eccbfbe
commit cb0a6a2c8b

@ -37,7 +37,7 @@ public class LineController extends BaseController {
@ApiOperation(value = "获取线路树状图", notes = "获取线路树状图接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getLineTreeList")
@Log(title = "获取线路列表", type = "查询")
@Log(title = "获取线路树状图", type = "查询")
public ResponseReult<LineTreeListModel> getLineTreeList() {
ServiceBody<LineTreeListModel> serviceBody = lineService.getLineTreeList();
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {

@ -5,13 +5,10 @@ import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.TerminalListModel;
import com.shxy.xymanager_common.vo.TerminalIdListVo;
import com.shxy.xymanager_common.vo.TerminalVo;
import com.shxy.xymanager_common.vo.UpdateTerminalVo;
import com.shxy.xymanager_common.model.TerminalScheduleRuleListModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleModel;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
import com.shxy.xymanager_service.service.TerminalScheduleService;
import com.shxy.xymanager_service.service.TerminalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
@ -36,8 +33,8 @@ public class TerminalScheduleRuleController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getScheduleRulelList")
@Log(title = "获取任务规则列表", type = "查询")
public ResponseReult<TerminalListModel> getSchedulelRuleList() {
ServiceBody<TerminalListModel> serviceBody = terminalScheduleRuleService.getScheduleRuleList();
public ResponseReult<TerminalScheduleRuleListModel> getSchedulelRuleList() {
ServiceBody<TerminalScheduleRuleListModel> serviceBody = terminalScheduleRuleService.getScheduleRuleList();
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -45,7 +42,59 @@ public class TerminalScheduleRuleController extends BaseController {
}
}
@ApiOperation(value = "获取单个任务规则", notes = "获取单个任务规则接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getSingleScheduleRule")
@Log(title = "获取单个任务规则", type = "查询")
public ResponseReult<TerminalScheduleRuleModel> getSingleScheduleRule(@RequestBody @Validated TerminalRuleIdVo vo) {
ServiceBody<TerminalScheduleRuleModel> serviceBody = terminalScheduleRuleService.getSingleScheduleRule(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
@ApiOperation(value = "添加任务规则列表", notes = "添加任务规则列表接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/addSchelduleRuleList")
@Log(title = "添加任务规则列表", type = "新增")
public ResponseReult<String> addSchedulelRuleList(@RequestBody @Validated TerminalRuleListVo vo) {
ServiceBody<String> serviceBody = terminalScheduleRuleService.addSchedulelRuleList(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
@ApiOperation(value = "修改任务规则", notes = "修改任务规则接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/updateSchelduleRule")
@Log(title = "修改任务规则", type = "修改")
public ResponseReult<String> updateSchelduleRule(@RequestBody @Validated TerminalRuleVo vo) {
ServiceBody<String> serviceBody = terminalScheduleRuleService.updateSchelduleRule(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
@ApiOperation(value = "删除任务规则", notes = "删除任务规则接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/deleteSchelduleRule")
@Log(title = "删除任务规则", type = "修改")
public ResponseReult<String> deleteSchelduleRule(@RequestBody @Validated TerminalRuleIdListVo vo) {
ServiceBody<String> serviceBody = terminalScheduleRuleService.deleteSchelduleRule(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
}

@ -16,6 +16,6 @@ public class LineAndTerminalDto {
private Byte dyLevel;
private List<Terminals> itemList;
private List<Terminals> list;
}

@ -27,7 +27,7 @@ public class TerminalPhoto implements Serializable {
private String path;
private Byte manualRequest;
private Integer manualRequest;
private Date createTime;

@ -1,8 +1,11 @@
package com.shxy.xymanager_common.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class TerminalSchedule implements Serializable {
private Integer id;
@ -22,67 +25,4 @@ public class TerminalSchedule implements Serializable {
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getTermId() {
return termId;
}
public void setTermId(Integer termId) {
this.termId = termId;
}
public Byte getChannelId() {
return channelId;
}
public void setChannelId(Byte channelId) {
this.channelId = channelId;
}
public Byte getHour() {
return hour;
}
public void setHour(Byte hour) {
this.hour = hour;
}
public Byte getMinute() {
return minute;
}
public void setMinute(Byte minute) {
this.minute = minute;
}
public Integer getPresetId() {
return presetId;
}
public void setPresetId(Integer presetId) {
this.presetId = presetId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

@ -16,10 +16,12 @@ public class TerminalScheduleRule implements Serializable {
private Date endTime;
private Integer interval;
private Integer span;
private String remark;
private Integer status;
private Date createTime;
private Date updateTime;

@ -16,7 +16,7 @@ import java.util.List;
public class LineListModel implements Serializable {
@ApiModelProperty(value = "杆塔线路列表", example = "[]")
private List<LineBean> terminalBeanList;
private List<LineBean> list;
@Data
public static class LineBean {

@ -14,8 +14,8 @@ import java.util.List;
@ApiModel(value = "获取线路树状图列表", description = "获取线路树状图列表信息")
public class LineTreeListModel implements Serializable {
@ApiModelProperty(value = "杆塔线路列表", example = "[]")
private List<LineBean> linelist;
@ApiModelProperty(value = "线路列表", example = "[]")
private List<LineBean> list;
@Data
public static class LineBean {
@ -33,12 +33,15 @@ public class LineTreeListModel implements Serializable {
private Byte dyLevel;
@ApiModelProperty(value = "装置信息", example = "123456")
private List<TerminalBean> itemList;
private List<TerminalBean> list;
}
@Data
private static class TerminalBean {
public static class TerminalBean {
@ApiModelProperty(value = "装置编号", example = "123456")
private Integer id;
@ApiModelProperty(value = "杆塔编号", example = "123456")
private Integer towerid;
@ -50,7 +53,7 @@ public class LineTreeListModel implements Serializable {
private String equipName;
@ApiModelProperty(value = "显示名", example = "名称名称")
private String displayName;
private String name;
@ApiModelProperty(value = "装置型号", example = "型号型号")
private String model;

@ -17,11 +17,14 @@ import java.util.List;
public class TerminalListModel implements Serializable {
@ApiModelProperty(value = "设备列表", example = "[]")
private List<TerminalBean> terminalBeanList;
private List<TerminalBean> list;
@Data
public static class TerminalBean {
@ApiModelProperty(value = "设备编号", example = "123456")
private Integer id;
@ApiModelProperty(value = "线路编号", example = "123456")
private Integer lineid;

@ -9,10 +9,10 @@ import java.util.Date;
import java.util.List;
/**
*
*
*/
@Data
@ApiModel(value = "通道列表", description = "通道列表信息")
@ApiModel(value = "图片列表对象", description = "图片列表对象信息")
public class TerminalPhotoListModel implements Serializable {
@ApiModelProperty(value = "总记录数", example = "120")
@ -24,13 +24,13 @@ public class TerminalPhotoListModel implements Serializable {
@ApiModelProperty(value = "每页记录数", example = "1")
private int pagesize;
@ApiModelProperty(value = "通道列表对象", example = "[]")
private List<ChannelBean> list;
@ApiModelProperty(value = "照片对象", example = "[]")
private List<PhotoBean> list;
@Data
public static class ChannelBean {
public static class PhotoBean {
@ApiModelProperty(value = "通道id", example = "12321")
@ApiModelProperty(value = "图片id", example = "12321")
private Long id;
@ApiModelProperty(value = "装置编号", example = "123456")
@ -61,7 +61,7 @@ public class TerminalPhotoListModel implements Serializable {
private String path;
@ApiModelProperty(value = "拍照方式", example = "123456")
private Byte manualRequest;
private Integer manualRequest;
}
}

@ -0,0 +1,44 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.sql.Time;
import java.util.Date;
import java.util.List;
/**
*
*/
@Data
@ApiModel(value = "时间任务列表", description = "获取时间任务列表信息")
public class TerminalScheduleRuleListModel implements Serializable {
@ApiModelProperty(value = "时间任务列表", example = "[]")
private List<ScheduleRuleBean> list;
@Data
public static class ScheduleRuleBean {
@ApiModelProperty(value = "任务编号", example = "123456")
private Integer id;
@ApiModelProperty(value = "任务名称", example = "123456")
private String name;
@ApiModelProperty(value = "间隔", example = "213")
private Integer span;
@ApiModelProperty(value = "开始时间", example = "2022-06-08")
private Time startTime;
@ApiModelProperty(value = "结束时间", example = "2022-06-08")
private Time endTime;
@ApiModelProperty(value = "备注", example = "erwsafsasa")
private String remark;
}
}

@ -0,0 +1,36 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.sql.Time;
import java.util.List;
/**
*
*/
@Data
@ApiModel(value = "时间任务", description = "获取时间任务信息")
public class TerminalScheduleRuleModel implements Serializable {
@ApiModelProperty(value = "任务编号", example = "123456")
private Integer id;
@ApiModelProperty(value = "任务名称", example = "123456")
private String name;
@ApiModelProperty(value = "间隔", example = "213")
private Integer span;
@ApiModelProperty(value = "开始时间", example = "2022-06-08")
private String startTime;
@ApiModelProperty(value = "结束时间", example = "2022-06-08")
private String endTime;
@ApiModelProperty(value = "备注", example = "erwsafsasa")
private String remark;
}

@ -0,0 +1,157 @@
package com.shxy.xymanager_common.util;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*
* @author
*/
public class MyDateUtils extends DateUtil {
public static String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
public static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy年MM月dd日",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "HH时mm分", "HH:mm","HH:mm:ss",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM","yyyyMMdd"};
/**
* Date
*
* @return Date()
*/
public static Date getNowDate() {
return new Date();
}
/**
* , yyyy-MM-dd
*
* @return String
*/
public static String getDate() {
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime() {
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static final String dateTimeNow() {
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static final String dateTimeNow(final String format) {
return parseDateToStr(format, new Date());
}
public static final String dateTime(final Date date) {
return parseDateToStr(YYYY_MM_DD, date);
}
public static final String parseDateToStr(final String format, final Date date) {
return new SimpleDateFormat(format).format(date);
}
public static final Date dateTime(final String format, final String ts) {
try {
return new SimpleDateFormat(format).parse(ts);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
* // 2018/08/08
*/
public static final String datePath() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
/**
* // 20180808
*/
public static final String dateTime() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
/**
*
*/
public static Date myparseDate(Object str) {
if (str == null) {
return null;
}
return parse(str.toString(), parsePatterns);
}
/**
* HH:mm
*/
public static String parseHourAndMin(Date str) {
if (str == null) {
return null;
}
return format(str, "HH:mm");
}
/**
* "MM/dd"
*/
public static String parseMonthAndDay(Date str) {
if (str == null) {
return null;
}
return format(str, "MM/dd");
}
/**
*
*/
public static Date getServerStartDate() {
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
/**
* "yyyy-MM-dd HH:mm"
*/
public static String formatYmdHmTime(Date date) {
return null == date ? null : DatePattern.NORM_DATETIME_MINUTE_FORMAT.format(date);
}
/**
*
*/
public static String getDatePoor(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟";
}
}

@ -12,11 +12,5 @@ import java.util.List;
public class TerminalIdListVo {
@NotEmpty(message = "不能传入空值")
@ApiModelProperty(value = "装置对象数组", required = true, example = "A0001")
private List<Item> list;
@Data
private static class Item {
@ApiModelProperty(value = "装置编号", example = "123455")
private Integer id;
}
private List<TerminalIdVo> list;
}

@ -14,5 +14,5 @@ public class TerminalIdVo {
@NotNull(message = "装置编号不能缺少")
@ApiModelProperty(value = "装置编号", example = "123455")
private Integer cmdid;
private Integer termid;
}

@ -0,0 +1,17 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel(value = "任务规则编号列表", description = "任务规则编号列表描述")
public class TerminalRuleIdListVo {
@NotEmpty(message = "不能传入空值")
@ApiModelProperty(value = "任务规则对象数组", required = true, example = "A0001")
private List<TerminalRuleIdVo> list;
}

@ -0,0 +1,16 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "任务规则编号对象", description = "任务规则编号对象描述")
public class TerminalRuleIdVo {
@NotNull(message = "规则编号不能缺少")
@ApiModelProperty(value = "规则编号", example = "123455")
private Integer id;
}

@ -0,0 +1,18 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Data
@ApiModel(value = "任务规则对象列表", description = "任务规则对象列表描述")
public class TerminalRuleListVo {
@NotEmpty(message = "不能传入空值")
@ApiModelProperty(value = "任务规则对象数组", required = true, example = "A0001")
private List<TerminalRuleVo> list;
}

@ -0,0 +1,38 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Data
@ApiModel(value = "任务规则对象", description = "任务规则对象描述")
public class TerminalRuleVo {
@ApiModelProperty(value = "任务规则编号", example = "名称名称")
@NotBlank(message = "任务编号不能缺少")
private Integer id;
@ApiModelProperty(value = "任务规则名称", example = "名称名称")
@NotBlank(message = "任务规则名称不能缺少")
private String name;
@ApiModelProperty(value = "开始时间", example = "单位")
@NotBlank(message = "开始时间不能缺少")
private String startTime;
@ApiModelProperty(value = "结束时间", example = "型号型号")
@NotBlank(message = "结束时间不能缺少")
private String endTime;
@ApiModelProperty(value = "时间间隔", example = "型号型号")
@NotBlank(message = "时间间隔不能缺少")
private Integer span;
@ApiModelProperty(value = "备注", example = "型号型号")
@NotBlank(message = "时间间隔不能缺少")
private String remark;
}

@ -1,17 +1,24 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.TerminalScheduleRule;
import org.apache.ibatis.annotations.Param;
public interface TerminalScheduleRuleDao {
int deleteByPrimaryKey(Integer id);
import java.util.Date;
import java.util.List;
int insert(TerminalScheduleRule record);
public interface TerminalScheduleRuleDao {
int insertSelective(TerminalScheduleRule record);
int insertList(@Param("list") List<TerminalScheduleRule> record, @Param("status") Integer status, @Param("createat") Date create, @Param("updateat") Date update);
TerminalScheduleRule selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(TerminalScheduleRule record);
List<TerminalScheduleRule> selectAll(@Param("status") Integer status);
int deleteById(@Param("list") List<TerminalScheduleRule> record, @Param("status") Integer status,@Param("updateat") Date update);
int updateByPrimaryKeySelective(@Param("data") TerminalScheduleRule record,@Param("updateat") Date update);
int updateByPrimaryKey(TerminalScheduleRule record);
}

@ -17,7 +17,8 @@
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="bs_manufacturer" jdbcType="VARCHAR" property="bsManufacturer"/>
<result column="dy_level" jdbcType="TINYINT" property="dyLevel"/>
<collection property="itemList" javaType="list" ofType="com.shxy.xymanager_common.entity.Terminals">
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.entity.Terminals">
<result column="term_id" jdbcType="INTEGER" property="id"/>
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="equip_name" jdbcType="VARCHAR" property="equipName"/>
@ -41,13 +42,12 @@
from `lines`
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectLineAndTerminalList" resultMap="LineAndTerminalMap">
select x.id as id,
x.name as name,
x.bs_manufacturer as bs_manufacturer,
x.dy_level as dy_level,
y.id as term_id,
y.tower_id as tower_id,
y.cmdid as cmdid,
y.equip_name as equip_name,

@ -6,32 +6,47 @@
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="start_time" jdbcType="TIME" property="startTime"/>
<result column="end_time" jdbcType="TIME" property="endTime"/>
<result column="interval" jdbcType="INTEGER" property="interval"/>
<result column="span" jdbcType="INTEGER" property="span"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id, name, start_time, end_time, interval, remark, create_time, update_time
</sql>
id, name, start_time, end_time, span, remark, status,create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_schedulerule
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from terminal_schedulerule
where id = #{id,jdbcType=INTEGER}
</delete>
<select id="selectAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_schedulerule
where status = #{status}
</select>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleRule">
insert into terminal_schedulerule (id, name, start_time,
end_time, interval, remark,
end_time, span, remark,
create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME},
#{endTime,jdbcType=TIME}, #{interval,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
#{endTime,jdbcType=TIME}, #{span,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertList" parameterType="java.util.List">
insert into terminal_schedulerule
(name,start_time,end_time,span,remark,status,create_time,update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.name},#{item.startTime},#{item.endTime},#{item.span},#{item.remark},#{status},#{createat},#{updateat})
</foreach>
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleRule">
insert into terminal_schedulerule
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -47,8 +62,8 @@
<if test="endTime != null">
end_time,
</if>
<if test="interval != null">
interval,
<if test="span != null">
span,
</if>
<if test="remark != null">
remark,
@ -73,8 +88,8 @@
<if test="endTime != null">
#{endTime,jdbcType=TIME},
</if>
<if test="interval != null">
#{interval,jdbcType=INTEGER},
<if test="span != null">
#{span,jdbcType=INTEGER},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
@ -87,39 +102,47 @@
</if>
</trim>
</insert>
<update id="deleteById">
update terminal_schedulerule
set status = #{status},
update_time = #{updateat}
where id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.id}
</foreach>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleRule">
update terminal_schedulerule
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIME},
<if test="data.name != null">
name = #{data.name,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIME},
<if test="data.startTime != null">
start_time = #{data.startTime,jdbcType=TIME},
</if>
<if test="interval != null">
interval = #{interval,jdbcType=INTEGER},
<if test="data.endTime != null">
end_time = #{data.endTime,jdbcType=TIME},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
<if test="data.span != null">
span = #{data.span,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
<if test="data.remark != null">
remark = #{data.remark,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
<if test="updateat != null">
update_time = #{updateat,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
where id = #{data.id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleRule">
update terminal_schedulerule
set name = #{name,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIME},
end_time = #{endTime,jdbcType=TIME},
interval = #{interval,jdbcType=INTEGER},
span = #{span,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}

@ -154,6 +154,16 @@
</foreach>
</insert>
<update id="deleteById">
update terminals
set status = #{status},
update_time = #{updateat}
where id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.id}
</foreach>
</update>
<update id="updateByPrimaryKeySelective">
update terminals
<set>

@ -47,10 +47,15 @@ public class LineServiceImpl implements LineService {
List<LineAndTerminalDto> list = linesDao.selectLineAndTerminalList(CommonStatus.EFFECTIVE.value());
boolean empty = CollectionUtil.isEmpty(list);
if (empty) {
model.setLinelist(new ArrayList<>());
model.setList(new ArrayList<>());
} else {
List<LineTreeListModel.LineBean> lineBeans = BeanUtil.copyToList(list, LineTreeListModel.LineBean.class, CopyOptions.create().ignoreCase());
model.setLinelist(lineBeans);
for (int i = 0; i < lineBeans.size(); i++) {
for (int j = 0; j < lineBeans.get(i).getList().size(); j++) {
lineBeans.get(i).getList().get(j).setName(list.get(i).getList().get(j).getDisplayName());
}
}
model.setList(lineBeans);
}
return Asserts.success(model);
}
@ -66,10 +71,10 @@ public class LineServiceImpl implements LineService {
List<Lines> terminals = linesDao.selectAll(CommonStatus.EFFECTIVE.value());
boolean empty = CollectionUtil.isEmpty(terminals);
if (empty) {
model.setTerminalBeanList(new ArrayList<>());
model.setList(new ArrayList<>());
} else {
List<LineListModel.LineBean> list = BeanUtil.copyToList(terminals, LineListModel.LineBean.class, CopyOptions.create().ignoreCase());
model.setTerminalBeanList(list);
model.setList(list);
}
return Asserts.success(model);
}
@ -84,7 +89,7 @@ public class LineServiceImpl implements LineService {
public ServiceBody<String> addLine(LineVo vo) {
List<Lines> lines = BeanUtil.copyToList(vo.getList(), Lines.class);
Date date = new Date();
int i = linesDao.insertList(lines,CommonStatus.EFFECTIVE.value(), date,date);
int i = linesDao.insertList(lines, CommonStatus.EFFECTIVE.value(), date, date);
if (i != 0) {
return Asserts.success("录入成功");
} else {
@ -102,7 +107,7 @@ public class LineServiceImpl implements LineService {
public ServiceBody<String> deleteLine(LineIdVo vo) {
List<Lines> lines = BeanUtil.copyToList(vo.getList(), Lines.class);
Date date = new Date();
int i = linesDao.deleteById(lines,CommonStatus.DELETE.value(), date);
int i = linesDao.deleteById(lines, CommonStatus.DELETE.value(), date);
if (i != 0) {
return Asserts.success("删除成功");
} else {
@ -119,8 +124,8 @@ public class LineServiceImpl implements LineService {
*/
@Override
public ServiceBody<String> updateLine(UpdateLineVo vo) {
Lines lines = BeanUtil.copyProperties(vo, Lines.class);
int i = linesDao.updateByPrimaryKeySelective(lines,new Date());
Lines lines = BeanUtil.copyProperties(vo, Lines.class);
int i = linesDao.updateByPrimaryKeySelective(lines, new Date());
if (i != 0) {
return Asserts.success("修改成功");
} else {

@ -35,7 +35,7 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
@Override
public ServiceBody<TerminalChannelListModel> getChannelList(TerminalIdVo vo) {
TerminalChannelListModel model = new TerminalChannelListModel();
List<TerminalChannels> list = terminalChannelsDao.selectByTermid(vo.getCmdid());
List<TerminalChannels> list = terminalChannelsDao.selectByTermid(vo.getTermid());
boolean empty = CollectionUtil.isEmpty(list);
if (empty) {
model.setList(new ArrayList<>());

@ -3,7 +3,6 @@ package com.shxy.xymanager_service.impl;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.TerminalListModel;
import com.shxy.xymanager_common.vo.TerminalVo;
import com.shxy.xymanager_service.service.TerminalChannelService;
import com.shxy.xymanager_service.service.TerminalParamsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@ -46,7 +46,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
if (empty) {
model.setList(new ArrayList<>());
} else {
List<TerminalPhotoListModel.ChannelBean> beans = BeanUtil.copyToList(list, TerminalPhotoListModel.ChannelBean.class, CopyOptions.create().ignoreCase());
List<TerminalPhotoListModel.PhotoBean> beans = BeanUtil.copyToList(list, TerminalPhotoListModel.PhotoBean.class, CopyOptions.create().ignoreCase());
model.setList(beans);
}
PageInfo pageData = PageUtils.getPageData(list);

@ -1,13 +1,26 @@
package com.shxy.xymanager_service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.TerminalListModel;
import com.shxy.xymanager_common.vo.TerminalVo;
import com.shxy.xymanager_common.entity.TerminalScheduleRule;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.TerminalScheduleRuleListModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleModel;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.TerminalScheduleRuleDao;
import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
import com.shxy.xymanager_service.service.TerminalScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
*
*/
@ -15,17 +28,119 @@ import org.springframework.stereotype.Service;
@Slf4j
public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleService {
@Autowired
TerminalScheduleRuleDao terminalScheduleRuleDao;
/**
*
*
*
* @return
*/
@Override
public ServiceBody<TerminalListModel> getScheduleRuleList() {
return null;
public ServiceBody<TerminalScheduleRuleListModel> getScheduleRuleList() {
TerminalScheduleRuleListModel model = new TerminalScheduleRuleListModel();
List<TerminalScheduleRule> list = terminalScheduleRuleDao.selectAll(CommonStatus.EFFECTIVE.value());
boolean empty = CollectionUtil.isEmpty(list);
if (empty) {
model.setList(new ArrayList<>());
} else {
List<TerminalScheduleRuleListModel.ScheduleRuleBean> beans = BeanUtil.copyToList(list, TerminalScheduleRuleListModel.ScheduleRuleBean.class, CopyOptions.create().ignoreCase());
model.setList(beans);
}
return Asserts.success(model);
}
/**
*
*
* @param vo
* @return
*/
@Override
public ServiceBody<String> addSchelduleRule(TerminalVo terminalVo) {
return null;
public ServiceBody<TerminalScheduleRuleModel> getSingleScheduleRule(TerminalRuleIdVo vo) {
TerminalScheduleRule item = terminalScheduleRuleDao.selectByPrimaryKey(vo.getId());
if (BeanUtil.isEmpty(item)) {
return Asserts.error("没有该对象");
} else {
TerminalScheduleRuleModel bean = new TerminalScheduleRuleModel();
bean.setId(item.getId());
bean.setName(item.getName());
bean.setStartTime(MyDateUtils.parseHourAndMin(item.getStartTime()));
bean.setEndTime(MyDateUtils.parseHourAndMin(item.getEndTime()));
bean.setSpan(item.getSpan());
bean.setRemark(item.getRemark());
return Asserts.success(bean);
}
}
/**
*
*
* @param vo
* @return
*/
@Override
public ServiceBody<String> addSchedulelRuleList(TerminalRuleListVo vo) {
ArrayList<TerminalScheduleRule> list = new ArrayList<>();
for (TerminalRuleVo item : vo.getList()) {
TerminalScheduleRule bean = new TerminalScheduleRule();
bean.setName(item.getName());
bean.setStartTime(MyDateUtils.myparseDate(item.getStartTime()));
bean.setEndTime(MyDateUtils.myparseDate(item.getEndTime()));
bean.setSpan(item.getSpan());
bean.setRemark(item.getRemark());
bean.setStatus(CommonStatus.EFFECTIVE.value());
list.add(bean);
}
Date date = new Date();
int i = terminalScheduleRuleDao.insertList(list, CommonStatus.EFFECTIVE.value(), date, date);
if (i != 0) {
return Asserts.success("录入成功");
} else {
return Asserts.error("录入失败");
}
}
/**
*
*
* @param vo
* @return
*/
@Override
public ServiceBody<String> updateSchelduleRule(TerminalRuleVo vo) {
TerminalScheduleRule bean = new TerminalScheduleRule();
bean.setId(vo.getId());
bean.setName(vo.getName());
bean.setStartTime(MyDateUtils.myparseDate(vo.getStartTime()));
bean.setEndTime(MyDateUtils.myparseDate(vo.getEndTime()));
bean.setSpan(vo.getSpan());
bean.setRemark(vo.getRemark());
bean.setStatus(CommonStatus.EFFECTIVE.value());
int i = terminalScheduleRuleDao.updateByPrimaryKeySelective(bean, new Date());
if (i != 0) {
return Asserts.success("修改成功");
} else {
return Asserts.error("修改失败");
}
}
/**
*
*
* @param vo
* @return
*/
@Override
public ServiceBody<String> deleteSchelduleRule(TerminalRuleIdListVo vo) {
List<TerminalScheduleRule> list = BeanUtil.copyToList(vo.getList(), TerminalScheduleRule.class);
int i = terminalScheduleRuleDao.deleteById(list, CommonStatus.DELETE.value(), new Date());
if (i != 0) {
return Asserts.success("删除成功");
} else {
return Asserts.error("删除失败");
}
}
}

@ -3,7 +3,6 @@ package com.shxy.xymanager_service.impl;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.TerminalListModel;
import com.shxy.xymanager_common.vo.TerminalVo;
import com.shxy.xymanager_service.service.TerminalChannelService;
import com.shxy.xymanager_service.service.TerminalScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -16,9 +15,8 @@ import org.springframework.stereotype.Service;
@Slf4j
public class TerminalScheduleServiceImpl implements TerminalScheduleService {
@Override
public ServiceBody<TerminalListModel> getTerminalList() {
public ServiceBody<TerminalListModel> getScheduleList() {
return null;
}

@ -41,16 +41,16 @@ public class TerminalServiceImpl implements TerminalService {
*/
@Override
public ServiceBody<TerminalListModel> getTerminalList() {
TerminalListModel terminalListModel = new TerminalListModel();
TerminalListModel model = new TerminalListModel();
List<Terminals> terminals = terminalsDao.selectAll(CommonStatus.EFFECTIVE.value());
boolean empty = CollectionUtil.isEmpty(terminals);
if (empty) {
terminalListModel.setTerminalBeanList(new ArrayList<>());
model.setList(new ArrayList<>());
} else {
List<TerminalListModel.TerminalBean> list = BeanUtil.copyToList(terminals, TerminalListModel.TerminalBean.class, CopyOptions.create().ignoreCase());
terminalListModel.setTerminalBeanList(list);
model.setList(list);
}
return Asserts.success(terminalListModel);
return Asserts.success(model);
}
/**

@ -44,10 +44,10 @@ public class TerminalStatusServiceImpl implements TerminalStatusService {
List<Terminals> terminals = terminalsDao.selectAll(CommonStatus.EFFECTIVE.value());
boolean empty = CollectionUtil.isEmpty(terminals);
if (empty) {
terminalListModel.setTerminalBeanList(new ArrayList<>());
terminalListModel.setList(new ArrayList<>());
} else {
List<TerminalListModel.TerminalBean> list = BeanUtil.copyToList(terminals, TerminalListModel.TerminalBean.class, CopyOptions.create().ignoreCase());
terminalListModel.setTerminalBeanList(list);
terminalListModel.setList(list);
}
return Asserts.success(terminalListModel);
}

@ -1,8 +1,9 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.TerminalListModel;
import com.shxy.xymanager_common.vo.TerminalVo;
import com.shxy.xymanager_common.model.TerminalScheduleRuleListModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleModel;
import com.shxy.xymanager_common.vo.*;
/**
*
@ -15,13 +16,38 @@ public interface TerminalScheduleRuleService {
*
* @return
*/
ServiceBody<TerminalListModel> getScheduleRuleList();
ServiceBody<TerminalScheduleRuleListModel> getScheduleRuleList();
/**
*
*
* @param vo
* @return
*/
ServiceBody<TerminalScheduleRuleModel> getSingleScheduleRule(TerminalRuleIdVo vo);
/**
*
*
* @return
*/
ServiceBody<String> addSchelduleRule(TerminalVo terminalVo);
ServiceBody<String> addSchedulelRuleList(TerminalRuleListVo vo);
/**
*
*
* @param vo
* @return
*/
ServiceBody<String> updateSchelduleRule(TerminalRuleVo vo);
/**
*
*
* @param vo
* @return
*/
ServiceBody<String> deleteSchelduleRule(TerminalRuleIdListVo vo);
}

Loading…
Cancel
Save