package com.zbooksoft.gdmis.controller;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruili.wcp.common.CustomConfigUtil;
|
import com.ruili.wcp.data.entity.config.Module;
|
import com.ruili.wcp.data.entity.management.*;
|
import com.ruili.wcp.engine.flow.HistoryService;
|
import com.ruili.wcp.engine.flow.RuntimeService;
|
import com.ruili.wcp.engine.flow.TaskService;
|
import com.ruili.wcp.service.config.ModuleService;
|
import com.ruili.wcp.web.common.UserFriendlyException;
|
import com.ruili.wcp.web.model.AjaxResponse;
|
import com.ruili.wcp.web.model.ErrorInfo;
|
import com.ruili.wcp.web.model.easyui.DataTableVO;
|
import com.ruili.wcp.web.model.easyui.PagedSortedAndFilteredInputDto;
|
import com.zbooksoft.gdmis.config.ArchivesCustomConfig;
|
import com.zbooksoft.gdmis.data.entity.CatSwajxx;
|
import com.zbooksoft.gdmis.data.entity.PhysicalDetail;
|
import com.zbooksoft.gdmis.data.entity.PhysicalForm;
|
import com.zbooksoft.gdmis.data.entity.UtilizationUser;
|
import com.zbooksoft.gdmis.data.vo.ParentPhysicalInfo;
|
import com.zbooksoft.gdmis.data.vo.PhysicalInfo;
|
import com.zbooksoft.gdmis.service.*;
|
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.authz.annotation.RequiresUser;
|
import org.apache.shiro.session.InvalidSessionException;
|
import org.apache.shiro.session.Session;
|
import org.apache.shiro.subject.Subject;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.servlet.ModelAndView;
|
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
import java.text.SimpleDateFormat;
|
import java.util.*;
|
|
|
/**
|
* @Description: 加工、借阅、实物利用管理
|
* @Author: zhai
|
* @Date: 2024/8/28
|
**/
|
|
@Controller
|
@RequestMapping("/physical")
|
public class PhysicalController {
|
@Autowired
|
CatAjjxxService catAjjxxService;
|
@Autowired
|
CatSwajxxService catSwajxxService;
|
@Autowired
|
CatCgwjxxService catCgwjxxService;
|
@Autowired
|
CatYswjxxService catYswjxxService;
|
@Autowired
|
PhysicalDetailService physicalDetailService;
|
@Autowired
|
PhysicalFormService physicalFormService;
|
@Autowired
|
RuntimeService runtimeService;
|
@Autowired
|
TaskService taskService;
|
@Autowired
|
CustomConfigUtil customConfigUtil;
|
@Autowired
|
ModuleService moduleService;
|
@Autowired
|
HistoryService historyService;
|
@Autowired
|
UtilizationUserService utilizationUserService;
|
@Autowired
|
JdbcTemplate jdbcTemplate;
|
private static final Logger logger = LoggerFactory.getLogger(PhysicalController.class);
|
|
|
@RequestMapping({"/addPhysicalDetail"})
|
@ResponseBody
|
@RequiresUser
|
public AjaxResponse addPhysicalDetail(String keyId) {
|
try {
|
Subject currentUser = SecurityUtils.getSubject();
|
Session session = currentUser.getSession();
|
User user = (User) session.getAttribute("user");
|
|
Map<String, Object> resultMap = new HashMap<>();
|
QueryWrapper<PhysicalDetail> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("form_id", 0);
|
queryWrapper.eq("create_user_id", user.getUserId());
|
int itemCount = physicalDetailService.count(queryWrapper);
|
queryWrapper.eq("file_id", keyId);
|
List<PhysicalDetail> physicalDetailList = physicalDetailService.list(queryWrapper);
|
if (physicalDetailList.size() == 0) {
|
CatSwajxx catSwajxx = catSwajxxService.getById(keyId);
|
Integer swajxxCount = physicalDetailService.setSwajxx(catSwajxx);
|
resultMap.put("addNum", 1);
|
resultMap.put("repeatNum", 0);
|
resultMap.put("existItemNum", itemCount + swajxxCount);
|
} else {
|
resultMap.put("addNum", 0);
|
resultMap.put("repeatNum", 1);
|
resultMap.put("existItemNum", itemCount);
|
}
|
String strSql = "select distinct file_id from UTL_PHYSICAL_DETAIL where form_id=0 and create_user_id=" + user.getUserId();
|
List<Map<String, Object>> parentMapList = jdbcTemplate.queryForList(strSql);
|
resultMap.put("existFileNum", parentMapList.size());
|
AjaxResponse ajaxResponse = new AjaxResponse(true);
|
if (resultMap != null) {
|
StringBuilder sb = new StringBuilder();
|
sb.append("top.layer.open({");
|
sb.append(" title : '提示',");
|
sb.append(" type : 2,");
|
sb.append(" area : [ '700px', '220px' ],");
|
sb.append(" fixed : true, ");
|
sb.append(" content : 'common/commonTips?addNum=" + resultMap.get("addNum") + "&type=实物利用&repeatNum=" + resultMap.get("repeatNum") + "&existFileNum=" + resultMap.get("existFileNum") + "&existItemNum=" + resultMap.get("existItemNum") + "&urlPath=physical'");
|
sb.append("});");
|
Map<String, String> result = new HashMap<String, String>();
|
result.put("jsExpression", sb.toString());
|
ajaxResponse.setResult(result);
|
}
|
return ajaxResponse;
|
} catch (InvalidSessionException e) {
|
logger.error(e.getMessage(), e);
|
return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
|
}
|
}
|
|
/**
|
* 资料借阅申请首页
|
*
|
* @return
|
*/
|
@RequestMapping(value = {"", "index"})
|
@RequiresUser
|
public ModelAndView index() {
|
Subject currentUser = SecurityUtils.getSubject();
|
Session session = currentUser.getSession();
|
User user = (User) session.getAttribute("user");
|
List<PhysicalInfo> physicalInfoList = new ArrayList<>();
|
List<PhysicalDetail> allPhysicalDetailList = new ArrayList<>();
|
if (user != null) {
|
List<ParentPhysicalInfo> parentPhysicalInfoList = physicalDetailService.selectDistinctParentPhysicalInfo(user.getUserId());
|
// 通过distinct获取案卷
|
for (ParentPhysicalInfo parentPhysicalInfo : parentPhysicalInfoList) {
|
QueryWrapper<PhysicalDetail> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("form_id", 0).eq("create_user_id", user.getUserId()).eq("file_id", parentPhysicalInfo.getFileId());
|
queryWrapper.orderByAsc("sample_num");
|
List<PhysicalDetail> physicalDetailList = physicalDetailService.list(queryWrapper);
|
PhysicalInfo physicalInfo = new PhysicalInfo();
|
physicalInfo.setParentPhysicalInfo(parentPhysicalInfo);
|
physicalInfo.setPhysicalDetailList(physicalDetailList);
|
physicalInfoList.add(physicalInfo);
|
allPhysicalDetailList.addAll(physicalDetailList);
|
}
|
}
|
ModelAndView mav = new ModelAndView("gh/physical/index");
|
mav.addObject("curUserId", user.getUserId());
|
mav.addObject("curUserName", user.getTrueName());
|
mav.addObject("curUserTel", user.getMobilePhone());
|
mav.addObject("curDeptName", user.getDeptName());
|
mav.addObject("curDeptId", user.getDeptId());
|
|
mav.addObject("physicalInfoList", physicalInfoList);
|
mav.addObject("allPhysicalDetailList", allPhysicalDetailList);
|
return mav;
|
}
|
|
/**
|
* 保存明细信息
|
*
|
* @param
|
* @return
|
*/
|
@RequestMapping(value = "/savePhysicalDetail", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
|
@ResponseBody
|
@RequiresUser
|
public Object savePhysicalDetail(Long formId, @RequestBody ArrayList<PhysicalDetail> physicalDetailList) {
|
try {
|
physicalDetailService.saveOrUpdateBatch(physicalDetailList);
|
return new AjaxResponse(true);
|
} catch (Exception e) {
|
logger.error(e.getMessage(), e);
|
return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
|
}
|
}
|
|
/**
|
* 保存申请单信息
|
*
|
* @param
|
* @return
|
*/
|
@RequestMapping(value = "/savePhysicalForm", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
|
@ResponseBody
|
@RequiresUser
|
public Object savePhysicalForm(@RequestBody PhysicalForm physicalForm) {
|
try {
|
|
Subject currentUser = SecurityUtils.getSubject();
|
Session session = currentUser.getSession();
|
User user = (User) session.getAttribute("user");
|
physicalForm.setCreateUserId(user.getUserId());
|
physicalForm.setCreateUserName(user.getTrueName());
|
physicalForm.setCreateTime(new Date());
|
|
// 生成利用单编号
|
Date date = new Date();
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");
|
String preNum = dateFormat.format(date);
|
String maxApplyCode = physicalFormService.selectMaxApplyCode(preNum);
|
String applyCode = preNum + "0001";
|
if (StringUtils.isNotEmpty(maxApplyCode)) {
|
Integer newApplyCode = Integer.parseInt(maxApplyCode) + 1;
|
applyCode = newApplyCode.toString();
|
}
|
physicalForm.setApplyCode(applyCode);
|
physicalForm.setFlowState(0);
|
physicalForm.setState(0);
|
physicalForm.setPhysicalDate(new Date());
|
physicalFormService.saveOrUpdate(physicalForm);
|
QueryWrapper<PhysicalDetail> query = new QueryWrapper<>();
|
query.eq("form_id", 0).eq("survey", 0).eq("sampling", 0).eq("create_user_id", user.getUserId());
|
physicalDetailService.remove(query);
|
// 修改明细表formid
|
QueryWrapper<PhysicalDetail> updateWrapper = new QueryWrapper<>();
|
updateWrapper.eq("form_id", 0).eq("create_user_id", user.getUserId());
|
PhysicalDetail physicalDetail = new PhysicalDetail();
|
physicalDetail.setFormId(physicalForm.getFormId());
|
|
physicalDetailService.update(physicalDetail, updateWrapper);
|
|
List<ParentPhysicalInfo> parentPhysicalInfos = physicalDetailService.selectDistinctParentPhysicalInfoByFormId(physicalForm.getFormId());
|
physicalForm.setFileCount(parentPhysicalInfos.size());
|
QueryWrapper<PhysicalDetail> wrapper = new QueryWrapper<>();
|
wrapper.eq("form_id", physicalForm.getFormId());
|
int count = physicalDetailService.count(wrapper);
|
physicalForm.setItemCount(count);
|
physicalFormService.saveOrUpdate(physicalForm);
|
|
// 生成流程信息
|
Long moduleId = 1834402236946464769L;
|
Long tableId = 1834404937772056577L;
|
Long keyId = physicalForm.getFormId();
|
|
Long processDefinitionId = 1834468968411238402L;
|
String businessViewUrl = "physical/physicalForm?formId=" + keyId;
|
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
dataMap.put("applyCode", physicalForm.getApplyCode());
|
dataMap.put("createTime", physicalForm.getCreateTime());
|
dataMap.put("createUserId", physicalForm.getCreateUserId());
|
dataMap.put("formId", physicalForm.getFormId());
|
dataMap.put("remark", physicalForm.getRemark());
|
FlowRuntimeExecution processInstance = runtimeService.startProcessInstanceById(processDefinitionId, moduleId, tableId, keyId, user.getUserId(), user.getTrueName(), businessViewUrl, dataMap);
|
// 完成第一步
|
List<FlowRuntimeTask> taskList = taskService.getTaskByProcessInstanceId(processInstance.getProcessInstanceId());
|
if (taskList != null && taskList.size() > 0) {
|
for (FlowRuntimeTask task : taskList) {
|
taskService.complete(task.getTaskId(), "", null, dataMap, null);
|
}
|
}
|
return new AjaxResponse(true);
|
} catch (Exception e) {
|
logger.error(e.getMessage(), e);
|
return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
|
}
|
}
|
|
|
/**
|
* 档案利用申请单审核
|
*
|
* @param request
|
* @param response
|
* @return
|
* @throws Exception
|
*/
|
@RequestMapping(value = "/physicalForm")
|
@RequiresUser
|
public ModelAndView physicalForm(Long formId, Long processInstanceId, Long taskId, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
ArchivesCustomConfig archivesCustomConfig = customConfigUtil.getConfigObj(ArchivesCustomConfig.class);
|
ModelAndView mav = new ModelAndView("gh/physical/physicalForm");
|
PhysicalForm physicalForm = physicalFormService.getById(formId);
|
List<PhysicalInfo> physicalInfoList = new ArrayList<>();
|
List<ParentPhysicalInfo> parentPhysicalInfoList = physicalDetailService.selectDistinctParentPhysicalInfoByFormId(formId);
|
List<PhysicalDetail> allPhysicalDetailList = new ArrayList<>();
|
if (physicalForm == null) {
|
throw new UserFriendlyException("申请单不存在", "申请单已被删除,无法打开!");
|
}
|
// 通过distinct获取案卷
|
for (ParentPhysicalInfo parentPhysicalInfo : parentPhysicalInfoList) {
|
QueryWrapper<PhysicalDetail> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("form_id", formId).eq("file_id", parentPhysicalInfo.getFileId());
|
queryWrapper.orderByAsc("item_number");
|
List<PhysicalDetail> physicalDetailList = physicalDetailService.list(queryWrapper);
|
PhysicalInfo physicalInfo = new PhysicalInfo();
|
physicalInfo.setParentPhysicalInfo(parentPhysicalInfo);
|
physicalInfo.setPhysicalDetailList(physicalDetailList);
|
physicalInfoList.add(physicalInfo);
|
allPhysicalDetailList.addAll(physicalDetailList);
|
}
|
|
// 获取利用单模块
|
QueryWrapper<Module> physicalFormWrapper = new QueryWrapper<Module>();
|
physicalFormWrapper.eq("module_identify", "physicalForm");
|
Module physicalFormModule = moduleService.getOne(physicalFormWrapper);
|
|
mav.addObject("physicalFormModule", physicalFormModule);
|
mav.addObject("physicalInfoList", physicalInfoList);
|
mav.addObject("allPhysicalDetailList", allPhysicalDetailList);
|
|
mav.addObject("physicalForm", physicalForm);
|
mav.addObject("archivesCustomConfig", archivesCustomConfig);
|
// 处理流程信息
|
Subject currentUser = SecurityUtils.getSubject();
|
Session session = currentUser.getSession();
|
User user = (User) session.getAttribute("user");
|
|
Long moduleId = 1834402236946464769L;
|
Long tableId = 1834404937772056577L;
|
|
FlowRuntimeTask task = null;
|
FlowHistoryProcess historyProcess = null;
|
|
if (taskId != null) {
|
task = taskService.getTaskById(taskId);
|
|
if (task != null) {
|
processInstanceId = task.getProcessInstanceId();
|
mav.addObject("task", task);
|
mav.addObject("processInstanceId", processInstanceId);
|
mav.addObject("isEnd", false);
|
|
} else {
|
// 查找是否有历史任务记录
|
FlowHistoryTask historyTask = historyService.getHistoryTaskById(taskId);
|
if (historyTask != null) {
|
processInstanceId = historyTask.getProcessInstanceId();
|
} else {
|
|
}
|
}
|
}
|
|
// 查找流程是否已经结束
|
if (processInstanceId != null) {
|
historyProcess = historyService.getHistoryProcessByProcessInstanceId(processInstanceId);
|
} else if (moduleId != null && tableId != null && formId != null) {
|
historyProcess = historyService.getHistoryProcessByBusinessInfo(moduleId, tableId, formId);
|
}
|
|
if (historyProcess != null) {
|
processInstanceId = historyProcess.getProcessInstanceId();
|
mav.addObject("processInstanceId", processInstanceId);
|
|
// 如果流程已经结束
|
if (historyProcess.getEndTime() != null) {
|
|
mav.addObject("isEnd", true);
|
} else {
|
mav.addObject("isEnd", false);
|
// 查找是否为自己待办
|
List<FlowRuntimeTask> taskList = taskService.findTasksByProcessInstanceIdAndUserId(user.getUserId(), historyProcess.getProcessInstanceId());
|
if (taskList != null && taskList.size() > 0) {
|
mav.addObject("task", taskList.get(0));
|
mav.addObject("isEnd", false);
|
}
|
}
|
} else {
|
// throw new UserFriendlyException("找不到流程实例", "流程实例不存在或已完成!");
|
}
|
|
// 读取流程历史信息
|
if (task != null || historyProcess != null) {
|
List<FlowHistoryTask> historyTaskList = historyService.getFlowHistoryTaskByProcessInstanceId(processInstanceId);
|
mav.addObject("historyTaskList", historyTaskList);
|
}
|
//
|
// String utilizeApprovePermission = "BusinessManage.ArchivesUtilizationForm.UtilizeApprove";
|
// boolean permitted = currentUser.isPermitted(utilizeApprovePermission);
|
|
// mav.addObject("approvePermission", currentUser.isPermitted(utilizeApprovePermission));
|
mav.addObject("approvePermission", true);
|
|
return mav;
|
}
|
|
|
/**
|
* 我的借阅单首页
|
*
|
* @param request
|
* @param response
|
* @return
|
* @throws Exception
|
*/
|
@RequestMapping(value = "/myPhysicalFormIndex")
|
@RequiresUser
|
public ModelAndView myPhysicalFormIndex(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
ModelAndView mav = new ModelAndView("gh/physical/myPhysicalFormIndex");
|
return mav;
|
}
|
|
|
/**
|
* 分页获取我的利用申请列表
|
*
|
* @param
|
* @param pageInput
|
* @return
|
*/
|
@RequestMapping("/getMyPhysicalFormList")
|
@ResponseBody
|
@RequiresUser
|
public Object getMyPhysicalFormList(Integer flowState, PagedSortedAndFilteredInputDto pageInput) {
|
Subject currentUser = SecurityUtils.getSubject();
|
Session session = currentUser.getSession();
|
User user = (User) session.getAttribute("user");
|
QueryWrapper<PhysicalForm> query = new QueryWrapper<>();
|
if (flowState != null && flowState != -2) {
|
query.eq("flow_state", flowState);
|
}
|
|
query.nested(qy -> qy.eq("create_user_id", user.getUserId()).or().eq("apply_user_id", user.getUserId()));
|
|
IPage<PhysicalForm> utilizationFormIPage;
|
String searchText = pageInput.getSearchText();
|
if (searchText != null && searchText != "") {
|
query.nested(i -> i.like("apply_code", searchText).or().like("borrow_apply_user_name", searchText));
|
}
|
String sort = pageInput.getSort();
|
String order = pageInput.getOrder();
|
if (sort != null && sort != "") {
|
query.orderBy(true, !order.equals("desc"), "apply_code");
|
}
|
DataTableVO<PhysicalForm> dto = new DataTableVO<>();
|
if (pageInput.getPage() != 0 && pageInput.getRows() != 0) {
|
Page<PhysicalForm> page = new Page<>(pageInput.getPage(), pageInput.getRows());
|
utilizationFormIPage = physicalFormService.page(page, query);
|
dto.setTotal(utilizationFormIPage.getTotal());
|
dto.setRows(utilizationFormIPage.getRecords());
|
} else {
|
List<PhysicalForm> utilizationFormList = physicalFormService.list(query);
|
dto.setTotal(utilizationFormList.size());
|
dto.setRows(utilizationFormList);
|
}
|
return dto;
|
}
|
|
/**
|
* 删除借阅单
|
*
|
* @param formIdList
|
* @return
|
*/
|
@RequestMapping(value = "/deletePhysicalForm", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
|
@ResponseBody
|
@RequiresUser
|
public Object deletePhysicalForm(@RequestBody ArrayList<Long> formIdList) {
|
try {
|
physicalFormService.removeByIds(formIdList);
|
for (Long formId : formIdList) {
|
QueryWrapper<PhysicalDetail> query = new QueryWrapper<>();
|
query.eq("form_id", formId);
|
physicalDetailService.remove(query);
|
// 删除流程实例
|
runtimeService.deleteProcessInstanceByBusinessInfo(1834402236946464769L, 1834404937772056577L, formId);
|
}
|
return new AjaxResponse(true);
|
} catch (Exception e) {
|
logger.error(e.getMessage(), e);
|
return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
|
}
|
}
|
|
|
@RequestMapping(value = "/getBorrowUserInfo", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
|
@ResponseBody
|
@RequiresUser
|
public Object getBorrowUserInfo(String userId) {
|
try {
|
QueryWrapper<UtilizationUser> utilizationUserQueryWrapper = new QueryWrapper<>();
|
utilizationUserQueryWrapper.eq("user_id", userId);
|
UtilizationUser utilizationUser = utilizationUserService.getOne(utilizationUserQueryWrapper);
|
return new AjaxResponse(utilizationUser);
|
} catch (Exception e) {
|
logger.error(e.getMessage(), e);
|
return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
|
}
|
}
|
|
/**
|
* 删除明细信息
|
*
|
* @param fileId
|
* @return
|
*/
|
@RequestMapping(value = "/deletePhysicalDetail", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
|
@ResponseBody
|
@RequiresUser
|
public Object deletePhysicalDetail(Long fileId) {
|
try {
|
QueryWrapper<PhysicalDetail> query = new QueryWrapper<>();
|
query.eq("file_id", fileId);
|
query.eq("form_id", 0L);
|
physicalDetailService.remove(query);
|
return new AjaxResponse(true);
|
} catch (Exception e) {
|
logger.error(e.getMessage(), e);
|
return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
|
}
|
}
|
|
/**
|
* 人工添加实物利用单
|
*
|
* @param
|
* @return
|
*/
|
@RequestMapping(value = "/addPhysicalForm")
|
@RequiresUser
|
public ModelAndView addProcessingForm() {
|
ModelAndView mav = new ModelAndView("gh/physical/addPhysicalForm");
|
Subject currentUser = SecurityUtils.getSubject();
|
Session session = currentUser.getSession();
|
User user = (User) session.getAttribute("user");
|
mav.addObject("curUserId", user.getUserId());
|
mav.addObject("curUserName", user.getTrueName());
|
mav.addObject("curUserTel", user.getMobilePhone());
|
mav.addObject("curDeptName", user.getDeptName());
|
mav.addObject("curDeptId", user.getDeptId());
|
return mav;
|
}
|
|
/**
|
* 分页获取人工添加明细列表
|
*
|
* @param
|
* @param pageInput
|
* @return
|
*/
|
@RequestMapping("/getPhysicalDetailListByPeople")
|
@ResponseBody
|
@RequiresUser
|
public Object getPhysicalDetailListByPeople(PagedSortedAndFilteredInputDto pageInput, Long formId) {
|
Subject currentUser = SecurityUtils.getSubject();
|
Session session = currentUser.getSession();
|
User user = (User) session.getAttribute("user");
|
QueryWrapper<PhysicalDetail> query = new QueryWrapper<>();
|
if (formId != null && formId > 0) {
|
query.eq("form_id", formId);
|
} else if (formId != null && formId < 0) {
|
query.gt("form_id", 0);
|
} else {
|
query.eq("form_id", 0).eq("create_user_id", user.getUserId());
|
}
|
query.eq("file_title", "人工添加");
|
List<PhysicalDetail> list = physicalDetailService.list(query);
|
return list;
|
}
|
|
/**
|
* 删除明细信息通过明细id
|
*
|
* @param detailId
|
* @return
|
*/
|
@RequestMapping(value = "/deletePhysicalDetailById", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
|
@ResponseBody
|
@RequiresUser
|
public Object deletePhysicalDetailById(Long detailId) {
|
try {
|
physicalDetailService.removeById(detailId);
|
return new AjaxResponse(true);
|
} catch (Exception e) {
|
logger.error(e.getMessage(), e);
|
return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
|
}
|
}
|
|
}
|