装置修改

jni
liuguijing 2 years ago
parent 22c948f0ca
commit ac5ae4ad59

@ -6,6 +6,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -14,64 +15,56 @@ import java.util.List;
public class UpdateTerminalVo { public class UpdateTerminalVo {
@ApiModelProperty(value = "装置编号", example = "123456") @ApiModelProperty(value = "装置编号", example = "123456")
@NotBlank(message = "装置编号不能缺少") @NotNull(message = "装置编号不能缺少")
private Integer id; private Integer id;
@ApiModelProperty(value = "线路编号", example = "123456") @ApiModelProperty(value = "线路编号", example = "123456")
@NotBlank(message = "线路编号不能缺少")
private Integer lineid; private Integer lineid;
@ApiModelProperty(value = "杆塔编号", example = "123456") @ApiModelProperty(value = "杆塔编号", example = "123456")
@NotBlank(message = "杆塔编号不能缺少")
private Integer towerid; private Integer towerid;
@ApiModelProperty(value = "通道编号", example = "123456")
private List<Integer> channelid;
@ApiModelProperty(value = "sim卡号", example = "123456")
private String sim;
@ApiModelProperty(value = "图像监测装置 ID17 位编码)", example = "12345678") @ApiModelProperty(value = "图像监测装置 ID17 位编码)", example = "12345678")
@NotBlank(message = "图像监测装置不能缺少") @NotBlank(message = "图像监测装置不能缺少")
private String cmdid; private String cmdid;
@ApiModelProperty(value = "原始 ID各厂家内部识别号", example = "12345678") @ApiModelProperty(value = "原始 ID各厂家内部识别号", example = "12345678")
@NotBlank(message = "各厂家内部识别号不能缺少")
private Short orgId; private Short orgId;
@ApiModelProperty(value = "装置名称", example = "名称名称") @ApiModelProperty(value = "装置名称", example = "名称名称")
@NotBlank(message = "装置名称不能缺少")
private String equipName; private String equipName;
@ApiModelProperty(value = "显示名", example = "名称名称") @ApiModelProperty(value = "显示名", example = "名称名称")
@NotBlank(message = "显示名不能缺少")
private String displayName; private String displayName;
@ApiModelProperty(value = "装置型号", example = "型号型号") @ApiModelProperty(value = "装置型号", example = "型号型号")
@NotBlank(message = "装置型号不能缺少")
private String model; private String model;
@ApiModelProperty(value = "装置基本信息版本号", example = "型号型号") @ApiModelProperty(value = "装置基本信息版本号", example = "型号型号")
@NotBlank(message = "装置基本信息版本号不能缺少")
private String essentialInfoVersion; private String essentialInfoVersion;
@ApiModelProperty(value = "是否带云台", example = " 0 不带云台 1带云台") @ApiModelProperty(value = "是否带云台", example = " 0 不带云台 1带云台")
@NotBlank(message = "是否带云台不能缺少")
private Byte hasPan; private Byte hasPan;
@ApiModelProperty(value = "生产厂家", example = "生产厂家") @ApiModelProperty(value = "生产厂家", example = "生产厂家")
@NotBlank(message = "生产厂家不能缺少")
private String bsManufacturer; private String bsManufacturer;
@ApiModelProperty(value = "生产日期", example = "2022-06-12") @ApiModelProperty(value = "生产日期", example = "2022-06-12")
@NotBlank(message = "生产日期不能缺少")
private Date bsProductionDate; private Date bsProductionDate;
@ApiModelProperty(value = "出厂编号", example = "123456") @ApiModelProperty(value = "出厂编号", example = "123456")
@NotBlank(message = "出厂编号不能缺少")
private String bsIdentifier; private String bsIdentifier;
@ApiModelProperty(value = "纬度", example = "21321") @ApiModelProperty(value = "纬度", example = "21321")
@NotBlank(message = "纬度不能缺少")
private Double latitude; private Double latitude;
@ApiModelProperty(value = "经度", example = "213") @ApiModelProperty(value = "经度", example = "213")
@NotBlank(message = "经度不能缺少")
private Double longitude; private Double longitude;
} }

