|
|
|
@ -246,6 +246,9 @@ public class CmdServiceImpl implements CmdService {
|
|
|
|
|
case "upgrade":
|
|
|
|
|
this.upgrade(model);
|
|
|
|
|
break;
|
|
|
|
|
case "yw_app_upd_ota":
|
|
|
|
|
this.appUpdOta(model);
|
|
|
|
|
break;
|
|
|
|
|
case "upd_cfg":
|
|
|
|
|
this.updateCfg(model);
|
|
|
|
|
break;
|
|
|
|
@ -664,6 +667,46 @@ public class CmdServiceImpl implements CmdService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void appUpdOta(CmdModel model) {
|
|
|
|
|
if (CollectionUtils.isEmpty(model.getTermIds())) {
|
|
|
|
|
throw new ApiException("termIds不能为空");
|
|
|
|
|
} else if (StringUtils.isBlank(model.getOldurl())) {
|
|
|
|
|
throw new ApiException("oldurl不能为空");
|
|
|
|
|
} else if (StringUtils.isBlank(model.getMd5())) {
|
|
|
|
|
throw new ApiException("md5不能为空");
|
|
|
|
|
} else if (StringUtils.isBlank(model.getOtaurl())) {
|
|
|
|
|
throw new ApiException("otaurl不能为空");
|
|
|
|
|
} else if (StringUtils.isBlank(model.getAppurl())) {
|
|
|
|
|
throw new ApiException("appurl不能为空");
|
|
|
|
|
} else if (StringUtils.isBlank(model.getKey())) {
|
|
|
|
|
throw new ApiException("key不能为空");
|
|
|
|
|
}
|
|
|
|
|
String name = "yw_app_upd_ota";
|
|
|
|
|
|
|
|
|
|
for (Integer termId : model.getTermIds()) {
|
|
|
|
|
MntnCmdsExample example = new MntnCmdsExample();
|
|
|
|
|
MntnCmdsExample.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andTermIdEqualTo(termId);
|
|
|
|
|
criteria.andNameEqualTo(name);
|
|
|
|
|
cmdsMapper.deleteByExample(example);
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("oldurl", model.getOldurl());
|
|
|
|
|
map.put("otaurl", model.getOtaurl());
|
|
|
|
|
map.put("appurl", model.getAppurl());
|
|
|
|
|
map.put("md5", model.getMd5());
|
|
|
|
|
map.put("key", model.getKey());
|
|
|
|
|
String json = JSONUtil.object2Json(map);
|
|
|
|
|
|
|
|
|
|
MntnCmds cmd = new MntnCmds();
|
|
|
|
|
cmd.setTermId(termId);
|
|
|
|
|
cmd.setName(name);
|
|
|
|
|
cmd.setCmd(json);
|
|
|
|
|
cmd.setCreateTime(new Date());
|
|
|
|
|
cmdsMapper.insert(cmd);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dlFile(CmdModel model) {
|
|
|
|
|
if (CollectionUtils.isEmpty(model.getTermIds())) {
|
|
|
|
|
throw new ApiException("termIds不能为空");
|
|
|
|
|