权限修改

dev
liuguijing 1 year ago
parent fbcca5d58d
commit 80b8374a1b

@ -99,6 +99,8 @@ public class View_Dy_Line_Tower_Terminals implements Serializable {
@ApiModelProperty(value = "在线状态", example = "0--掉线1--在线")
private Integer onlinestatus;
private Integer termcount;
public Integer getOnlinestatus() {
if (lastHeartbeat == null) {
return CommonStatus.DELETE.value();

@ -47,6 +47,9 @@ public class TowerListModel implements Serializable {
@ApiModelProperty(value = "杆塔排序", example = "123456")
private Integer order;
@ApiModelProperty(value = "装置数量", example = "123456")
private Integer termcount;
}

@ -199,27 +199,27 @@ public class TerminalUtils {
photosBean.setPresetId(terminalPhoto.getPresetId());
}
ArrayList<TerminalPhotoListModel.AlarmItemBean> photoalarmlist = new ArrayList<>();
ArrayList<TerminalPhotoListModel.AlarmItemBean> photoalarmlist = new ArrayList<>();
if (imgarlarmsList != null && imgarlarmsList.size() > 0) {
Integer termId1 = terminalPhoto.getTermId();
BigInteger orginalid = terminalPhoto.getOrginalId();
for (TerminalImgAlarmsDto dto : imgarlarmsList) {
BigInteger photoOrgId = dto.getPhotoOrgId();
Integer termId = dto.getTermId();
if (photoOrgId!= null && orginalid!=null && termId1!=null && termId!=null){
if(photoOrgId.intValue() == orginalid.intValue() && termId1.intValue() == termId.intValue()) {
TerminalPhotoListModel.AlarmItemBean alarmItemBean = new TerminalPhotoListModel.AlarmItemBean();
alarmItemBean.setEnname(dto.getEnname());
alarmItemBean.setName(dto.getName());
alarmItemBean.setHeight(dto.getHeight());
alarmItemBean.setWidth(dto.getWidth());
alarmItemBean.setProb(dto.getProb());
alarmItemBean.setX(dto.getX());
alarmItemBean.setY(dto.getY());
alarmItemBean.setPhotoWidth(terminalPhoto.getWidth());
alarmItemBean.setPhotoHeight(terminalPhoto.getHeight());
photoalarmlist.add(alarmItemBean);
}
if (photoOrgId != null && orginalid != null && termId1 != null && termId != null) {
if (photoOrgId.intValue() == orginalid.intValue() && termId1.intValue() == termId.intValue()) {
TerminalPhotoListModel.AlarmItemBean alarmItemBean = new TerminalPhotoListModel.AlarmItemBean();
alarmItemBean.setEnname(dto.getEnname());
alarmItemBean.setName(dto.getName());
alarmItemBean.setHeight(dto.getHeight());
alarmItemBean.setWidth(dto.getWidth());
alarmItemBean.setProb(dto.getProb());
alarmItemBean.setX(dto.getX());
alarmItemBean.setY(dto.getY());
alarmItemBean.setPhotoWidth(terminalPhoto.getWidth());
alarmItemBean.setPhotoHeight(terminalPhoto.getHeight());
photoalarmlist.add(alarmItemBean);
}
}
}
if (photoalarmlist == null || photoalarmlist.size() == 0) {
@ -338,8 +338,8 @@ public class TerminalUtils {
for (TerminalImgAlarmsDto dto : imgarlarmsList) {
BigInteger photoOrgId = dto.getPhotoOrgId();
Integer termId = dto.getTermId();
if (photoOrgId!= null && orginalid!=null && termId1!=null && termId!=null){
if(photoOrgId.intValue() == orginalid.intValue() && termId1.intValue() == termId.intValue()) {
if (photoOrgId != null && orginalid != null && termId1 != null && termId != null) {
if (photoOrgId.intValue() == orginalid.intValue() && termId1.intValue() == termId.intValue()) {
TerminalPhotoListModel.AlarmItemBean alarmItemBean = new TerminalPhotoListModel.AlarmItemBean();
alarmItemBean.setEnname(dto.getEnname());
alarmItemBean.setName(dto.getName());
@ -390,12 +390,14 @@ public class TerminalUtils {
Integer towerid = terminals.getTowerId();
if (towerMap != null) {
TowerDto towerDto = towerMap.get(towerid);
Integer lineId = towerDto.getLineId();
photoBean.setLineid(lineId);
if (lineMap != null) {
Lines lineAndDyNameDto = lineMap.get(lineId);
if (lineAndDyNameDto != null) {
photoBean.setLinename(lineAndDyNameDto.getName());
if (towerDto != null) {
Integer lineId = towerDto.getLineId();
photoBean.setLineid(lineId);
if (lineMap != null) {
Lines lineAndDyNameDto = lineMap.get(lineId);
if (lineAndDyNameDto != null) {
photoBean.setLinename(lineAndDyNameDto.getName());
}
}
}
}
@ -432,14 +434,14 @@ public class TerminalUtils {
}
ArrayList<TerminalPhotoListModel.AlarmItemBean> photoalarmlist = new ArrayList<>();
ArrayList<TerminalPhotoListModel.AlarmItemBean> photoalarmlist = new ArrayList<>();
if (imgarlarmsList != null && imgarlarmsList.size() > 0) {
Integer termId1 = item.getTermId();
BigInteger orginalid = item.getOrginalId();
for (TerminalImgAlarmsDto dto : imgarlarmsList) {
BigInteger photoOrgId = dto.getPhotoOrgId();
Integer termId = dto.getTermId();
if (photoOrgId!= null && orginalid!=null && termId1!=null && termId!=null) {
if (photoOrgId != null && orginalid != null && termId1 != null && termId != null) {
if (photoOrgId.intValue() == orginalid.intValue() && termId1.intValue() == termId.intValue()) {
TerminalPhotoListModel.AlarmItemBean alarmItemBean = new TerminalPhotoListModel.AlarmItemBean();
alarmItemBean.setEnname(dto.getEnname());

@ -33,6 +33,7 @@
<result column="phase" jdbcType="VARCHAR" property="phase" />
<result column="equipment_type" jdbcType="VARCHAR" property="equipmentType" />
<result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat" />
<result column="termcount" jdbcType="INTEGER" property="termcount" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -125,7 +126,7 @@
id, dy_id, dy_name, line_id, line_name, line_bs_manufacturer, tower_id, tower_name,
address, `order`, cmdid, org_id, equip_name, display_name, model, essential_info_version,
has_pan, bs_manufacturer, bs_production_date, bs_identifier, latitude, longitude,
status, protocol, sim, working_date, net_type, dev_type, phase, equipment_type, last_heartbeat
status, protocol, sim, working_date, net_type, dev_type, phase, equipment_type, last_heartbeat,count(id) as termcount
</sql>
<select id="selectByExample" parameterType="com.shxy.xymanager_common.entity.View_Dy_Line_Tower_TerminalsExample" resultMap="BaseResultMap">
select

@ -40,10 +40,10 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<!-- <exclusion>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!-- </exclusion>-->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- SpringBoot 拦截器 -->

@ -226,54 +226,62 @@ public class LineServiceImpl implements LineService {
//查询所有
if (type == 1) {
DyLevelExample example = new DyLevelExample();
DyLevelExample.Criteria criteria = example.createCriteria();
if (CommonStatus.DELETE.value().equals(aSuper)) {
if (CollectionUtil.isNotEmpty(dypList)) {
example.createCriteria().andIdIn(dypList);
criteria.andIdIn(dypList);
} else {
return Asserts.success(model);
}
}
criteria.andStatusEqualTo(CommonStatus.EFFECTIVE.value());
List<DyLevel> list = dyLevelDao.selectByExample(example);
beans = BeanUtil.copyToList(list, LineAndGtAndChannelListModel.Bean.class);
} else if (type == 2) {
if (id != null) {
LinesExample example = new LinesExample();
LinesExample.Criteria criteria = example.createCriteria();
if (CommonStatus.DELETE.value().equals(aSuper)) {
if (CollectionUtil.isNotEmpty(linepList)) {
example.createCriteria().andIdIn(linepList);
criteria.andIdIn(linepList);
} else {
return Asserts.success(model);
}
}
example.createCriteria().andDyLevelIdEqualTo(id);
criteria.andDyLevelIdEqualTo(id);
criteria.andStatusEqualTo(CommonStatus.EFFECTIVE.value());
List<Lines> list = linesDao.selectByExample(example);
beans = BeanUtil.copyToList(list, LineAndGtAndChannelListModel.Bean.class);
}
} else if (type == 3) {
if (id != null) {
TowersExample example = new TowersExample();
TowersExample.Criteria criteria = example.createCriteria();
if (CommonStatus.DELETE.value().equals(aSuper)) {
if (CollectionUtil.isNotEmpty(towerpList)) {
example.createCriteria().andIdIn(towerpList);
criteria.andIdIn(towerpList);
} else {
return Asserts.success(model);
}
}
example.createCriteria().andLineIdEqualTo(id);
criteria.andLineIdEqualTo(id);
criteria.andStatusEqualTo(CommonStatus.EFFECTIVE.value());
List<Towers> list = towerDao.selectByExample(example);
beans = BeanUtil.copyToList(list, LineAndGtAndChannelListModel.Bean.class);
}
} else if (type == 4) {
if (id != null) {
TerminalsExample example = new TerminalsExample();
TerminalsExample.Criteria criteria = example.createCriteria();
if (CommonStatus.DELETE.value().equals(aSuper)) {
if (CollectionUtil.isNotEmpty(termpList)) {
example.createCriteria().andIdIn(termpList);
criteria.andIdIn(termpList);
} else {
return Asserts.success(model);
}
}
example.createCriteria().andTowerIdEqualTo(id);
criteria.andTowerIdEqualTo(id);
criteria.andStatusEqualTo(CommonStatus.EFFECTIVE.value());
List<Terminals> list = terminalsDao.selectByExample(example);
for (Terminals item : list) {
LineAndGtAndChannelListModel.Bean bean = new LineAndGtAndChannelListModel.Bean();
@ -290,7 +298,8 @@ public class LineServiceImpl implements LineService {
} else if (type == 5) {
if (id != null) {
TerminalChannelMapperExample example = new TerminalChannelMapperExample();
example.createCriteria().andTermIdEqualTo(id);
TerminalChannelMapperExample.Criteria criteria = example.createCriteria();
criteria.andTermIdEqualTo(id);
List<TerminalChannelMapper> list = terminalChannelMapperDao.selectByExample(example);
for (TerminalChannelMapper item : list) {
LineAndGtAndChannelListModel.Bean bean = new LineAndGtAndChannelListModel.Bean();

@ -94,9 +94,6 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
Integer towerid = vo.getTowerId();
Integer label = vo.getLabel();
String search = vo.getSearch();
if (StrUtil.isEmpty(search)) {
search = null;
}
List<TerminalImgAlarmParams> labellist = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> alarmParamMap = cacheService.getAlarmParamMap();
if (label == null || label == -1) {
@ -140,27 +137,28 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
if (CollectionUtil.isNotEmpty(termpList)) {
criteria.andIdIn(termpList);
}
if (StrUtil.isEmpty(search)) {
search = null;
} else {
search = "%" + search + "%";
}
View_Dy_Line_Tower_TerminalsExample.Criteria or = example.or();
or.andLineNameLike(search);
or.andTowerNameLike(search);
or.andCmdidLike(search);
if (StrUtil.isNotBlank(search)) {
View_Dy_Line_Tower_TerminalsExample.Criteria or = example.or();
or.andLineNameLike(search);
or.andTowerNameLike(search);
or.andCmdidLike(search);
}
if (dyid != null && dyid.intValue() == -1) {
View_Dy_Line_Tower_TerminalsExample.Criteria or1 = example.or();
or1.andDyIdEqualTo(dyid);
}
if (lineid == null || lineid.intValue() == -1) {
if (lineid != null || lineid.intValue() != -1) {
View_Dy_Line_Tower_TerminalsExample.Criteria or2 = example.or();
or2.andLineIdEqualTo(dyid);
or2.andLineIdEqualTo(lineid);
}
if (towerid == null || towerid.intValue() == -1) {
if (towerid != null || towerid.intValue() != -1) {
View_Dy_Line_Tower_TerminalsExample.Criteria or3 = example.or();
or3.andTowerIdEqualTo(dyid);
or3.andTowerIdEqualTo(towerid);
}
List<View_Dy_Line_Tower_Terminals> dtos = view_dy_line_tower_terminalsDao.selectByPermission(example);
if (CollectionUtil.isEmpty(dtos)) {

@ -88,6 +88,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
//服务器中的位置
private static final String C_PATH = "/home/xymp/photos/";
/**
* idid
*
@ -121,9 +122,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
criteria.andPhotoTimeBetween(BigInteger.valueOf(start).longValue(), BigInteger.valueOf(end).longValue());
list = terminalPhotoDao.selectByExample(example);
List idlist = new ArrayList<>();
for (TerminalPhoto tp:list) {
if (tp.getOrginalId()!=null) {
List idlist = new ArrayList<>();
for (TerminalPhoto tp : list) {
if (tp.getOrginalId() != null) {
idlist.add(tp.getOrginalId());
}
}
@ -134,7 +135,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
alarmParamMap.forEach((key, value) -> {
labellist.add(value);
});
imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(list, labellist);
imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(list, labellist);
}
boolean empty = CollectionUtil.isEmpty(list);
@ -240,9 +241,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
int pageindex = vo.getPageindex();
int pagesize = vo.getPagesize();
String search = vo.getSearch();
if (StrUtil.isEmpty(search)) {
search = null;
}
Date starttime = vo.getStarttime();
Date endtime = vo.getEndtime();
long start = MyDateUtils.TimeMillSecond2Second(DateTime.of(starttime));
@ -254,78 +252,73 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
ArrayList<Integer> channelidlist = new ArrayList<>();
List<DyAndLineAndTowerAndTermDto> dtos = new ArrayList<>();
if (dyid == null || dyid.intValue() == -1) {
if (StrUtil.isEmpty(search)) {
PageUtils.SetPage(pageindex, pagesize);
// TerminalPhotoExample example = new TerminalPhotoExample();
// example.createCriteria().andTermIdIn(termidlist).andChannelIdIn(channelidlist).andPhotoTimeBetween(start,end);
// terminalPhotoDao.selectByExample(example);
list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
} else {
// View_Dy_Line_Tower_TerminalsExample example = new View_Dy_Line_Tower_TerminalsExample();
// View_Dy_Line_Tower_TerminalsExample.Criteria criteria = example.createCriteria();
// criteria.andDyNameLike(search);
// view_dy_line_tower_terminalsDao.selectByExample(example);
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(null, null, null, null, search, CommonStatus.EFFECTIVE.value());
if (CollectionUtil.isEmpty(dtos)) {
list = new ArrayList<>();
} else {
for (DyAndLineAndTowerAndTermDto item1 : dtos) {
for (LineAndTowerAndTermDto item2 : item1.getList()) {
for (TowerAndTermDto item3 : item2.getList()) {
for (Terminals item4 : item3.getList()) {
termidlist.add(item4.getId());
}
}
}
}
PageUtils.SetPage(pageindex, pagesize);
list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
}
}
} else {
if (lineid == null || lineid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, search, CommonStatus.EFFECTIVE.value());
} else {
if (towerid == null || towerid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, null, null, search, CommonStatus.EFFECTIVE.value());
} else {
if (termid == null || termid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, towerid, null, search, CommonStatus.EFFECTIVE.value());
} else {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, towerid, termid, search, CommonStatus.EFFECTIVE.value());
}
}
}
if (CollectionUtil.isEmpty(dtos)) {
list = new ArrayList<>();
} else {
for (DyAndLineAndTowerAndTermDto item1 : dtos) {
for (LineAndTowerAndTermDto item2 : item1.getList()) {
for (TowerAndTermDto item3 : item2.getList()) {
for (Terminals item4 : item3.getList()) {
termidlist.add(item4.getId());
}
}
}
}
if (channelid == null || channelid.intValue() == -1) {
List<Integer> dypList = new ArrayList<>();
List<Integer> linepList = new ArrayList<>();
List<Integer> towerpList = new ArrayList<>();
List<Integer> termpList = new ArrayList<>();
PermissionDetail permissionList = userService.getPermissionList();
if (CommonStatus.DELETE.value().equals(permissionList.getIsSuper())) {
dypList = permissionList.getDypList();
linepList = permissionList.getLinepList();
towerpList = permissionList.getTowerpList();
termpList = permissionList.getTermpList();
}
View_Dy_Line_Tower_TerminalsExample example = new View_Dy_Line_Tower_TerminalsExample();
View_Dy_Line_Tower_TerminalsExample.Criteria criteria = example.createCriteria();
if (CollectionUtil.isNotEmpty(dypList)) {
criteria.andDyIdIn(dypList);
}
if (CollectionUtil.isNotEmpty(linepList)) {
criteria.andLineIdIn(linepList);
}
if (CollectionUtil.isNotEmpty(towerpList)) {
criteria.andTowerIdIn(towerpList);
}
if (CollectionUtil.isNotEmpty(termpList)) {
criteria.andIdIn(termpList);
}
} else {
channelidlist.add(channelid);
}
if (termidlist.size() == 0) {
if (StrUtil.isEmpty(search)) {
search = null;
} else {
search = "%" + search + "%";
}
if (StrUtil.isNotBlank(search)) {
View_Dy_Line_Tower_TerminalsExample.Criteria or = example.or();
or.andLineNameLike(search);
or.andTowerNameLike(search);
or.andCmdidLike(search);
}
if (dyid != null && dyid.intValue() != -1) {
View_Dy_Line_Tower_TerminalsExample.Criteria or1 = example.or();
or1.andDyIdEqualTo(dyid);
}
if (lineid != null && lineid.intValue() != -1) {
View_Dy_Line_Tower_TerminalsExample.Criteria or2 = example.or();
or2.andLineIdEqualTo(lineid);
}
if (towerid != null && towerid.intValue() != -1) {
View_Dy_Line_Tower_TerminalsExample.Criteria or3 = example.or();
or3.andTowerIdEqualTo(towerid);
}
if (termid != null && termid.intValue() != -1) {
View_Dy_Line_Tower_TerminalsExample.Criteria or3 = example.or();
or3.andIdEqualTo(termid);
}
List<View_Dy_Line_Tower_Terminals> lists = view_dy_line_tower_terminalsDao.selectByPermission(example);
} else {
PageUtils.SetPage(pageindex, pagesize);
list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
}
}
for (View_Dy_Line_Tower_Terminals item : lists) {
termidlist.add(item.getId());
}
if (channelid == null || channelid.intValue() == -1) {
} else {
channelidlist.add(channelid);
}
PageUtils.SetPage(pageindex, pagesize);
list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
boolean empty = CollectionUtil.isEmpty(list);
if (empty) {
model.setList(new ArrayList<>());
@ -337,9 +330,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
Map<String, TerminalChannelMapper> termchannelMapMap = cacheService.getTermChannelMapMap();
List<TerminalImgAlarmsDto> imgarlarmsList = new ArrayList<>();
List idlist = new ArrayList<>();
for (TerminalPhoto tp:list) {
if (tp.getOrginalId()!=null) {
List idlist = new ArrayList<>();
for (TerminalPhoto tp : list) {
if (tp.getOrginalId() != null) {
idlist.add(tp.getOrginalId());
}
}
@ -351,7 +344,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
});
imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(list, labellist);
}
beans = TerminalUtils.fdsa(requestIp, list, terminalMap, lineMap, towerMap, termchannelMap, termchannelMapMap,imgarlarmsList);
beans = TerminalUtils.fdsa(requestIp, list, terminalMap, lineMap, towerMap, termchannelMap, termchannelMapMap, imgarlarmsList);
model.setList(beans);
}
}
@ -578,13 +571,13 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
int pageindex = vo.getPageindex();
int pagesize = vo.getPagesize();
PageUtils.SetPage(pageindex, pagesize);
List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(CommonStatus.EFFECTIVE.value(),termpList);
List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(CommonStatus.EFFECTIVE.value(), termpList);
ArrayList<BigInteger> photolist = new ArrayList<>();
List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
if (CollectionUtil.isNotEmpty(list)) {
for (TerminalChannelMapper item : list) {
if (item.getPhotoId() !=null) {
if (item.getPhotoId() != null) {
photolist.add(item.getPhotoId());
}
}
@ -594,15 +587,15 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
Map<Integer, TerminalChannels> termchannelMap = cacheService.getTermChannelMap();
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
List<TerminalPhoto> photoList = new ArrayList<>();
if (photolist.size()>0) {
if (photolist.size() > 0) {
photoList = terminalPhotoDao.selectPhotosByIdList(photolist);
}
List<TerminalImgAlarmsDto> imgarlarmsList = new ArrayList<>();
if (photoList.size()>0) {
if (photoList.size() > 0) {
if (CollectionUtil.isNotEmpty(list)) {
List idlist = new ArrayList<>();
for (TerminalPhoto tp:photoList) {
if (tp.getOrginalId()!=null) {
List idlist = new ArrayList<>();
for (TerminalPhoto tp : photoList) {
if (tp.getOrginalId() != null) {
idlist.add(tp.getOrginalId());
}
}
@ -616,7 +609,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
}
}
beans = TerminalUtils.setPhotoList(requestIp, list, lineMap, termchannelMapMap, terminalMap, termchannelMap, towerMap, photoList,imgarlarmsList);
beans = TerminalUtils.setPhotoList(requestIp, list, lineMap, termchannelMapMap, terminalMap, termchannelMap, towerMap, photoList, imgarlarmsList);
}
model.setList(beans);
PageInfo pageData = PageUtils.getPageData(list);
@ -713,9 +706,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
Map<String, TerminalChannelMapper> termchannelMapMap = cacheService.getTermChannelMapMap();
List idlist = new ArrayList<>();
for (TerminalPhoto tp:list) {
if (tp.getOrginalId()!=null) {
List idlist = new ArrayList<>();
for (TerminalPhoto tp : list) {
if (tp.getOrginalId() != null) {
idlist.add(tp.getOrginalId());
}
}
@ -756,34 +749,34 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
@Override
public ServiceBody<String> uploadPhoto(MultipartFile file, Integer termid, String cmdid, Integer channel, BigInteger phototime) throws IOException{
public ServiceBody<String> uploadPhoto(MultipartFile file, Integer termid, String cmdid, Integer channel, BigInteger phototime) throws IOException {
DateTime date = MyDateUtils.date(phototime.longValue());
int year = date.year();
String mon = "";
int month = date.monthBaseOne();
if (month<10) {
if (month < 10) {
mon = "0" + month;
}
String daystr = "";
int day = date.dayOfMonth();
if (day<10) {
if (day < 10) {
daystr = "0" + day;
}
String sub = StrUtil.sub(cmdid, cmdid.length() - 2, cmdid.length());
String location = C_PATH+year+"/"+ mon+"/"+daystr+"/"+sub;
String location = C_PATH + year + "/" + mon + "/" + daystr + "/" + sub;
File saveFile = new File(location);
if (!saveFile.exists()) {
boolean mkdirs = saveFile.mkdirs();
System.out.println("日期文件夹" + (mkdirs ? "创建成功" : "创建失败"));
}
File file1 = new File(saveFile.getAbsoluteFile()+"/"+file.getOriginalFilename());
File file1 = new File(saveFile.getAbsoluteFile() + "/" + file.getOriginalFilename());
file.transferTo(file1);
TerminalPhoto record = new TerminalPhoto();
record.setTermId(termid);
record.setPhotoTime((BigInteger.valueOf(MyDateUtils.TimeMillSecond2Second(date))));
record.setChannelId(channel);
record.setOrginalId(BigInteger.valueOf(RandomUtil.randomLong()));
record.setPath(year+"/"+ mon+"/"+daystr+"/"+sub+"/" + file.getOriginalFilename());
record.setPath(year + "/" + mon + "/" + daystr + "/" + sub + "/" + file.getOriginalFilename());
record.setRecvTime(BigInteger.valueOf(MyDateUtils.TimeMillSecond2Second(date)));
record.setCreateTime(new Date());
record.setChannelId(channel);
@ -798,6 +791,4 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
}

@ -104,6 +104,7 @@ public class TowerServiceImpl implements TowerService {
towerBean.setLineName(item.getLineName());
towerBean.setName(item.getTowerName());
towerBean.setOrder(item.getOrder());
towerBean.setTermcount(item.getTermcount());
list1.add(towerBean);
}
model.setList(list1);

Loading…
Cancel
Save