@ -8,7 +8,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
public interface TerminalChannelMapperDao { public interface TerminalChannelMapperDao {
int deleteByPrimaryKey(Integer id); int deleteByTermId(Integer id);
int insert(TerminalChannelMapper record); int insert(TerminalChannelMapper record);

@ -24,9 +24,9 @@
from terminal_channel_mapper from terminal_channel_mapper
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByTermId" parameterType="java.lang.Integer">
delete from terminal_channel_mapper delete from terminal_channel_mapper
where id = #{id,jdbcType=INTEGER} where term_id = #{id}
</delete> </delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalChannelMapper"> <insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalChannelMapper">
insert into terminal_channel_mapper (id, term_id, channel_id, insert into terminal_channel_mapper (id, term_id, channel_id,

@ -9,7 +9,6 @@ import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.dto.TerminalInfoDto; import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto; import com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto;
import com.shxy.xymanager_common.entity.TerminalChannelMapper; import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus; import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.exception.Asserts; import com.shxy.xymanager_common.exception.Asserts;
@ -23,17 +22,13 @@ import com.shxy.xymanager_dao.dao.TerminalChannelMapperDao;
import com.shxy.xymanager_dao.dao.TerminalChannelsDao; import com.shxy.xymanager_dao.dao.TerminalChannelsDao;
import com.shxy.xymanager_dao.dao.TerminalStatusDao; import com.shxy.xymanager_dao.dao.TerminalStatusDao;
import com.shxy.xymanager_dao.dao.TerminalsDao; import com.shxy.xymanager_dao.dao.TerminalsDao;
import com.shxy.xymanager_service.interaction.Cma;
import com.shxy.xymanager_service.service.TerminalService; import com.shxy.xymanager_service.service.TerminalService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.StringValue;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.validation.constraints.NotEmpty;
import java.math.BigInteger; import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -60,9 +55,6 @@ public class TerminalServiceImpl implements TerminalService {
@Autowired @Autowired
private TerminalStatusDao terminalStatusDao; private TerminalStatusDao terminalStatusDao;
// @Autowired
// private Cma cma;
/** /**
* *
* *
@ -135,9 +127,24 @@ public class TerminalServiceImpl implements TerminalService {
*/ */
@Override @Override
public ServiceBody<String> updateTerminal(UpdateTerminalVo vo) { public ServiceBody<String> updateTerminal(UpdateTerminalVo vo) {
Integer termid = vo.getId();
List<Integer> channelid = vo.getChannelid();
Terminals terminals = new Terminals(); Terminals terminals = new Terminals();
BeanUtil.copyProperties(vo, terminals, true); BeanUtil.copyProperties(vo, terminals, true);
int i = terminalsDao.updateByPrimaryKeySelective(terminals, new Date()); int i = terminalsDao.updateByPrimaryKeySelective(terminals, new Date());
terminalChannelMapperDao.deleteByTermId(termid);
if (!CollectionUtil.isEmpty(channelid)) {
List<TerminalChannelMapper> list = new ArrayList<>();
for (Integer id : channelid) {
TerminalChannelMapper record = new TerminalChannelMapper();
record.setChannelId(id);
record.setTermId(termid);
list.add(record);
}
Date date = new Date();
terminalChannelMapperDao.insertList(list, date, date);
}
if (i != 0) { if (i != 0) {
return Asserts.success("修改成功"); return Asserts.success("修改成功");
} else { } else {
@ -160,7 +167,6 @@ public class TerminalServiceImpl implements TerminalService {
terminals.setId(item.getTermid()); terminals.setId(item.getTermid());
list.add(terminals); list.add(terminals);
} }
// List<Terminals> list = BeanUtil.copyToList(vo.getList(), Terminals.class);
int i = terminalsDao.deleteById(list, CommonStatus.DELETE.value(), new Date()); int i = terminalsDao.deleteById(list, CommonStatus.DELETE.value(), new Date());
if (i != 0) { if (i != 0) {
return Asserts.success("删除成功"); return Asserts.success("删除成功");

Loading…
Cancel
Save