| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- package platform.modules.government.web;
- import com.github.pagehelper.PageInfo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.ModelMap;
- import org.springframework.util.CollectionUtils;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import platform.common.Constant;
- import platform.common.annotation.OperationLog;
- import platform.common.base.controller.BaseController;
- import platform.common.base.service.DictionaryItemService;
- import platform.common.exception.BaseException;
- import platform.common.util.ShiroUtils;
- import platform.modules.build.entity.Company;
- import platform.modules.build.entity.CompanyContact;
- import platform.modules.build.service.CompanyContactService;
- import platform.modules.build.service.CompanyService;
- import platform.modules.carrier.entity.Contract;
- import platform.modules.carrier.service.IcContractService;
- import platform.modules.carrier.service.ParkService;
- import platform.modules.company.dto.ProcessNodeDto;
- import platform.modules.company.dto.StockLandApprovalDto;
- import platform.modules.company.entity.*;
- import platform.modules.company.service.*;
- import platform.modules.government.dto.SearchCondition;
- import platform.modules.government.entity.FileDown;
- import platform.modules.sys.entity.Approval;
- import platform.modules.sys.entity.Group;
- import platform.modules.sys.entity.UserGroup;
- import platform.modules.sys.service.ApprovalService;
- import platform.modules.sys.service.GroupService;
- import platform.modules.sys.service.UserGroupService;
- import platform.modules.sys.web.ResponseMessage;
- import javax.servlet.http.HttpServletRequest;
- import java.io.Serializable;
- import java.util.Arrays;
- import java.util.List;
- import java.util.Objects;
- /**
- * @author jiangjz
- * @ClassName: AreaMangerController
- * @Description: TODO(存量用地)
- * @date 2018年3月21日 上午11:17:43
- */
- @Controller
- @RequestMapping("/areaManager/")
- public class AreaManagerController extends BaseController {
- @Autowired
- private StockLandService stockLandService;
- @Autowired
- private StockLandMaterialService stockLandMaterialService;
- @Autowired
- CompanyService companyService;
- @Autowired
- ApprovalService approvalService;
- @Autowired
- ProcessFeedbackService processFeedbackService;
- @Autowired
- private CompanyContactService companyContactService;
- @Autowired
- private GroupService groupService;
- @Autowired
- private UserGroupService userGroupService;
- @Autowired
- private StockLandApproveService stockLandApproveService;
- @Autowired
- private ProjectApplicationCompanyInfoService projectApplicationCompanyInfoService;
- @Autowired
- private DictionaryItemService dictionaryItemService;
- @Autowired
- private ParkService parkService;
- @Autowired
- private IcContractService icContractService;
- @Autowired
- private StockLandOutParkService stockLandOutParkService;
- @Value("${repositoryPath}")
- private String baseFolderPath;
- /**
- * @param @return
- * @return String 返回类型
- * @Title: index
- * @Description: TODO(待审核页面)
- * @author jiangjz
- */
- @OperationLog(value = "查看存量用地审核列表")
- @RequestMapping("index")
- public String index(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, SearchCondition condition, StockLand searchCondition, String keyword, ModelMap modelMap) {
- try {
- PageInfo<StockLand> pageInfo = stockLandService.findPageInfo(pageNum, PAGESIZE, condition);
- modelMap.put("pageInfo", pageInfo);
- modelMap.put("searchCondition", searchCondition == null ? new StockLand() : searchCondition);
- modelMap.put("keyword", keyword);
- stockLandService.getDictInfo(modelMap);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return "/admin/government/areaManager/index";
- }
- /**
- * @param @param id
- * @param @param modelMap
- * @param @return
- * @return String 返回类型
- * @Title: details
- * @Description: TODO(待审核详情)
- * @author jiangjz
- */
- @OperationLog(value = "查看存量用地审核详情")
- @RequestMapping("details")
- public String details(@RequestParam(value = "id", defaultValue = "") Integer id, ModelMap modelMap) {
- StockLand landApply = stockLandService.findLandApplyById(id);
- modelMap.put("landApply", landApply);
- stockLandMaterialService.getApplyMaterials(landApply, modelMap);
- modelMap.put("fileUrl", setFileUrl());
- /*List<ProcessNodeDto> processNodes = stockLandService.getProcessNodes(landApply, false);
- modelMap.put("processNodesList", processNodes);*/
- /*Integer companyId = landApply.getCompany_id();
- Company companyInfo = new Company();
- if (null != companyId) {
- companyInfo = companyService.findById(companyId);
- }*/
- List<Approval> approvalList = approvalService.getApprovalList(id);
- //流程信息
- modelMap.put("approvalList", approvalList);
- //企业信息
- ProjectApplicationCompanyInfo companyInfo = projectApplicationCompanyInfoService.findByApplyIdAndType(id, Constant.DictionaryType.STOCKLAND);
- if (companyInfo == null) {
- Company company = companyService.getCompanyInfo(landApply.getCompany_id());
- if (Objects.equals(company.getIndustry_code(), "Empty")) {
- company.setIndustry_code(company.getIndustry_name());
- } else {
- company.setIndustry_code(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRY_TYPE, company.getIndustry_code()));
- }
- modelMap.put("companyInfo", company);
- } else {
- if (Objects.equals(companyInfo.getIndustry_code(), "Empty")) {
- companyInfo.setIndustry_code(companyInfo.getIndustry_name());
- } else {
- companyInfo.setIndustry_code(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRY_TYPE, companyInfo.getIndustry_code()));
- }
- modelMap.put("companyInfo", companyInfo);
- }
- //modelMap.put("companyInfo", companyInfo == null ? new Company() : companyInfo);
- //工作小组可以看到进程反馈
- if (Arrays.asList(stockLandService.findUserIdByGroupName(Constant.XTGZXZ).split(",")).contains(String.valueOf(ShiroUtils.getUserId()))) {
- List<ProcessFeedback> feedbackList = processFeedbackService.findFeedbacksByTypeAndApplyId(Constant.DictionaryType.STOCKLAND, id);
- modelMap.put("feedbackList", feedbackList); //进程反馈信息
- }
- //判断登录人是否协调工作小组的人 是就显示打印按钮
- int currentId = ShiroUtils.getUserId();
- Group group = groupService.findByName(Constant.GroupName.UNITEDWORKGROUP, null);
- List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
- StringBuffer sb = new StringBuffer("");
- for (UserGroup userGroup : userGroups) {
- if (Objects.equals(userGroup.getUser_id(), currentId)) {
- modelMap.put("isGroup", "1");
- }
- }
- if (landApply.getApply_type().equals(Constant.LandApplyType.RENT)) {
- modelMap.put("isRent", true);
- //如果是租住管理 获取本街道的所有园区
- modelMap.put("parkList", parkService.findParkListByStreetId(ShiroUtils.getStreetId()));
- if (Objects.equals(landApply.getIs_in_park(), "1")) {
- Contract contract = icContractService.getDeatailById(landApply.getContract_id());
- if (contract == null) {
- modelMap.put("contract", new Contract());
- } else {
- modelMap.put("contract", contract);
- }
- } else if (Objects.equals(landApply.getIs_in_park(), "0")) {
- StockLandOutPark stockLandOutPark = stockLandOutParkService.findById(landApply.getContract_id());
- if (stockLandOutPark == null) {
- modelMap.put("stockLandOutPark", new StockLandOutPark());
- } else {
- modelMap.put("stockLandOutPark", stockLandOutPark);
- }
- }
- }
- return "/admin/government/areaManager/details";
- }
- /**
- * @param @param id
- * @param @param modelMap
- * @param @return
- * @return String 返回类型
- * @Title: details
- * @Description: TODO(待审核详情)
- * @author jiangjz
- */
- @OperationLog(value = "打印存量用地申请单据")
- @GetMapping(value = "print/{id}")
- public String print(@PathVariable("id") Integer id, ModelMap modelMap) {
- StockLand landApply = stockLandService.findLandApplyById(id);
- modelMap.put("landApply", landApply);
- Integer companyId = landApply.getCompany_id();
- /*Company companyInfo = new Company();
- if (null != companyId) {
- companyInfo = companyService.findById(companyId);
- }*/
- List<Approval> approvalList = approvalService.getApprovalList(id);
- //流程信息
- modelMap.put("approvalList", approvalList);
- //modelMap.put("companyInfo", companyInfo == null ? new Company() : companyInfo);
- //企业信息
- ProjectApplicationCompanyInfo companyInfo = projectApplicationCompanyInfoService.findByApplyIdAndType(id, Constant.DictionaryType.STOCKLAND);
- modelMap.put("companyInfo", companyInfo == null ? companyService.getCompanyInfo(landApply.getCompany_id()) : companyInfo);
- //工作小组可以看到进程反馈
- if (Arrays.asList(stockLandService.findUserIdByGroupName(Constant.XTGZXZ).split(",")).contains(ShiroUtils.getUserId())) {
- List<ProcessFeedback> feedbackList = processFeedbackService.findFeedbacksByTypeAndApplyId(Constant.DictionaryType.STOCKLAND, id);
- modelMap.put("feedbackList", feedbackList); //进程反馈信息
- }
- List<CompanyContact> contacts = companyContactService.findByCompanyId(companyId);
- CompanyContact contact = new CompanyContact();
- if (!CollectionUtils.isEmpty(contacts)) {
- contact = contacts.get(contacts.size() - 1);
- }
- modelMap.put("contact", contact);
- return "/admin/government/areaManager/print";
- }
- /**
- * @param @param id
- * @param @param modelMap
- * @param @return
- * @return String 返回类型
- * @Title: approval
- * @Description: TODO(审核页面)
- * @author jiangjz
- */
- @RequestMapping("approval")
- public String approval(@RequestParam(value = "id") int id, ModelMap modelMap) {
- StockLand landApply = stockLandService.findLandApplyById(id);
- modelMap.put("landApply", landApply);
- stockLandMaterialService.getApplyMaterials(landApply, modelMap);
- modelMap.put("fileUrl", setFileUrl());
- /*List<ProcessNodeDto> processNodes = stockLandService.getProcessNodes(landApply, false);
- modelMap.put("processNodesList", processNodes);*/
- Integer companyId = landApply.getCompany_id();
- /*Company companyInfo = new Company();
- if (null != companyId) {
- companyInfo = companyService.findById(companyId);
- }*/
- List<Approval> approvalList = approvalService.getApprovalList(id);
- //流程信息
- modelMap.put("approvalList", approvalList);
- //modelMap.put("companyInfo", companyInfo == null ? new Company() : companyInfo);
- //企业信息
- ProjectApplicationCompanyInfo companyInfo = projectApplicationCompanyInfoService.findByApplyIdAndType(id, Constant.DictionaryType.STOCKLAND);
- if (companyInfo == null) {
- Company company = companyService.getCompanyInfo(landApply.getCompany_id());
- if (Objects.equals(company.getIndustry_code(), "Empty")) {
- company.setIndustry_code(company.getIndustry_name());
- } else {
- company.setIndustry_code(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRY_TYPE, company.getIndustry_code()));
- }
- modelMap.put("companyInfo", company);
- } else {
- if (Objects.equals(companyInfo.getIndustry_code(), "Empty")) {
- companyInfo.setIndustry_code(companyInfo.getIndustry_name());
- } else {
- companyInfo.setIndustry_code(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRY_TYPE, companyInfo.getIndustry_code()));
- }
- modelMap.put("companyInfo", companyInfo);
- }
- //工作小组可以看到进程反馈
- if (Arrays.asList(stockLandService.findUserIdByGroupName(Constant.XTGZXZ).split(",")).contains(ShiroUtils.getUserId())) {
- List<ProcessFeedback> feedbackList = processFeedbackService.findFeedbacksByTypeAndApplyId(Constant.DictionaryType.STOCKLAND, id);
- modelMap.put("feedbackList", feedbackList); //进程反馈信息
- }
- return "/admin/government/areaManager/approval";
- }
- /**
- * 提交
- *
- * @param approval
- * @param apply_type
- * @param apply
- * @return
- */
- @OperationLog(value = "审核存量用地申请")
- @ResponseBody
- @RequestMapping("submit")
- public ResponseMessage submit(StockLandApprovalDto approval, Integer apply_type, StockLand apply, String departmentIds) {
- try {
- if (IsTooFrequently()) {
- return ResponseMessage.error("操作过于频繁,请稍后再试!");
- }
- //判断当前是否是审核人
- if (!stockLandApproveService.isCurrChecker(approval.getApply_id(), approval)) {
- return ResponseMessage.error("用户不是单据当前审核人!单据已被审核或撤回!");
- }
- return stockLandService.submit(approval, apply_type, apply, departmentIds);
- } catch (BaseException e) {
- e.printStackTrace();
- return ResponseMessage.error(e.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- return ResponseMessage.error("审核失败!");
- }
- }
- /**
- * 附件上传
- *
- * @param file
- * @param id
- * @return
- */
- @ResponseBody
- @RequestMapping("fileUpload")
- public Serializable fileUpload(@RequestParam(value = "files", required = false) MultipartFile file, int id) {
- try {
- stockLandService.fileUpload(id, file, baseFolderPath);
- return ResponseMessage.success("上传文件成功!");
- } catch (Exception e) {
- e.printStackTrace();
- return ResponseMessage.error("上传文件失败!");
- }
- }
- /*************************************************待审核结束********************************************************/
- /*************************************************已审核开始********************************************************/
- @OperationLog(value = "查看存量用地审核列表")
- @RequestMapping(value = "index1")
- public String index1(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, SearchCondition condition, StockLand searchCondition, String keyword, ModelMap modelMap) {
- PageInfo<StockLand> pageInfo = stockLandService.findApprovalPageInfo(pageNum, PAGESIZE, condition);
- modelMap.put("searchCondition", new StockLand());
- stockLandService.getDictInfo(modelMap);
- modelMap.put("pageInfo", pageInfo);
- modelMap.put("keyword", keyword);
- modelMap.put("searchCondition", searchCondition == null ? new StockLand() : searchCondition);
- return "/admin/government/areaManager/index1";
- }
- }
|