| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- package platform.modules.government.service;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.util.CollectionUtils;
- import platform.common.Constant;
- import platform.common.base.model.DictionaryItem;
- import platform.common.base.service.DictionaryItemService;
- import platform.modules.build.entity.Company;
- import platform.modules.build.service.CompanyService;
- import platform.modules.company.entity.*;
- import platform.modules.company.service.*;
- import platform.modules.government.dto.AffairsTrackingDto;
- import platform.modules.government.dto.CheckTrackingNum;
- import platform.modules.government.dto.SearchCondition;
- import platform.modules.government.dto.SelectDto;
- import platform.modules.government.entity.ProjectServiceType;
- import platform.modules.government.entity.ProjectType;
- import platform.modules.government.entity.User;
- import platform.modules.sys.entity.Approval;
- import platform.modules.sys.entity.Department;
- import platform.modules.sys.service.ApprovalService;
- import platform.modules.sys.service.DepartmentService;
- import java.util.ArrayList;
- import java.util.List;
- import org.springframework.ui.ModelMap;
- import platform.modules.government.dto.OrderTrackingDto;
- import javax.servlet.http.HttpServletResponse;
- import java.util.Objects;
- /**
- * 功能描述: 政务事务跟踪
- *
- * @param:
- * @return:
- * @auther: huZhiHao
- * @date: 2018/9/21 15:03
- */
- @Service
- public class AffairsTrackingService {
- @Autowired
- private DepartmentService departmentService;
- @Autowired
- private UserService userService;
- @Autowired
- private ApprovalService approvalService;
- @Autowired
- private StockLandService stockLandService;
- @Autowired
- private ProjectApplicationService projectApplicationService;
- @Autowired
- private ProjectProvincesService projectProvincesService;
- @Autowired
- private ProjectMattersService projectMattersService;
- @Autowired
- private ProjectFillingService projectFillingService;
- @Autowired
- private CompanyService companyService;
- @Autowired
- private DictionaryItemService dictionaryItemService;
- @Autowired
- private ProjectIntelligentService projectIntelligentService;
- @Autowired
- private ProjectDeclarationService projectDeclarationService;
- @Autowired
- private ProjectTypeService projectTypeService;
- @Autowired
- private ProjectServiceTypeService projectServiceTypeService;
- public PageInfo<AffairsTrackingDto> getDepartmentTrack(Integer pageNum, Integer pageSize) {
- List<AffairsTrackingDto> trackingDtoList = new ArrayList<>();
- // PageHelper.startPage(pageNum, Integer.MAX_VALUE);
- List<Department> departmentList = departmentService.findDepartment();
- if (departmentList != null && departmentList.size() > 0) {
- for (Department department : departmentList) {
- List<User> userList = userService.getAllDepartmentUsers(department.getId());
- if (userList != null && userList.size() > 0) {
- AffairsTrackingDto trackingDto = approvalService.getDepartmentTrack(userList);
- trackingDto.setDepartmentName(department.getName());
- trackingDto.setPersonNum(userList.size());
- trackingDto.setDeaprtmentId(department.getId());
- trackingDtoList.add(trackingDto);
- }
- }
- }
- // PageInfo<Department> departmentPageInfo = new PageInfo<>(departmentList);
- PageInfo<AffairsTrackingDto> affairsTrackingDtoPageInfo = new PageInfo<>(trackingDtoList);
- affairsTrackingDtoPageInfo.setPageSize(pageSize);
- affairsTrackingDtoPageInfo.setPageNum(pageNum);
- affairsTrackingDtoPageInfo.setList(trackingDtoList);
- return affairsTrackingDtoPageInfo;
- }
- /**
- * 按部门获取数据
- * @param departmentId
- * @return
- */
- public AffairsTrackingDto getTableView(Integer departmentId) {
- Department department = departmentService.selectById(departmentId);
- List<User> userList = userService.getAllDepartmentUsers(department.getId());
- AffairsTrackingDto trackingDto = new AffairsTrackingDto();
- trackingDto.setDepartmentName(department.getName());
- trackingDto.setDeaprtmentId(department.getId());
- if (userList != null && userList.size() > 0) {
- trackingDto = approvalService.getDepartmentTrack(userList);
- trackingDto.setDepartmentName(department.getName());
- trackingDto.setDeaprtmentId(department.getId());
- trackingDto.setPersonNum(userList.size());
- }
- else {
- trackingDto.setDepartmentName(department.getName());
- trackingDto.setDeaprtmentId(department.getId());
- trackingDto.setPersonNum(0);
- trackingDto.setTotalHandelNum(0);
- trackingDto.setFillingHandleNum(0);
- trackingDto.setProjectHandleNum(0);
- trackingDto.setStocklandHandleNum(0);
- trackingDto.setMattersHandleNum(0);
- trackingDto.setProvincesHandleNum(0);
- }
- return trackingDto;
- }
- public PageInfo<CheckTrackingNum> getTrackByUser(Integer pageNum, Integer pagesize, SearchCondition searchCondition) {
- List<CheckTrackingNum> checkTrackingNumList = new ArrayList<>();
- //按审核人查询
- List<User> userList;
- if (searchCondition.getCheckName() != null && !"".equals(searchCondition.getCheckName())) {
- userList = userService.getUserByName(searchCondition.getCheckName());
- if (userList != null && userList.size() > 0) {
- for (User user : userList) {
- CheckTrackingNum trackingDto = approvalService.getTrackByUser(user.getId());
- trackingDto.setCheckName(user.getUser_name());
- trackingDto.setUserId(user.getId());
- checkTrackingNumList.add(trackingDto);
- }
- }
- } else {
- PageHelper.startPage(pageNum, pagesize);
- userList = userService.getAllDepartmentUsers(searchCondition.getDepartmentId());
- if (userList != null && userList.size() > 0) {
- for (User user : userList) {
- searchCondition.setCheckName(user.getUser_name());
- searchCondition.setUserId(user.getId());
- CheckTrackingNum trackingDto = approvalService.getTrackByUser(user.getId());
- trackingDto.setCheckName(user.getUser_name());
- trackingDto.setUserId(user.getId());
- checkTrackingNumList.add(trackingDto);
- }
- }
- }
- PageInfo<CheckTrackingNum> pageInfo = new PageInfo<>(checkTrackingNumList);
- pageInfo.setTotal(userList.size());
- pageInfo.setPageNum(pageNum);
- pageInfo.setPageSize(pagesize);
- return pageInfo;
- }
- public PageInfo<CheckTrackingNum> getDocumentByUser (Integer pageNum, Integer pagesize, SearchCondition searchCondition){
- Integer userId = searchCondition.getUserId();
- User user = userService.findById(userId);
- searchCondition.setCheckName(user.getUser_name());
- //搜索条件查询
- String businessType = searchCondition.getBusinessType();
- if (businessType != null && !"".equals(businessType)){
- if (Objects.equals("1", businessType)) {
- searchCondition.setBusinessName(Constant.DictionaryType.PROJECT_APPLICATION);
- } else if (Objects.equals("2", businessType)) {
- searchCondition.setBusinessName(Constant.DictionaryType.PROJECT_PROVINCES);
- } else if (Objects.equals("3", businessType)) {
- searchCondition.setBusinessName(Constant.DictionaryType.PROJECT_FILLING);
- } else if (Objects.equals("4", businessType)) {
- searchCondition.setBusinessName(Constant.DictionaryType.PROJECT_MATTERS);
- } else if (Objects.equals("5", businessType)) {
- searchCondition.setBusinessName(Constant.DictionaryType.STOCKLAND);
- }
- }
- PageHelper.startPage(pageNum, pagesize);
- List<CheckTrackingNum> checkTrackingNumList = approvalService.getSearchDocumentByUser(searchCondition);
- // PageHelper.startPage(pageNum, pagesize);
- // List<Approval> approvalList = approvalService.getDocumentByUser(searchCondition);
- // if (approvalList != null && approvalList.size() > 0) {
- // for (Approval approval : approvalList) {
- // int applyId = approval.getApply_id();
- // CheckTrackingNum checkTrackingNum = new CheckTrackingNum();
- // checkTrackingNum.setCheckName(user.getUser_name());
- // checkTrackingNum.setApplyId(applyId);
- // //存量用地
- // if (approval.getType().equals(Constant.DictionaryType.STOCKLAND)) {
- // checkTrackingNum.setAffairsType(Constant.DictionaryType.STOCKLAND);
- // checkTrackingNum.setBusinessType(5);
- // StockLand stockLand = stockLandService.findById(applyId);
- // if (stockLand != null) {
- // checkTrackingNum.setApplyNo(stockLand.getApply_no());
- // Company company = companyService.findById(stockLand.getCompany_id());
- // checkTrackingNum.setCompany(company.getCompany_name());
- // //单据状态
- // DictionaryItem dictionaryItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.STOCKLAND_APPROVE_STATUS, stockLand.getApprove_status());
- // if (dictionaryItem != null) {
- // checkTrackingNum.setApplyStatus(dictionaryItem.getName());
- // }
- // }
- // checkTrackingNum.setApproveTime(approval.getDeal_time());
- // }
- // //区级工业经济扶持
- // if (approval.getType().equals(Constant.DictionaryType.PROJECT_APPLICATION)) {
- // checkTrackingNum.setAffairsType(Constant.DictionaryType.PROJECT_APPLICATION);
- // checkTrackingNum.setBusinessType(1);
- // ProjectApplication application = projectApplicationService.findById(approval.getApply_id());
- // if (application != null) {
- // checkTrackingNum.setApplyNo(application.getApply_no());
- // Company company = companyService.findById(application.getCompany_id());
- // checkTrackingNum.setCompany(company.getCompany_name());
- // //单据状态
- // DictionaryItem dictionaryItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_APPROVE_STATUS, application.getApprove_status());
- // if (dictionaryItem != null) {
- // checkTrackingNum.setApplyStatus(dictionaryItem.getName());
- // }
- // }
- // checkTrackingNum.setApproveTime(approval.getDeal_time());
- // }
- // //省市申报
- // if (approval.getType().equals(Constant.DictionaryType.PROJECT_PROVINCES)) {
- // checkTrackingNum.setAffairsType(Constant.DictionaryType.PROJECT_PROVINCES);
- // checkTrackingNum.setBusinessType(2);
- // ProjectProvinces projectProvinces = projectProvincesService.findById(approval.getApply_id());
- // if (projectProvinces != null) {
- // Company company = companyService.findById(projectProvinces.getCompany_id());
- // checkTrackingNum.setCompany(company.getCompany_name());
- // //单据状态
- // DictionaryItem dictionaryItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_PROVINCES_APPROVE_STATUS, projectProvinces.getApprove_status());
- // if (dictionaryItem != null) {
- // checkTrackingNum.setApplyStatus(dictionaryItem.getName());
- // }
- // }
- // checkTrackingNum.setApproveTime(approval.getDeal_time());
- // }
- // //服务事项
- // if (approval.getType().equals(Constant.DictionaryType.PROJECT_MATTERS)) {
- // checkTrackingNum.setAffairsType(Constant.DictionaryType.PROJECT_MATTERS);
- // checkTrackingNum.setBusinessType(4);
- // ProjectMatters projectMatters = projectMattersService.findById(approval.getApply_id());
- // if (projectMatters != null) {
- // Company company = companyService.findById(projectMatters.getCompany_id());
- // checkTrackingNum.setCompany(company.getCompany_name());
- // //单据状态
- // DictionaryItem dictionaryItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_MATTERS_APPROVE_STATUS, projectMatters.getApprove_status());
- // if (dictionaryItem != null) {
- // checkTrackingNum.setApplyStatus(dictionaryItem.getName());
- // }
- // }
- // checkTrackingNum.setApproveTime(approval.getDeal_time());
- // }
- // //报表填报
- // if (approval.getType().equals(Constant.DictionaryType.PROJECT_FILLING)) {
- // checkTrackingNum.setAffairsType(Constant.DictionaryType.PROJECT_FILLING);
- // checkTrackingNum.setBusinessType(3);
- // ProjectFilling projectFilling = projectFillingService.findById(approval.getApply_id());
- // if (projectFilling != null) {
- // Company company = companyService.findById(projectFilling.getCompany_id());
- // checkTrackingNum.setCompany(company.getCompany_name());
- // //单据状态
- // DictionaryItem dictionaryItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_FILLING_APPROVE_STATUS, projectFilling.getApprove_status());
- // if (dictionaryItem != null) {
- // checkTrackingNum.setApplyStatus(dictionaryItem.getName());
- // }
- // }
- // checkTrackingNum.setApproveTime(approval.getDeal_time());
- // }
- // checkTrackingNumList.add(checkTrackingNum);
- // }
- // }
- // PageInfo<Approval> approvalPageInfo = new PageInfo<>(approvalList);
- PageInfo<CheckTrackingNum> checkTrackingNumPageInfo = new PageInfo<>(checkTrackingNumList);
- // checkTrackingNumPageInfo.setTotal(approvalPageInfo.getTotal());
- // checkTrackingNumPageInfo.setList(checkTrackingNumList);
- // checkTrackingNumPageInfo.setPageNum(approvalPageInfo.getPageNum());
- // checkTrackingNumPageInfo.setPageSize(approvalPageInfo.getPageSize());
- // checkTrackingNumPageInfo.setPages(approvalPageInfo.getPages());
- return checkTrackingNumPageInfo;
- }
- /**
- * 功能描述: 单据跟踪
- *
- * @param:
- * @return:
- * @auther: huZhiHao
- * @date: 2018/9/25 17:55
- */
- public PageInfo<OrderTrackingDto> findOrderTrackingPage (Integer pageNum, Integer pagesize, String
- businessType, String typeId, String number, String companyName, String startDate, String endDate){
- return projectDeclarationService.findOrderTrackingPage(pageNum, pagesize, businessType, typeId, number, companyName, startDate, endDate);
- }
- /**
- * 功能描述:跳转到详情
- *
- * @param:
- * @return:
- * @auther: huZhiHao
- * @date: 2018/9/26 14:49
- */
- public String getOrderDetail(ModelMap modelMap, Integer id, String type) {
- if (Objects.equals("1", type)) {
- projectApplicationService.getApplyInfo(id, modelMap);
- projectApplicationService.getDictInfo(modelMap);
- projectDeclarationService.getMaterial(id, modelMap);
- return "project/apply_view";
- } else if (Objects.equals("2", type)) {
- projectProvincesService.getApplyInfo(id, modelMap);
- projectProvincesService.getDictInfo(modelMap);
- return "project_provinces/approve_check";
- } else if (Objects.equals("3", type)) {
- projectFillingService.getApplyInfo(id, modelMap);
- projectFillingService.getDictInfo(modelMap);
- return "project_filling/approve_check";
- } else if (Objects.equals("4", type)) {
- projectMattersService.getApplyInfo(id, modelMap);
- projectMattersService.getDictInfo(modelMap);
- return "project_matters/approve_check";
- } else if (Objects.equals("5", type)) {
- stockLandService.getApplyInfo(id, modelMap);
- stockLandService.getDictInfo(modelMap);
- return "stock_land/apply_check";
- }
- return null;
- }
- /**
- * 功能描述: 导出excel
- *
- * @param:
- * @return:
- * @auther: huZhiHao
- * @date: 2018/9/26 16:31
- */
- public void exportOrder(HttpServletResponse response, String businessType, String typeId, String number, String
- companyName, String startDate, String endDate) throws Exception {
- projectDeclarationService.exportOrder(response, businessType, typeId, number, companyName, startDate, endDate);
- }
- /**
- * 功能描述: 根据政务类型获取申请类别
- *
- * @param:
- * @return:
- * @auther: huZhiHao
- * @date: 2018/9/26 16:38
- */
- public List<SelectDto> getOrderType(String businessType) {
- List<SelectDto> selectList = new ArrayList<>();
- if (Objects.equals("1", businessType)) {
- List<ProjectType> projectTypeList = projectTypeService.selectAllProjectType();
- if (!CollectionUtils.isEmpty(projectTypeList)) {
- for (ProjectType projectType : projectTypeList) {
- SelectDto selectDto = new SelectDto();
- selectDto.setName(projectType.getType_name());
- selectDto.setId(projectType.getId());
- selectList.add(selectDto);
- }
- }
- } else if (Objects.equals("2", businessType)) {
- List<ProjectServiceType> list = projectServiceTypeService.findBySuperType("1");
- if (!CollectionUtils.isEmpty(list)) {
- for (ProjectServiceType projectServiceType : list) {
- SelectDto selectDto = new SelectDto();
- selectDto.setName(projectServiceType.getService_type_name());
- selectDto.setId(projectServiceType.getId());
- selectList.add(selectDto);
- }
- }
- } else if (Objects.equals("3", businessType)) {
- List<ProjectServiceType> list = projectServiceTypeService.findBySuperType("2");
- if (!CollectionUtils.isEmpty(list)) {
- for (ProjectServiceType projectServiceType : list) {
- SelectDto selectDto = new SelectDto();
- selectDto.setName(projectServiceType.getService_type_name());
- selectDto.setId(projectServiceType.getId());
- selectList.add(selectDto);
- }
- }
- } else if (Objects.equals("4", businessType)) {
- List<ProjectServiceType> list = projectServiceTypeService.findBySuperType("3");
- if (!CollectionUtils.isEmpty(list)) {
- for (ProjectServiceType projectServiceType : list) {
- SelectDto selectDto = new SelectDto();
- selectDto.setName(projectServiceType.getService_type_name());
- selectDto.setId(projectServiceType.getId());
- selectList.add(selectDto);
- }
- }
- } else if (Objects.equals("5", businessType)) {
- List<DictionaryItem> list = dictionaryItemService.findListByTypeName(Constant.DictionaryType.STOCKLAND);
- if (!CollectionUtils.isEmpty(list)) {
- for (DictionaryItem dictionaryItem : list) {
- SelectDto selectDto = new SelectDto();
- selectDto.setName(dictionaryItem.getName());
- selectDto.setId(Integer.parseInt(dictionaryItem.getValue()));
- selectList.add(selectDto);
- }
- }
- }
- return selectList;
- }
- public List<DictionaryItem> getApprovalStatus(String businessType) {
- List<DictionaryItem> dictionaryItems = new ArrayList<>();
- if (Objects.equals("1", businessType)) {
- dictionaryItems = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_APPROVE_STATUS);
- } else if (Objects.equals("2", businessType)) {
- dictionaryItems = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_PROVINCES_APPROVE_STATUS);
- } else if (Objects.equals("3", businessType)) {
- dictionaryItems = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_FILLING_APPROVE_STATUS);
- } else if (Objects.equals("4", businessType)) {
- dictionaryItems = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_MATTERS_APPROVE_STATUS);
- } else if (Objects.equals("5", businessType)) {
- dictionaryItems = dictionaryItemService.findListByTypeName(Constant.DictionaryType.STOCKLAND_APPROVE_STATUS);
- }
- return dictionaryItems;
- }
- }
|