decmain主体类经典保存备份

@RequestMapping(params = "dateComparison")
            @ResponseBody
                public AjaxJson dateComparison(HttpServletRequest request) {
                 
                    AjaxJson j = new AjaxJson();
                    String id = oConvertUtils.getString(request.getParameter("id")); 
                    try {
                        if(StringUtil.isNotEmpty(id)){
                            DecMainEntity decmain = systemService.getEntity(DecMainEntity.class, id);
                            DecMainPage decmainpage = JSONObject.parseObject(decmain.getContent(), DecMainPage.class);
                            List<DecListsEntity> declist = decmainpage.getDecLists();
                            String clientNo = decmainpage.getClientNo();
                            
                            
                            if(StringUtil.isNotEmpty(clientNo)){
                                String id1 = jdbcTemplate.queryForObject("select * from dec_main_log a where a.client_no = ? order by a.create_date desc limit 1",String.class, clientNo);
                                DecMainEntityLog decmainlog = systemService.getEntity(DecMainEntity.class, id1);
                                DecMainPage decmainpage2 = JSONObject.parseObject(decmainlog.getContent(), DecMainPage.class);
                                List<DecListsEntity> declist2 = decmainpage2.getDecLists();
                                List<DecListsEntity> declistsave = new ArrayList<DecListsEntity>();
                                for(DecListsEntity declists  : declist){
                                    for(DecListsEntity declist2s  : declist2){
                                        if(declists.getGno().equals(declist2s.getGno())){
                                            declists.setItem_index(declist2s.getItem_index());
                                            declists.setCustoms_index(declist2s.getCustoms_index());
                                        }
                                    }
                                    declistsave.add(declists);
                                }
                                decmainpage.setDecLists(declistsave);
                                decmain.setContent(GsonUtil.toJson(decmainpage).toString());
                                systemService.saveOrUpdate(decmain);
                            }
                        }
                            
                    } catch (Exception e) {
                          j.setSuccess(false);
                    }
                    
                     return j;
                }

 

posted @ 2020-04-22 17:39  薛柏梁  阅读(176)  评论(0编辑  收藏  举报