| | |
| | | import cn.huge.base.common.utils.ReturnSucUtils; |
| | | import cn.huge.module.cases.domain.po.CaseDismiss; |
| | | import cn.huge.module.cases.service.CaseDismissService; |
| | | import cn.huge.module.client.api.impl.SysClientImpl; |
| | | import cn.huge.module.sys.dto.FileIdTypeInfoBaseDTO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.google.common.collect.Maps; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | |
| | | |
| | | @Autowired |
| | | private CaseDismissService service; |
| | | @Autowired |
| | | private SysClientImpl sysClient; |
| | | |
| | | /** |
| | | * 获取请求URL参数 |
| | | * @return Map<String, Object> |
| | | */ |
| | | private Map<String, Object> getParameter(){ |
| | | Map<String, Object> terms = Maps.newHashMap(); |
| | | // 主键编号 |
| | | String id = request.getParameter("id"); |
| | | if (StringUtils.isNotBlank(id)){ |
| | | terms.put("id", id); |
| | | } |
| | | // 纠纷编号 |
| | | String caseId = request.getParameter("caseId"); |
| | | if (StringUtils.isNotBlank(caseId)){ |
| | | terms.put("caseId", caseId); |
| | | } |
| | | // 操作的纠纷任务编号 |
| | | String caseTaskId = request.getParameter("caseTaskId"); |
| | | if (StringUtils.isNotBlank(caseTaskId)){ |
| | | terms.put("caseTaskId", caseTaskId); |
| | | } |
| | | // 操作的纠纷任务流转时间 |
| | | String caseTaskTime = request.getParameter("caseTaskTime"); |
| | | if (StringUtils.isNotBlank(caseTaskTime)){ |
| | | terms.put("caseTaskTime", caseTaskTime); |
| | | } |
| | | // 不予受理理由 |
| | | String disContent = request.getParameter("disContent"); |
| | | if (StringUtils.isNotBlank(disContent)){ |
| | | terms.put("disContent", disContent); |
| | | } |
| | | // 操作组织编号 |
| | | String disUnitId = request.getParameter("disUnitId"); |
| | | if (StringUtils.isNotBlank(disUnitId)){ |
| | | terms.put("disUnitId", disUnitId); |
| | | } |
| | | // 操作组织名称 |
| | | String disUnitName = request.getParameter("disUnitName"); |
| | | if (StringUtils.isNotBlank(disUnitName)){ |
| | | terms.put("disUnitName", disUnitName); |
| | | } |
| | | // 操作人编号 |
| | | String disUserId = request.getParameter("disUserId"); |
| | | if (StringUtils.isNotBlank(disUserId)){ |
| | | terms.put("disUserId", disUserId); |
| | | } |
| | | // 操作人名称 |
| | | String disUserName = request.getParameter("disUserName"); |
| | | if (StringUtils.isNotBlank(disUserName)){ |
| | | terms.put("disUserName", disUserName); |
| | | } |
| | | // 操作时间 |
| | | String disTime = request.getParameter("disTime"); |
| | | if (StringUtils.isNotBlank(disTime)){ |
| | | terms.put("disTime", disTime); |
| | | } |
| | | // 删除状态,0:未删除,1:已删除 |
| | | String deleteStatus = request.getParameter("deleteStatus"); |
| | | if (StringUtils.isNotBlank(deleteStatus)){ |
| | | terms.put("deleteStatus", deleteStatus); |
| | | } |
| | | // 顾客编号 |
| | | String custId = request.getParameter("custId"); |
| | | if (StringUtils.isNotBlank(custId)){ |
| | | terms.put("custId", custId); |
| | | } |
| | | // 创建时间区间 |
| | | String createStart = request.getParameter("createStart"); |
| | | String createEnd = request.getParameter("createEnd"); |
| | | if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) { |
| | | terms.put("createStart", createStart); |
| | | terms.put("createEnd", createEnd); |
| | | } |
| | | // 更新时间区间 |
| | | String updateStart = request.getParameter("updateStart"); |
| | | String updateEnd = request.getParameter("updateEnd"); |
| | | if(StringUtils.isNotBlank(updateStart) && StringUtils.isNotBlank(updateEnd)) { |
| | | terms.put("updateStart", updateStart); |
| | | terms.put("updateEnd", updateEnd); |
| | | } |
| | | return terms; |
| | | } |
| | | |
| | | /** |
| | | * 条件查询多个 |
| | | * @url {ctx}/api/web/caseDismiss/listQuery |
| | | * 根据纠纷编号查询 |
| | | * @url {ctx}/api/web/caseDismiss/getByCaseId |
| | | * @param caseId 纠纷编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/listQuery") |
| | | public Object listQuery() { |
| | | @GetMapping("/getByCaseId") |
| | | public Object getByCaseId(@RequestParam(value = "caseId") String caseId) { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | return ReturnSucUtils.getRepInfo(service.listTerms(terms)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | CaseDismiss caseDismiss = service.getByCaseId(caseId); |
| | | Map<String, Object> term = new HashMap<>(); |
| | | term.put("mainId", caseDismiss.getCaseId()); |
| | | term.put("ownerIds", caseDismiss.getId()); |
| | | List<FileIdTypeInfoBaseDTO> fileInfoList = sysClient.listIdTypeInfoByOwnerIdList(term); |
| | | if(CollectionUtils.isNotEmpty(fileInfoList)){ |
| | | caseDismiss.setFileInfoList(fileInfoList.get(0).getFileList().get(0).getFileList()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件分页查询 |
| | | * @url {ctx}/api/web/caseDismiss/pageQuery |
| | | * @param page 页码 |
| | | * @param size 每页数量 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/pageQuery") |
| | | public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "create_time"); |
| | | PageRequest pageRequest = PageRequest.of(page-1, size, sort); |
| | | Page<CaseDismiss> caseDismissPage = service.pageQuery(pageRequest, terms); |
| | | return ReturnSucUtils.getRepInfo( "处理成功", caseDismissPage); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号查询单个 |
| | | * @url {ctx}/api/web/caseDismiss/getById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/getById") |
| | | public Object getById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | return ReturnSucUtils.getRepInfo(service.getById(id)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据主键单个 |
| | | * @url {ctx}/api/web/caseDismiss/deleteById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/deleteById") |
| | | public Object deleteById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | service.removeById(id); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @url {ctx}/api/web/caseDismiss/saveCaseDismiss |
| | | * @param caseDismiss 实体对象 |
| | | * @return Object |
| | | */ |
| | | @PostMapping("/saveCaseDismiss") |
| | | public Object saveCaseDismiss(@RequestBody CaseDismiss caseDismiss) { |
| | | try { |
| | | service.saveCaseDismiss(caseDismiss); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | return ReturnSucUtils.getRepInfo(caseDismiss); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |