| | |
| | | import cn.huge.base.common.utils.ReturnFailUtils; |
| | | import cn.huge.base.common.utils.ReturnSucUtils; |
| | | import cn.huge.base.config.CurrentUser; |
| | | import cn.huge.module.cases.domain.dto.CaseInfoWeExcelDTO; |
| | | import cn.huge.module.cases.domain.dto.CasePageDTO; |
| | | import cn.huge.module.cases.domain.dto.CasePersonWeDTO; |
| | | import cn.huge.module.cases.domain.dto.RegisterSaveDTO; |
| | | import cn.huge.module.cases.domain.po.CaseInfo; |
| | | import cn.huge.module.cases.service.CaseInfoService; |
| | | import cn.huge.module.client.api.impl.CustClientImpl; |
| | | import cn.huge.module.cust.dto.CtUserDTO; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | |
| | | |
| | | @Autowired |
| | | private CaseInfoService service; |
| | | |
| | | private Map<String,Object> getParameterAll() { |
| | | Map<String, Object> terms = getParameter(); |
| | | // // 来访时间 |
| | | String visitTimeStart = request.getParameter("visitTimeStart"); |
| | | String visitTimeEnd = request.getParameter("visitTimeEnd"); |
| | | if(StringUtils.isNotBlank(visitTimeStart) && StringUtils.isNotBlank(visitTimeEnd)) { |
| | | terms.put("visitTimeStart", visitTimeStart + " 00:00:00"); |
| | | terms.put("visitTimeEnd", visitTimeEnd + " 23:59:59"); |
| | | } |
| | | String createStart = request.getParameter("createStart"); |
| | | String createEnd = request.getParameter("createEnd"); |
| | | if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) { |
| | | terms.put("createStart", createStart+ " 00:00:00"); |
| | | terms.put("createEnd", createEnd+ " 23:59:59"); |
| | | } |
| | | String closeStart = request.getParameter("closeStart"); |
| | | String closeEnd = request.getParameter("closeEnd"); |
| | | if(StringUtils.isNotBlank(closeStart) && StringUtils.isNotBlank(closeEnd)) { |
| | | terms.put("createStart", closeStart+ " 00:00:00"); |
| | | terms.put("createEnd", closeEnd+ " 23:59:59"); |
| | | } |
| | | String fileStart = request.getParameter("fileStart"); |
| | | String fileEnd = request.getParameter("fileEnd"); |
| | | if(StringUtils.isNotBlank(fileStart) && StringUtils.isNotBlank(fileEnd)) { |
| | | terms.put("createStart", fileStart+ " 00:00:00"); |
| | | terms.put("createEnd", fileEnd+ " 23:59:59"); |
| | | } |
| | | return terms; |
| | | } |
| | | |
| | | /** |
| | | * 获取请求URL参数 |
| | |
| | | if (StringUtils.isNotBlank(inputWay)){ |
| | | terms.put("inputWay", inputWay); |
| | | } |
| | | // 事项状态,1:待签收,2:待受理,3:办理中,4:结案审核,5:待评价,6:已归档 |
| | | // 事项状态,1:待分派,2:待签收,3:待受理,:4:办理中,5:结案审核,6:待评价,7:已归档 |
| | | String status = request.getParameter("status"); |
| | | if (StringUtils.isNotBlank(status)){ |
| | | terms.put("status", status); |
| | |
| | | String processName = request.getParameter("processName"); |
| | | if (StringUtils.isNotBlank(processName)){ |
| | | terms.put("processName", processName); |
| | | } |
| | | // 对外展示事项进度,1:待受理,2:办理中,3:已结案 |
| | | String infoProcess = request.getParameter("process"); |
| | | if (StringUtils.isNotBlank(infoProcess)){ |
| | | terms.put("infoProcess", infoProcess); |
| | | } |
| | | // 对外展示事项进度 |
| | | String infoProcessName = request.getParameter("infoProcessName"); |
| | | if (StringUtils.isNotBlank(infoProcessName)){ |
| | | terms.put("infoProcessName", infoProcessName); |
| | | } |
| | | // 意向调解组织编号 |
| | | String wantUnitId = request.getParameter("wantUnitId"); |
| | | if (StringUtils.isNotBlank(wantUnitId)){ |
| | | terms.put("wantUnitId", wantUnitId); |
| | | } |
| | | // 意向调解组织名称 |
| | | String wantUnitName = request.getParameter("wantUnitName"); |
| | | if (StringUtils.isNotBlank(wantUnitName)){ |
| | | terms.put("wantUnitName", wantUnitName); |
| | | } |
| | | // 意向调解员编号 |
| | | String wantUserId = request.getParameter("wantUserId"); |
| | | if (StringUtils.isNotBlank(wantUserId)){ |
| | | terms.put("wantUserId", wantUserId); |
| | | } |
| | | // 意向调解员名称 |
| | | String wantUserName = request.getParameter("wantUserName"); |
| | | if (StringUtils.isNotBlank(wantUserName)){ |
| | | terms.put("wantUserName", wantUserName); |
| | | } |
| | | // 删除状态,0:未删除,1:已删除 |
| | | String deleteStatus = request.getParameter("deleteStatus"); |
| | |
| | | |
| | | /** |
| | | * PC端-纠纷登记-保存纠纷信息-正常案件 |
| | | * @url {ctx}/api/v1/caseInfo/caseRegister |
| | | * @url {ctx}/api/web/caseInfo/caseRegister |
| | | * @param registerSaveDTO 实体对象 |
| | | */ |
| | | @PostMapping("/caseRegister") |
| | |
| | | return ReturnFailUtils.getRepInfo(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * PC端-正式案件-查询纠纷信息 |
| | | * @url {ctx}/api/web/caseInfo/getCaseInfo?id= |
| | | * @param id 纠纷编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/getCaseInfo") |
| | | public Object getCaseInfo(@RequestParam(value = "id") String id) { |
| | | try { |
| | | return ReturnSucUtils.getRepInfo(service.getCaseInfo(id)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * PC端-查询档案信息 |
| | | * @url {ctx}/api/web/caseInfo/getCaseArchivesInfo?id= |
| | | * @param id 纠纷编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/getCaseArchivesInfo") |
| | | public Object getCaseArchivesInfo(@RequestParam(value = "id") String id) { |
| | | try { |
| | | return ReturnSucUtils.getRepInfo(service.getCaseArchivesInfo(id)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 综合查询 |
| | | * @url {ctx}/api/web/caseInfo/pageQueryAll |
| | | * @param page 页码 |
| | | * @param size 每页数量 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/pageQueryAll") |
| | | public Object pageQueryAll(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) { |
| | | try { |
| | | Map<String, Object> terms = getParameterAll(); |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "a.create_time"); |
| | | PageRequest pageRequest = PageRequest.of(page-1, size, sort); |
| | | Page<CasePageDTO> caseInfoPage = service.pageQueryAll(pageRequest, terms); |
| | | return ReturnSucUtils.getRepInfo( "处理成功", caseInfoPage); |
| | | } catch (Exception e) { |
| | | log.error("Controller接口[CaseInfoWebController.pageQueryAll]请求异常:"+e, e); |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 综合查询-导出 |
| | | * |
| | | * @return Object |
| | | * @url {ctx}/api/web/caseInfo/exportQueryAll |
| | | */ |
| | | @RequestMapping("/exportQueryAll") |
| | | public void exportQueryAll(HttpServletResponse response) { |
| | | try { |
| | | Map<String, Object> terms = getParameterAll(); |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "a.create_time"); |
| | | PageRequest pageRequest = PageRequest.of(0, 1000000, sort); |
| | | Page<CasePageDTO> caseInfoPage = service.pageQueryAll(pageRequest, terms); |
| | | List<CaseInfoWeExcelDTO> excelList = new ArrayList<>(); |
| | | if(ObjectUtils.isNotEmpty(caseInfoPage.getContent())){ |
| | | for (CasePageDTO casePageDTO : caseInfoPage.getContent()) { |
| | | CaseInfoWeExcelDTO caseInfoWeExcelDTO = new CaseInfoWeExcelDTO(); |
| | | BeanUtils.copyProperties(casePageDTO,caseInfoWeExcelDTO); |
| | | caseInfoWeExcelDTO.setCloseTime(DateUtils.DateToString(casePageDTO.getCloseTime(), DateUtils.YYYY_MM_DD)); |
| | | if(ObjectUtils.isNotEmpty(casePageDTO.getPlaintiffList())){ |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (CasePersonWeDTO casePersonWeDTO : casePageDTO.getPlaintiffList()) { |
| | | sb.append(casePersonWeDTO.getTrueName()).append(","); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(sb)){ |
| | | caseInfoWeExcelDTO.setPlaintiffStr(sb.substring(0,sb.length()-1)); |
| | | } |
| | | } |
| | | if(ObjectUtils.isNotEmpty(casePageDTO.getDefendantList())){ |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (CasePersonWeDTO casePersonWeDTO : casePageDTO.getDefendantList()) { |
| | | sb.append(casePersonWeDTO.getTrueName()).append(","); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(sb)){ |
| | | caseInfoWeExcelDTO.setDefendantStr(sb.substring(0,sb.length()-1)); |
| | | } |
| | | } |
| | | excelList.add(caseInfoWeExcelDTO); |
| | | } |
| | | } |
| | | String fileName = "综合查询.xlsx"; |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); |
| | | ServletOutputStream outputStream = response.getOutputStream(); |
| | | EasyExcel.write(outputStream, CaseInfoWeExcelDTO.class).sheet("综合查询").doWrite(excelList); |
| | | } catch (Exception e) { |
| | | log.error("Controller接口[CaseInfoWebController.exportQueryAll]请求异常:"+e, e); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 综合查询 |
| | | * @url {ctx}/api/web/caseInfo/statistics |
| | | * @return Object |
| | | * @CurrentUser String userId |
| | | */ |
| | | @GetMapping("/statistics") |
| | | public Object statistics() { |
| | | try { |
| | | Map<String, Object> terms = getParameterAll(); |
| | | return ReturnSucUtils.getRepInfo( "处理成功", service.statistics(terms)); |
| | | } catch (Exception e) { |
| | | log.error("Controller接口[CaseInfoWebController.statistics]请求异常:"+e, e); |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | } |