| | |
| | | templateService.updateById(dto); |
| | | templateDetailService.remove(new LambdaQueryWrapper<TTemplateDetail>() |
| | | .eq(TTemplateDetail::getTemplateId, dto.getId())); |
| | | for (TTemplateDetail tTemplateDetail : dto.getList()) { |
| | | tTemplateDetail.setTemplateId(dto.getId()); |
| | | tTemplateDetail.setId(null); |
| | | } |
| | | templateDetailService.saveBatch(dto.getList()); |
| | | |
| | | // 先删除定时任务 |
| | |
| | | .list(); |
| | | BeanUtils.copyProperties(byId,templateDetailVO); |
| | | List<String> collect = tLocationTypeService.list().stream().map(TLocationType::getId).collect(Collectors.toList()); |
| | | |
| | | for (TTemplateDetail tTemplateDetail : list) { |
| | | JSONArray res = new JSONArray(); |
| | | for (String s : collect) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | jsonObject.put("value",""); |
| | | res.add(jsonObject); |
| | | } |
| | | for (TTemplateDetail tTemplateDetail : list) { |
| | | JSONArray temp = new JSONArray(); |
| | | String num4 = tTemplateDetail.getNum4(); |
| | | JSONArray num5Array = JSONArray.parseArray(num4); |
| | | for (Object re : res) { |
| | | JSONObject jsonObject2 = (JSONObject) re; |
| | | int i = 0; |
| | | for (Object o : num5Array) { |
| | | JSONObject jsonObject1 = (JSONObject) o; |
| | | String string = jsonObject1.getString("id"); |
| | | // 如果res中有这个id,则设置num |
| | | for (Object re : res) { |
| | | JSONObject jsonObject2 = (JSONObject) re; |
| | | if (jsonObject2.getString("id").equals(string)) { |
| | | jsonObject2.put("num", jsonObject1.getString("num")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id",string); |
| | | jsonObject.put("value", jsonObject1.getString("value")); |
| | | temp.add(jsonObject); |
| | | break; |
| | | } |
| | | i++; |
| | | if (i==num5Array.size()){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("id",string); |
| | | jsonObject.put("value", ""); |
| | | temp.add(jsonObject); |
| | | } |
| | | } |
| | | |
| | | } |
| | | tTemplateDetail.setNum4(res.toJSONString()); |
| | | |
| | | tTemplateDetail.setNum4(temp.toJSONString()); |
| | | } |
| | | if (byId.getRoleId()!=null){ |
| | | SysRole sysRole = sysRoleService.selectRoleById(byId.getRoleId()); |