| | |
| | | |
| | | import com.yc.action.personalized.entity.CallBackMsg; |
| | | import com.yc.action.personalized.entity.PanelDataEntity; |
| | | import com.yc.action.personalized.entity.TermEntity; |
| | | import com.yc.multiData.SpObserver; |
| | | import com.yc.service.impl.DBHelper; |
| | | import com.yc.service.oapanel.WebMenuAccessIfc; |
| | |
| | | import com.yc.service.personalized.PanelDataIfc; |
| | | import com.yc.service.personalized.PanelGridIfc; |
| | | import com.yc.utils.SessionKey; |
| | | import jodd.jtx.meta.Transaction; |
| | | import org.apache.commons.collections.map.CaseInsensitiveMap; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @RequestMapping(value = "/setDeskTop.do", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CallBackMsg setDeskTopPanel(@RequestBody PanelDataEntity data, HttpServletRequest request) { |
| | | @Transaction |
| | | public CallBackMsg setDeskTopPanel(@RequestBody TermEntity term, HttpServletRequest request) { |
| | | CallBackMsg msg = new CallBackMsg(); |
| | | try { |
| | | SpObserver.setDBtoInstance("_" + request.getSession().getAttribute(SessionKey.DATA_BASE_ID)); |
| | | if (data.getFormId() == 0 || data.getFormType() == 0 || StringUtils.isBlank(data.getUserCode())) { |
| | | msg.setFail("参数不能为空"); |
| | | return msg; |
| | | Map<String, Object> formIdMap=null; |
| | | List<Map<String, String>> list1 = new ArrayList<>(); |
| | | List<Map<String, String>> list2 = new ArrayList<>(); |
| | | for(PanelDataEntity data : term.getTerm()) { |
| | | if (data.getFormId() == 0 || data.getFormType() == 0 || StringUtils.isBlank(term.getUserCode())) { |
| | | msg.setFail("参数不能为空"); |
| | | return msg; |
| | | } |
| | | //是否存在 |
| | | formIdMap = positionIfc.getIsGroup(term.getUserCode(), data.getFormId(), data.getFormType()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if (formIdMap != null && DBHelper.getValueInt(formIdMap, "formid") != 0) { |
| | | //存在是更新状态 |
| | | map.put("checked", data.getIsShow() + ""); |
| | | map.put("fid", data.formId + ""); |
| | | list1.add(map); |
| | | } else { |
| | | //不存在是添加 |
| | | map.put("checked", "1"); |
| | | map.put("fid", data.formId + ""); |
| | | map.put("formtype", data.getFormType() + ""); |
| | | map.put("fname", data.getFormName()); |
| | | list2.add(map); |
| | | } |
| | | } |
| | | //是否存在 |
| | | Map<String, Object> formIdMap = positionIfc.getIsGroup(data.getUserCode(), data.getFormId(), data.getFormType()); |
| | | List<Map<String, String>> list = new ArrayList<>(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if (formIdMap != null && DBHelper.getValueInt(formIdMap, "formid") != 0) { |
| | | //存在是更新状态 |
| | | map.put("checked", data.getIsShow() + ""); |
| | | map.put("fid", data.formId + ""); |
| | | list.add(map); |
| | | positionIfc.updateGroup(list, data.getUserCode()); |
| | | } else { |
| | | //不存在是添加 |
| | | map.put("checked", "1"); |
| | | map.put("fid", data.formId + ""); |
| | | map.put("formtype", data.getFormType() + ""); |
| | | map.put("fname", data.getFormName()); |
| | | list.add(map); |
| | | int chgid = groupIfc.getTop1GroupId(data.getUserCode()); |
| | | int maxSort = positionIfc.getMaxSort(data.getUserCode()); |
| | | positionIfc.addPanelPosition(list, maxSort, chgid, data.getUserCode()); |
| | | if(list1!=null && list1.size()>0){//修改 |
| | | positionIfc.updateGroup(list1, term.getUserCode()); |
| | | } |
| | | if(list2!=null && list2.size()>0){//添加 |
| | | int chgid = groupIfc.getTop1GroupId(term.getUserCode()); |
| | | int maxSort = positionIfc.getMaxSort(term.getUserCode()); |
| | | positionIfc.addPanelPosition(list2, maxSort, chgid, term.getUserCode()); |
| | | } |
| | | msg.setOk("设置完成!"); |
| | | } catch (Exception e) { |