feat: 新增App增量更新命令

dev
huangfeng 1 month ago
parent b2e1e4717a
commit ada58f7647

@ -49,6 +49,7 @@ public class CmdController extends BaseController {
list.add(new ActionModel(14, "push_file", "推送文件"));
list.add(new ActionModel(15, "upd_cfg", "修改配置文件"));
list.add(new ActionModel(16, "list_files", "列出目录下的文件名"));
list.add(new ActionModel(17, "yw_app_upd_ota", "App增量更新"));
return ResponseReult.success(list);
}

@ -32,7 +32,7 @@ public class TermSetController extends BaseController {
@Autowired
TermSetService termSetService;
@Resource
@Autowired
StoreCameraScheduleTask cameraScheduleTask;
@ApiOperation(value = "声光报警", notes = "声光报警", httpMethod = "POST")

@ -35,4 +35,8 @@ public class CmdModel {
private Integer noSpecData;
private Long mTime;
private String filter;
private String oldurl;
private String otaurl;
private String appurl;
private String key;
}

@ -53,7 +53,7 @@ public class StoreCameraScheduleTask {
}
@Scheduled(initialDelay = 60000, fixedDelay = 60000)
private void store() {
public void store() {
Iterator<Integer> it = Constants.scheduleRequestMap.keySet().iterator();
while (shutdown == 0 && it.hasNext()) {
Integer requestid = it.next();

@ -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不能为空");

Loading…
Cancel
Save