| | |
| | | import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; |
| | | import com.moral.api.pojo.vo.allocation.AllocationPageVo; |
| | | import com.moral.api.pojo.vo.allocation.AllocationVo; |
| | | import com.moral.api.utils.BeanConverts; |
| | | import com.moral.constant.PageResult; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("selectUnitView") |
| | | @ApiOperation("表单总览") |
| | | public ResultMessage selectUnitView(HttpServletRequest request){ |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | Map<String, Object> map1 = allocationService.selectUnitView(params); |
| | |
| | | public void unitExel(HttpServletResponse response,HttpServletRequest request){ |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | //数据集合 |
| | | Map<String, Object> map1 = allocationService.selectUnitView(params); |
| | | List<AllocationUnitViewDto> unitView = (List<AllocationUnitViewDto>) map1.get("unitView"); |
| | | |
| | | |
| | | ArrayList<Map<String, Object>> mapArrayList = new ArrayList<>(); |
| | | for (AllocationUnitViewDto allocationUnitViewDto : unitView) { |
| | | Map<String, Object> map = entityToMap(allocationUnitViewDto); |
| | | mapArrayList.add(map); |
| | | } |
| | | List<Map<String, Object>> mapArrayList = allocationService.unitExel(params); |
| | | if (CollectionUtils.isEmpty(mapArrayList)) { |
| | | return; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | 实体类转Map |
| | | */ |
| | | public static Map<String, Object> entityToMap(Object object) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | for (Field field : object.getClass().getDeclaredFields()) { |
| | | try { |
| | | boolean flag = field.isAccessible(); |
| | | field.setAccessible(true); |
| | | Object o = field.get(object); |
| | | map.put(field.getName(), o); |
| | | field.setAccessible(flag); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | } |