package com.palmnest.webapp.controller.backstage;

import com.alibaba.fastjson.JSONObject;
import com.palmnest.application.AppConstants;
import com.palmnest.application.CodeConstants;
import com.palmnest.application.bean.AppResultDto;
import com.palmnest.application.bean.Page;
import com.palmnest.application.core.util.AppResultUtil;
import com.palmnest.application.core.util.LogExceptionStackUtil;
import com.palmnest.application.dto.OrgDto;
import com.palmnest.application.dto.WebPageResultDto;
import com.palmnest.application.dto.input.GoodsReleaseBillInputDto;
import com.palmnest.application.dto.output.enterprise.GoodsReleaseVo;
import com.palmnest.model.Element;
import com.palmnest.model.User;
import com.palmnest.service.AppUserService;
import com.palmnest.service.ElementGroupManager;
import com.palmnest.service.UserManager;
import com.palmnest.service.estateserve.ScWxuserManager;
import com.palmnest.service.estateserve.VirtualArchManager;
import com.palmnest.service.estateserve.release.GoodsReleaseManager;
import com.palmnest.service.estateserve.release.GoodsReleaseService;
import com.palmnest.webapp.controller.BaseFormController;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

//PC端
@Slf4j
@Controller
@RequestMapping(value = "/release")
public class GoodsReleaseController extends BaseFormController {


	@Autowired
	private GoodsReleaseService goodsReleaseService;
	@Autowired
	private GoodsReleaseManager goodsReleaseManager;
	@Autowired
	private ElementGroupManager elementGroupManager;
	@Autowired
	private VirtualArchManager  virtualArchManager;
	@Autowired
	private ScWxuserManager     scWxuserManager;
	@Autowired
	private UserManager         userManager;
	@Autowired
	private AppUserService      appUserService;


	/**
	 * 得到物品放行人--放行历史（放行人接口
	 *
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/getReleaseUser")
	@ResponseBody
	public AppResultDto getReleaseUser(@ModelAttribute("goodsReleaseBillInputDto") GoodsReleaseBillInputDto dto, HttpServletRequest request) {

		log.info("GoodsReleaseController getReleaseUser======");

		User   user   = (User) request.getSession().getAttribute("UserCache");
		String orgIds = getUserManageOrgIds(user);//例如:1,25,2
		if (orgIds.split(",").length > 1) {//系统管理员暂不支持
			orgIds = "0";
		}
		List<User> users = goodsReleaseService.getReleaseUser(Integer.parseInt(orgIds), CodeConstants.RELEASE_PERMISSION);
		List       list  = new ArrayList();

		for (User u : users) {
			Map<String, String> params = new HashMap<String, String>();
			params.put("id", String.valueOf(u.getId()));
			params.put("name", u.getFullName());
			list.add(params);
		}

		return AppResultUtil.createSuccesDto(list);
	}

	/**
	 * 放行历史
	 *
	 * @return
	 */
	@RequestMapping(value = "/releaseHistory")
	public ModelAndView releaseHistory() {
		//报修方式 区域 类型 小类型
		Model model = new ExtendedModelMap();
		/*List<Element> repairWayGroup = elementGroupManager.getElementsByGroupName("repairWayGroup");
		List<Element> repairAreaGroup = elementGroupManager.getElementsByGroupName("repairAreaGroup");
		List<Element> repairTypeGroup = elementGroupManager.getElementsByGroupName("repairTypeGroup");
		model.addAttribute("repairWayGroup", elementGroupManager.convert(repairWayGroup));
		model.addAttribute("repairAreaGroup", elementGroupManager.convert(repairAreaGroup));
		model.addAttribute("repairTypeGroup", elementGroupManager.convert(repairTypeGroup));
		
		if(repairTypeGroup.size()>0) {
			List<Element> repairTypeaDetailGroup = elementGroupManager.getElementsByGroupName(repairTypeGroup.get(0).getItemcode());
			model.addAttribute("repairTypeaDetailGroup", elementGroupManager.convert(repairTypeaDetailGroup));
		}*/

		//申请类型
		List<Element> releaseTypeGroup = elementGroupManager.getElementsByGroupName("releaseTypeGroup");
		model.addAttribute("releaseTypeGroup", releaseTypeGroup);

		return new ModelAndView("/admin/release/releaseHistory", model.asMap());
	}

	/**
	 * 放行审批
	 *
	 * @return
	 */
	@RequestMapping(value = "/releaseApprove")
	public ModelAndView releaseApprove(HttpServletRequest request, HttpServletResponse response) {
		//报修方式 区域 类型 小类型
		Model model = new ExtendedModelMap();

		User         user = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> dtos = appUserService.getUserOrgs(user.getId());
		model.addAttribute("org", dtos);

		/*List<Element> repairWayGroup = elementGroupManager.getElementsByGroupName("repairWayGroup");
		List<Element> repairAreaGroup = elementGroupManager.getElementsByGroupName("repairAreaGroup");
		List<Element> repairTypeGroup = elementGroupManager.getElementsByGroupName("repairTypeGroup");
		model.addAttribute("repairWayGroup", elementGroupManager.convert(repairWayGroup));
		model.addAttribute("repairAreaGroup", elementGroupManager.convert(repairAreaGroup));
		model.addAttribute("repairTypeGroup", elementGroupManager.convert(repairTypeGroup));
		
		if(repairTypeGroup.size()>0) {
			List<Element> repairTypeaDetailGroup = elementGroupManager.getElementsByGroupName(repairTypeGroup.get(0).getItemcode());
			model.addAttribute("repairTypeaDetailGroup", elementGroupManager.convert(repairTypeaDetailGroup));
		}*/

		return new ModelAndView("/admin/release/releaseApprove", model.asMap());
	}

	/**
	 * 申请管理
	 *
	 * @return
	 */
	@RequestMapping(value = "/manage")
	public ModelAndView manage(HttpServletRequest request, HttpServletResponse response) {
		//报修方式 区域 类型 小类型
		Model model = new ExtendedModelMap();

		User         user = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> dtos = appUserService.getUserOrgs(user.getId());
		initPageOrgInfo(request, model);
		model.addAttribute("org", dtos);
		
		
		

		/*List<Element> repairWayGroup = elementGroupManager.getElementsByGroupName("repairWayGroup");
		List<Element> repairAreaGroup = elementGroupManager.getElementsByGroupName("repairAreaGroup");
		List<Element> repairTypeGroup = elementGroupManager.getElementsByGroupName("repairTypeGroup");
		model.addAttribute("repairWayGroup", elementGroupManager.convert(repairWayGroup));
		model.addAttribute("repairAreaGroup", elementGroupManager.convert(repairAreaGroup));
		model.addAttribute("repairTypeGroup", elementGroupManager.convert(repairTypeGroup));
		
		if(repairTypeGroup.size()>0) {
			List<Element> repairTypeaDetailGroup = elementGroupManager.getElementsByGroupName(repairTypeGroup.get(0).getItemcode());
			model.addAttribute("repairTypeaDetailGroup", elementGroupManager.convert(repairTypeaDetailGroup));
		}*/

		return new ModelAndView("/admin/applyRelease/manage", model.asMap());
	}


	/**
	 * 申请记录
	 *
	 * @return
	 */
	@RequestMapping(value = "/record")
	public ModelAndView record(HttpServletRequest request, HttpServletResponse response) {
		//报修方式 区域 类型 小类型
		Model model = new ExtendedModelMap();

		User         user = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> dtos = appUserService.getUserOrgs(user.getId());
		initPageOrgInfo(request, model);
		model.addAttribute("orgs", dtos);
		
		
		

		/*List<Element> repairWayGroup = elementGroupManager.getElementsByGroupName("repairWayGroup");
		List<Element> repairAreaGroup = elementGroupManager.getElementsByGroupName("repairAreaGroup");
		List<Element> repairTypeGroup = elementGroupManager.getElementsByGroupName("repairTypeGroup");
		model.addAttribute("repairWayGroup", elementGroupManager.convert(repairWayGroup));
		model.addAttribute("repairAreaGroup", elementGroupManager.convert(repairAreaGroup));
		model.addAttribute("repairTypeGroup", elementGroupManager.convert(repairTypeGroup));
		
		if(repairTypeGroup.size()>0) {
			List<Element> repairTypeaDetailGroup = elementGroupManager.getElementsByGroupName(repairTypeGroup.get(0).getItemcode());
			model.addAttribute("repairTypeaDetailGroup", elementGroupManager.convert(repairTypeaDetailGroup));
		}*/

		return new ModelAndView("/admin/applyRelease/record", model.asMap());
	}

	/**
	 * 申请统计
	 *
	 * @return
	 */
	@RequestMapping(value = "/statistics")
	public ModelAndView statistics(HttpServletRequest request, HttpServletResponse response) {
		//报修方式 区域 类型 小类型
		Model model = new ExtendedModelMap();

		User         user = (User) request.getSession().getAttribute("UserCache");
		List<OrgDto> dtos = appUserService.getUserOrgs(user.getId());
		initPageOrgInfo(request, model);
		model.addAttribute("orgs", dtos);
		
		
		

		/*List<Element> repairWayGroup = elementGroupManager.getElementsByGroupName("repairWayGroup");
		List<Element> repairAreaGroup = elementGroupManager.getElementsByGroupName("repairAreaGroup");
		List<Element> repairTypeGroup = elementGroupManager.getElementsByGroupName("repairTypeGroup");
		model.addAttribute("repairWayGroup", elementGroupManager.convert(repairWayGroup));
		model.addAttribute("repairAreaGroup", elementGroupManager.convert(repairAreaGroup));
		model.addAttribute("repairTypeGroup", elementGroupManager.convert(repairTypeGroup));
		
		if(repairTypeGroup.size()>0) {
			List<Element> repairTypeaDetailGroup = elementGroupManager.getElementsByGroupName(repairTypeGroup.get(0).getItemcode());
			model.addAttribute("repairTypeaDetailGroup", elementGroupManager.convert(repairTypeaDetailGroup));
		}*/

		return new ModelAndView("/admin/applyRelease/statistics", model.asMap());
	}


	@RequestMapping(value = "getGoodsCompany")
	@ResponseBody
	public AppResultDto getGoodsCompany(@RequestParam("orgId") Long orgId, HttpServletResponse response) {
		log.info("GoodsReleaseController getGoodsCompany======");
		GoodsReleaseVo list= goodsReleaseService.getGoodsCompany(orgId);
		return AppResultUtil.createSuccesDto(list);
	}
	/**
	 * @param request
	 * @return 物品放行列表
	 */
	@RequestMapping(value = "/list")
	@ResponseBody
	public WebPageResultDto list(HttpServletRequest request) {
		log.info("GoodsReleaseController list======");
		try {
			int                 pageSize = Integer.parseInt(request.getParameter("pageSize"));
			int                 pageNo   = Integer.parseInt(request.getParameter("pageNo"));
			Map<String, Object> params   = new HashMap<String, Object>();
			//String openId = request.getParameter("openId");
			String releaseStatus = request.getParameter("releaseStatus");
			//WxUser wxUser = scWxuserManager.getScWxuserByOpenId(openId);
			//params.put("creatorBillId", wxUser.getId());
			params.put("releaseCode", request.getParameter("releaseCode"));
			params.put("applyUser", request.getParameter("applyUser"));//申请人
			params.put("releaseStatus", releaseStatus);


			params.put("orgId", request.getParameter("orgId"));
			params.put("virtualArchId", request.getParameter("virtualArchId"));
			params.put("applyType", request.getParameter("applyType"));
			
			params.put("virtualArchName", request.getParameter("virtualArchName"));

			//pc审批列表，只看她企业审批通过的记录
//			if(StringUtils.isNotEmpty(releaseStatus) && String.valueOf(GoodsCodeConstants.ST_AUDITING).equals(releaseStatus)){
//				params.put("companyHeadUser", "companyHeadUser");
//			}


			params.put("billStartDate", request.getParameter("billStartDate"));//发起-开始时间
			params.put("billEndDate", request.getParameter("billEndDate"));
			params.put("releaseStartDate", request.getParameter("releaseStartDate"));//放行-开始时间
			params.put("releaseEndDate", request.getParameter("releaseEndDate"));
			params.put("releaseType", request.getParameter("releaseType"));
			params.put("releaseUser", request.getParameter("releaseUser"));

			User   user   = (User) request.getSession().getAttribute("UserCache");
			String orgIds = getUserManageOrgIds(user);//例如:1,25,2
			params.put("orgIds", orgIds);
			Page             page = goodsReleaseService.findPageBy(params, pageSize, pageNo);
			WebPageResultDto dto  = new WebPageResultDto(AppConstants.SUCCESS_CODE, "成功", page.getItems());
			dto.setCount(page.getTotalCount());
			return dto;
		} catch (Exception e) {
			e.printStackTrace();
			return new WebPageResultDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败", LogExceptionStackUtil.LogExceptionStack(e));
		}
	}

	/**
	 * @param request
	 * @return 导出物品放行列表
	 */
	@RequestMapping(value = "/exportList")
	@ResponseBody
	public AppResultDto exportList(HttpServletRequest request) {
		
		log.info("GoodsReleaseController exportList======");
		int                 pageSize = Integer.parseInt(request.getParameter("pageSize"));
		int                 pageNo   = Integer.parseInt(request.getParameter("pageNo"));
		Map<String, Object> params   = new HashMap<String, Object>();
		//String openId = request.getParameter("openId");
		String releaseStatus = request.getParameter("releaseStatus");
		//WxUser wxUser = scWxuserManager.getScWxuserByOpenId(openId);
		//params.put("creatorBillId", wxUser.getId());
		params.put("releaseCode", request.getParameter("releaseCode"));
		params.put("applyUser", request.getParameter("applyUser"));//申请人
		params.put("releaseStatus", releaseStatus);


		params.put("orgId", request.getParameter("orgId"));
		params.put("virtualArchId", request.getParameter("virtualArchId"));
		params.put("applyType", request.getParameter("applyType"));

		//pc审批列表，只看她企业审批通过的记录
//		if(StringUtils.isNotEmpty(releaseStatus) && String.valueOf(GoodsCodeConstants.ST_AUDITING).equals(releaseStatus)){
//			params.put("companyHeadUser", "companyHeadUser");
//		}


		params.put("billStartDate", request.getParameter("billStartDate"));//发起-开始时间
		params.put("billEndDate", request.getParameter("billEndDate"));
		params.put("releaseStartDate", request.getParameter("releaseStartDate"));//放行-开始时间
		params.put("releaseEndDate", request.getParameter("releaseEndDate"));
		params.put("releaseType", request.getParameter("releaseType"));
		params.put("releaseUser", request.getParameter("releaseUser"));

		User   user   = (User) request.getSession().getAttribute("UserCache");
		String orgIds = getUserManageOrgIds(user);//例如:1,25,2
		params.put("orgIds", orgIds);

		return goodsReleaseService.exportList(params);
		
	}
	

	/**
	 * @param request
	 * @return 记录列表
	 */
	@RequestMapping(value = "/recordlist")
	@ResponseBody
	public WebPageResultDto recordlist(HttpServletRequest request) {
		log.info("GoodsReleaseController recordlist======");
		try {
			int                 pageSize = Integer.parseInt(request.getParameter("pageSize"));
			int                 pageNo   = Integer.parseInt(request.getParameter("pageNo"));
			Map<String, Object> params   = new HashMap<String, Object>();


			params.put("orgId", request.getParameter("orgId"));
			params.put("virtualArchId", request.getParameter("virtualArchId"));
			params.put("applyUser", request.getParameter("applyUser"));//申请人
			params.put("applyTel", request.getParameter("applyTel"));
			params.put("releaseStartDate", request.getParameter("releaseStartDate"));//放行-开始时间
			params.put("releaseEndDate", request.getParameter("releaseEndDate"));


			User   user   = (User) request.getSession().getAttribute("UserCache");
			String orgIds = getUserManageOrgIds(user);//例如:1,25,2
			params.put("orgIds", orgIds);
			Page             page = goodsReleaseService.findRecordPageBy(params, pageSize, pageNo);
			WebPageResultDto dto  = new WebPageResultDto(AppConstants.SUCCESS_CODE, "成功", page.getItems());
			dto.setCount(page.getTotalCount());
			return dto;
		} catch (Exception e) {
			e.printStackTrace();
			return new WebPageResultDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败", LogExceptionStackUtil.LogExceptionStack(e));
		}
	}


	/**
	 * 导出申请记录
	 *
	 * @param orgId
	 * @param dateType
	 * @param date
	 * @param endDate
	 * @return
	 */
	@RequestMapping(value = "reportRecord")
	@ResponseBody
	public AppResultDto reportRecord(HttpServletRequest request) {

		Map<String, Object> params = new HashMap<String, Object>();

		params.put("orgId", request.getParameter("orgId"));
		params.put("virtualArchId", request.getParameter("virtualArchId"));
		params.put("applyUser", request.getParameter("applyUser"));//申请人
		params.put("applyTel", request.getParameter("applyTel"));
		params.put("releaseStartDate", request.getParameter("releaseStartDate"));//放行-开始时间
		params.put("releaseEndDate", request.getParameter("releaseEndDate"));
		params.put("operationType", "1");//只取通过的

		User   user   = (User) request.getSession().getAttribute("UserCache");
		String orgIds = getUserManageOrgIds(user);//例如:1,25,2
		params.put("orgIds", orgIds);

		return goodsReleaseService.reportRecord(params);
	}

	/**
	 * @param request
	 * @return 记录列表
	 */
	@RequestMapping(value = "/statisticslist")
	@ResponseBody
	public WebPageResultDto statisticslist(HttpServletRequest request) {
		log.info("GoodsReleaseController statisticslist======");
		try {
			int                 pageSize = Integer.parseInt(request.getParameter("pageSize"));
			int                 pageNo   = Integer.parseInt(request.getParameter("pageNo"));
			Map<String, Object> params   = new HashMap<String, Object>();


			params.put("orgId", request.getParameter("orgId"));
			params.put("releaseStartDate", request.getParameter("releaseStartDate"));//放行-开始时间
			params.put("releaseEndDate", request.getParameter("releaseEndDate"));
			params.put("operationType", "1");//只取通过的

			User   user   = (User) request.getSession().getAttribute("UserCache");
			String orgIds = getUserManageOrgIds(user);//例如:1,25,2
			params.put("orgIds", orgIds);
			Page             page = goodsReleaseService.findStatisticsPageBy(params, pageSize, pageNo);
			WebPageResultDto dto  = new WebPageResultDto(AppConstants.SUCCESS_CODE, "成功", page.getItems());
			dto.setCount(page.getTotalCount());
			return dto;
		} catch (Exception e) {
			e.printStackTrace();
			return new WebPageResultDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败", LogExceptionStackUtil.LogExceptionStack(e));
		}
	}

	/**
	 * 导出申请管理
	 *
	 * @param orgId
	 * @param dateType
	 * @param date
	 * @param endDate
	 * @return
	 */
	@RequestMapping(value = "reportStatistics")
	@ResponseBody
	public AppResultDto reportStatistics(HttpServletRequest request) {

		Map<String, Object> params = new HashMap<String, Object>();

		params.put("orgId", request.getParameter("orgId"));
		params.put("releaseStartDate", request.getParameter("releaseStartDate"));//放行-开始时间
		params.put("releaseEndDate", request.getParameter("releaseEndDate"));
		params.put("operationType", "1");//只取通过的

		User   user   = (User) request.getSession().getAttribute("UserCache");
		String orgIds = getUserManageOrgIds(user);//例如:1,25,2
		params.put("orgIds", orgIds);

		return goodsReleaseService.reportStatistics(params);
	}


	/**
	 * 导出申请管理
	 *
	 * @param orgId
	 * @param dateType
	 * @param date
	 * @param endDate
	 * @return
	 */
	@RequestMapping(value = "exportApplyManage")
	@ResponseBody
	public AppResultDto exportApplyManage(HttpServletRequest request) {

		Map<String, Object> params = new HashMap<String, Object>();
		//String openId = request.getParameter("openId");
		String releaseStatus = request.getParameter("releaseStatus");
		//WxUser wxUser = scWxuserManager.getScWxuserByOpenId(openId);
		//params.put("creatorBillId", wxUser.getId());
		params.put("releaseCode", request.getParameter("releaseCode"));
		params.put("applyUser", request.getParameter("applyUser"));//申请人
		params.put("releaseStatus", releaseStatus);


		params.put("orgId", request.getParameter("orgId"));
		params.put("virtualArchId", request.getParameter("virtualArchId"));
		params.put("applyType", request.getParameter("applyType"));

		//pc审批列表，只看她企业审批通过的记录
//		if(StringUtils.isNotEmpty(releaseStatus) && String.valueOf(GoodsCodeConstants.ST_AUDITING).equals(releaseStatus)){
//			params.put("companyHeadUser", "companyHeadUser");
//		}


		params.put("billStartDate", request.getParameter("billStartDate"));//发起-开始时间
		params.put("billEndDate", request.getParameter("billEndDate"));
		params.put("releaseStartDate", request.getParameter("releaseStartDate"));//放行-开始时间
		params.put("releaseEndDate", request.getParameter("releaseEndDate"));
		params.put("releaseType", request.getParameter("releaseType"));
		params.put("releaseUser", request.getParameter("releaseUser"));

		User   user   = (User) request.getSession().getAttribute("UserCache");
		String orgIds = getUserManageOrgIds(user);//例如:1,25,2
		params.put("orgIds", orgIds);

		return goodsReleaseService.reportExcel(params);
	}


	/**
	 * 统计数据
	 *
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/statisticsData")
	@ResponseBody
	public AppResultDto statisticsData(HttpServletRequest request) {

		log.info("WxGoodsReleaseController indexTotal======");

		try {

			Map<String, Object> params = new HashMap<String, Object>();
			params.put("orgId", request.getParameter("orgId"));
			List<Map<String, Object>> listGoodsRelease = goodsReleaseManager.getStatisticsData(params);

			return AppResultUtil.createSuccesDto(listGoodsRelease.get(0));
		} catch (Exception e) {
			e.printStackTrace();
			return AppResultUtil.createErrorDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询失败");
		}
	}


	/**
	 * @return 查找维修单详情
	 */
	@RequestMapping(value = "/getDetail")
	@ResponseBody
	public AppResultDto getDetail(@RequestParam("id") String id) {
		log.info("GoodsReleaseController getDetail======");
		return AppResultUtil.createSuccesDto(goodsReleaseService.findById(id));
	}

	/**
	 * 同意放行
	 */
	@RequestMapping(value = "/agree")
	@ResponseBody
	public AppResultDto agree(@ModelAttribute("goodsReleaseBillInputDto") GoodsReleaseBillInputDto dto, MultipartHttpServletRequest request) {
		log.info("GoodsReleaseController agree======");
		dto.setBillFrom(CodeConstants.PC);
		return goodsReleaseService.agree(dto, request);
	}

	/**
	 * 拒绝放行
	 */
	@RequestMapping(value = "/refuse")
	@ResponseBody
	public AppResultDto refuse(@ModelAttribute("goodsReleaseBillInputDto") GoodsReleaseBillInputDto dto, HttpServletRequest request) {
		log.info("GoodsReleaseController refuse======");
		dto.setBillFrom(CodeConstants.PC);
		return goodsReleaseService.refuse(dto, request);
	}

	/**
	 * @return 获取审核流程
	 */
	@RequestMapping(value = "/getGoodsConfig")
	@ResponseBody
	public AppResultDto getGoodsConfig(@RequestParam("orgId") Long orgId, HttpServletRequest request) {
		log.info("ApiGoodsReleaseController getGoodsConfig======");


		String  applyType = request.getParameter("applyType");
		Integer type      = 0;
		if (StringUtils.isNotEmpty(applyType)) {
			type = 1;
		}

		boolean              flag = goodsReleaseService.getGoodsConfig(orgId, type);
		Map<String, Integer> map  = new HashMap<>();
		if (flag) {
			map.put("config", 1);
			return AppResultUtil.createSuccesDto(map);
		}
		map.put("config", 0);
		return AppResultUtil.createSuccesDto("该项目没有配置审核流程", map);
	}

}
