ProjectMattersService.java 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. package platform.modules.company.service;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.aliyuncs.exceptions.ClientException;
  4. import com.github.pagehelper.PageHelper;
  5. import com.github.pagehelper.PageInfo;
  6. import org.apache.commons.lang3.StringUtils;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Service;
  9. import org.springframework.transaction.annotation.Transactional;
  10. import org.springframework.ui.ModelMap;
  11. import org.springframework.util.CollectionUtils;
  12. import platform.common.Constant;
  13. import platform.common.base.model.DictionaryItem;
  14. import platform.common.base.service.BaseService;
  15. import platform.common.base.service.DictionaryItemService;
  16. import platform.common.exception.BaseException;
  17. import platform.common.util.AlibabaSMSUtil;
  18. import platform.common.util.DateUtil;
  19. import platform.common.util.GenerateNoUtil;
  20. import platform.common.util.ShiroUtils;
  21. import platform.modules.build.entity.Company;
  22. import platform.modules.build.service.CompanyService;
  23. import platform.modules.company.dao.ProjectMattersDao;
  24. import platform.modules.company.dto.ProjectMattersSearchCondition;
  25. import platform.modules.company.dto.ProjectProvincesSearchCondition;
  26. import platform.modules.company.entity.*;
  27. import platform.modules.government.dao.AttachmentDao;
  28. import platform.modules.government.dao.ProjectMattersDeclarationDao;
  29. import platform.modules.government.dto.BusinessSearchDto;
  30. import platform.modules.government.dto.SearchCondition;
  31. import platform.modules.government.dto.StaticSearchCondition;
  32. import platform.modules.government.dto.StatisticView;
  33. import platform.modules.government.entity.*;
  34. import platform.modules.government.service.*;
  35. import platform.modules.sys.entity.*;
  36. import platform.modules.sys.service.*;
  37. import tk.mybatis.mapper.entity.Example;
  38. import java.text.SimpleDateFormat;
  39. import java.util.*;
  40. @Service
  41. @Transactional
  42. public class ProjectMattersService extends BaseService<ProjectMatters> {
  43. @Autowired
  44. private ProjectMattersDao projectMattersDao;
  45. @Autowired
  46. private AttachmentDao attachmentDao;
  47. @Autowired
  48. private DictionaryItemService dictionaryItemService;
  49. @Autowired
  50. private ProjectApplicationCompanyInfoService projectApplicationCompanyInfoService;
  51. @Autowired
  52. private ApprovalService approvalService;
  53. @Autowired
  54. private AttachmentService attachmentService;
  55. @Autowired
  56. private GroupService groupService;
  57. @Autowired
  58. private UserGroupService userGroupService;
  59. @Autowired
  60. private ProjectProvincesDeclarationService projectProvincesDeclarationService;
  61. @Autowired
  62. private CompanyService companyService;
  63. @Autowired
  64. private CompanyOprationsInfoService companyOprationsInfoService;
  65. @Autowired
  66. private ProjectApplicationOperationsInfoService projectApplicationOperationsInfoService;
  67. @Autowired
  68. private UserService userService;
  69. @Autowired
  70. private ProjectServiceCategoryService projectServiceCategoryService;
  71. @Autowired
  72. private MessageService messageService;
  73. @Autowired
  74. private WaitToDoService waitToDoService;
  75. @Autowired
  76. private StreetService streetService;
  77. @Autowired
  78. private DepartmentService departmentService;
  79. @Autowired
  80. private ProjectMattersDeclarationDao projectMattersDeclarationDao;
  81. @Autowired
  82. private ProjectServiceTypeService projectServiceTypeService;
  83. @Autowired
  84. private ProjectMattersDeclarationService projectMattersDeclarationService;
  85. public PageInfo<ProjectMatters> findPage(Integer pageNum, Integer pageSize, String keyword, ProjectMattersSearchCondition searchCondition) {
  86. searchCondition.setCompany_id(ShiroUtils.getCompanyId());
  87. PageHelper.startPage(pageNum, pageSize);
  88. List<ProjectMatters> applys = projectMattersDao.findByCondition(searchCondition);
  89. for (ProjectMatters projectApply : applys) {
  90. getFullInfo(projectApply);
  91. }
  92. return new PageInfo<ProjectMatters>(applys);
  93. }
  94. private void getFullInfo(ProjectMatters projectApply) {
  95. //服务项目大类
  96. String superType = projectApply.getService_super_type();
  97. if (StringUtils.isNotBlank(superType)) {
  98. if (projectApply.getCategory_id() != null) {
  99. ProjectServiceCategory projectServiceCategory = projectServiceCategoryService.findById(projectApply.getCategory_id());
  100. if (null != projectServiceCategory) {
  101. projectApply.setSuper_type_name(projectServiceCategory.getProject_type_name());
  102. }
  103. }
  104. }
  105. //项目来源
  106. String source = projectApply.getProject_source();
  107. if (StringUtils.isNotBlank(source)) {
  108. DictionaryItem sourceItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_SOURCE, source);
  109. if (null != sourceItem) {
  110. projectApply.setProject_source_name(sourceItem.getName());
  111. }
  112. }
  113. //单据状态
  114. String applyStatus = projectApply.getApply_status();
  115. if (null != applyStatus) {
  116. DictionaryItem sourceItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_MATTERS_APPLY_STATUS, applyStatus);
  117. if (null != sourceItem) {
  118. projectApply.setApply_status_name(sourceItem.getName());
  119. }
  120. if (projectApply.getApply_status().equals(Constant.ProjectMattersStatus_Company.PENDING_SUBMIT)
  121. || projectApply.getApply_status().equals(Constant.ProjectMattersStatus_Company.REJECT_TO_COMPANY)) {
  122. projectApply.setCanEdit(true);
  123. projectApply.setCanDelete(true);
  124. }
  125. }
  126. //获取项目名称
  127. if (null != projectApply.getDeclaration_id()) {
  128. Integer declarationId = projectApply.getDeclaration_id();
  129. if (declarationId > 0) {
  130. ProjectMattersDeclaration dec = projectMattersDeclarationService.findById(declarationId);
  131. if (null != dec) {
  132. projectApply.setProject_name(dec.getProject_name());
  133. if (Objects.equals("1", dec.getIs_comprehensive())) {
  134. projectApply.setIs_comprehensive(true);
  135. } else {
  136. projectApply.setIs_comprehensive(false);
  137. }
  138. //项目来源
  139. DictionaryItem sourceItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_SOURCE, dec.getProject_source());
  140. if (null != sourceItem) {
  141. projectApply.setProject_source_name(sourceItem.getName());
  142. }
  143. }
  144. }
  145. }
  146. }
  147. public void getDictInfo(ModelMap modelMap) {
  148. //项目大类
  149. // List<DictionaryItem> superTypeList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_SERVICE_SUPER_TYPE);
  150. // modelMap.put("superTypeList", superTypeList);
  151. //项目来源
  152. List<DictionaryItem> projectSourceList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_SOURCE);
  153. modelMap.put("projectSourceList", projectSourceList);
  154. // 单据状态
  155. List<DictionaryItem> projectStatusList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.PROJECT_MATTERS_APPROVE_STATUS);
  156. modelMap.put("projectApprovalList", projectStatusList);
  157. //查询行业类型
  158. List<DictionaryItem> industryTypeList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.INDUSTRY_TYPE);
  159. modelMap.put("industryTypeList", industryTypeList);
  160. //查询币种单位数据
  161. List<DictionaryItem> currencyList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.CURRENCY_UNIT);
  162. modelMap.put("currencyList", currencyList);
  163. }
  164. //根据id获取项目填报信息
  165. public ModelMap getApplyInfo(Integer apply_id, ModelMap modelMap) {
  166. ProjectMatters projectApply = findById(apply_id);
  167. ProjectMattersDeclaration projectMattersDeclaration = projectMattersDeclarationService.selectById(projectApply.getDeclaration_id() + "");
  168. projectApply.setService_type_name(projectMattersDeclaration.getProject_service_type_name());
  169. if (null != projectApply.getCategory_id()) {
  170. ProjectServiceCategory projectServiceCategory = projectServiceCategoryService.findById(projectApply.getCategory_id());
  171. if (projectServiceCategory != null) {
  172. projectApply.setCategory_id_name(projectServiceCategory.getProject_type_name());
  173. }
  174. }
  175. if (null != projectApply.getProject_id()) {
  176. ProjectServiceCategory projectServiceCategory = projectServiceCategoryService.findById(projectApply.getProject_id());
  177. if (projectServiceCategory != null) {
  178. projectApply.setProject_id_name(projectServiceCategory.getProject_type_name());
  179. }
  180. }
  181. modelMap.put("projectApply", projectApply);
  182. //服务项目大类
  183. List<ProjectServiceCategory> projectServiceList = projectServiceCategoryService.findProjectServiceList(
  184. Constant.DictionaryType.PROJECT_MATTERS, projectApply.getDeclaration_id());
  185. modelMap.put("superTypeList", projectServiceList);
  186. //获取相应大类的小类
  187. List<ProjectServiceCategory> projectNameList = projectServiceCategoryService.findProjectNameList(
  188. projectApply.getDeclaration_id(), projectApply.getCategory_id());
  189. if (CollectionUtils.isEmpty(projectNameList) && !CollectionUtils.isEmpty(projectServiceList)) {
  190. projectNameList = projectServiceCategoryService.findProjectNameList(
  191. projectApply.getDeclaration_id(), projectServiceList.get(0).getId());
  192. }
  193. modelMap.put("projectNameList", projectNameList);
  194. getFullInfo(projectApply);
  195. //文件(申报材料)
  196. List<ProjectMaterial> projectMaterialList = new ArrayList<>();
  197. List<Attachment> attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.PROJECT_MATTERS, projectApply.getId(), null);
  198. ProjectMaterial material = new ProjectMaterial();
  199. if (null != attachments && attachments.size() > 0) {
  200. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  201. projectApply.setFileDown(fileDown);
  202. material.setFileDown(fileDown);
  203. projectMaterialList.add(material);
  204. } else {
  205. projectApply.setFileDown(new FileDown());
  206. }
  207. modelMap.put("applyMaterials", projectMaterialList);
  208. modelMap.put("projectApply", projectApply);
  209. //企业信息
  210. ProjectApplicationCompanyInfo companyInfo = projectApplicationCompanyInfoService.findByApplyIdAndType(apply_id, Constant.DictionaryType.PROJECT_MATTERS);
  211. if (companyInfo == null) {
  212. companyInfo = projectApplicationCompanyInfoService.getCompanyInfoByCompanyId(projectApply.getCompany_id());
  213. } else {
  214. if (!Objects.equals(companyInfo.getIndustry_code(), "Empty")) {
  215. companyInfo.setIndustry_code(companyInfo.getIndustry_code());
  216. companyInfo.setIndustry_name(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRY_TYPE, companyInfo.getIndustry_code()));
  217. }
  218. }
  219. modelMap.put("companyInfo", companyInfo);
  220. //经营数据
  221. modelMap.put("operationsInfo", getOperationsInfo(null, projectApply));
  222. //项目填报流程
  223. List<Approval> approvalList = approvalService.getProjectMattersApprovalList(apply_id);
  224. modelMap.put("approvalList", approvalList); //流程信息
  225. return modelMap;
  226. }
  227. //项目填报保存
  228. public Boolean saveProjectApply(ProjectMatters apply) throws ClientException, InterruptedException {
  229. ProjectMattersDeclaration declaration = projectMattersDeclarationService.findById(apply.getDeclaration_id());
  230. apply.setCompany_id(ShiroUtils.getCompanyId());
  231. String no = GenerateNoUtil.generateProjectApplyNo(Constant.ProjectNoHeader.PROJECT_MATTERS);
  232. apply.setApply_no(no);
  233. if (apply.getIsDraft().equals(Constant.IsDraft.DRAFT)) {
  234. //保存草稿
  235. apply.setApply_status(Constant.ProjectMattersStatus_Company.PENDING_SUBMIT);
  236. } else if (apply.getIsDraft().equals(Constant.IsDraft.NOT_DRAFT)) {
  237. //提交申请
  238. if (declaration != null && declaration.getIs_street_audit().equals("1")) {
  239. apply.setApply_status(Constant.ProjectMattersStatus_Company.IN_AUDIT);
  240. apply.setApprove_status(Constant.ProjectMattersStatus.LOCAL_AUDIT);
  241. } else {
  242. apply.setApply_status(Constant.ProjectMattersStatus_Company.IN_AUDIT);
  243. apply.setApprove_status(Constant.ProjectMattersStatus.CENTRE_AUDIT);
  244. }
  245. //申请日期
  246. apply.setApply_date(DateUtil.getTimeStringShort(new Date()));
  247. //提交申请,同步数据至企业信息表和企业经营数据表
  248. copyCompanyData(apply);
  249. }
  250. Boolean flag = this.insertAndGetId(apply) > 0;
  251. if (flag) {
  252. //保存企业基本信息
  253. if (null != apply.getCompanyInfo()) {
  254. ProjectApplicationCompanyInfo companyInfo = apply.getCompanyInfo();
  255. companyInfo.setApply_type(Constant.DictionaryType.PROJECT_MATTERS);
  256. companyInfo.setApply_id(apply.getId());
  257. projectApplicationCompanyInfoService.saveSelective(companyInfo);
  258. }
  259. //保存经营信息
  260. if (null != apply.getOperationsInfo() && apply.getOperationsInfo().size() > 0) {
  261. List<ProjectApplicationOperationsInfo> operationsInfoList = apply.getOperationsInfo();
  262. for (ProjectApplicationOperationsInfo info : operationsInfoList) {
  263. info.setApply_id(apply.getId());
  264. info.setApply_type(Constant.DictionaryType.PROJECT_MATTERS);
  265. projectApplicationOperationsInfoService.saveSelective(info);
  266. }
  267. }
  268. //保存材料
  269. if (null != apply.getFileDown() && null != apply.getFileDown().getFile_id()) {
  270. attachmentDao.updateAttachment(Constant.Attachment.PROJECT_MATTERS, apply.getId(), apply.getFileDown().getFile_id());
  271. }
  272. //草稿
  273. if (apply.getIsDraft().equals(Constant.IsDraft.NOT_DRAFT)) {
  274. //直接提交申请,添加流程信息
  275. Approval approval = new Approval();
  276. approval.setApply_id(apply.getId());
  277. approval.setApproval_round(1);
  278. // approval.setAfter_approvalstatus(apply.getApprove_status());
  279. String centerCheckers;
  280. if (declaration != null && declaration.getIs_street_audit().equals("1")) {
  281. centerCheckers = getStreetChecker();
  282. approval.setAfter_approvalstatus(Constant.ProjectMattersStatus.LOCAL_AUDIT);
  283. } else {
  284. centerCheckers = getNestChecker(Constant.FWSXZX, Constant.UserType.GOVERNMENT);
  285. approval.setAfter_approvalstatus(Constant.ProjectMattersStatus.CENTRE_AUDIT);
  286. if (StringUtils.isBlank(centerCheckers)) {
  287. throw new BaseException("服务事项填报材料受理组不存在审核人,请联系政府管理员配置。");
  288. }
  289. }
  290. approval.setNextchecker(centerCheckers);
  291. approval.setChecker(ShiroUtils.getUserId());
  292. approval.setType(Constant.DictionaryType.PROJECT_MATTERS);
  293. approval.setOper_type(Constant.OperType.SUBMIT);
  294. approval.setDepartment(ShiroUtils.getUserEntity().getCompany_name());
  295. approvalService.insertAndGetId(approval);
  296. //发送消息
  297. saveMessage(apply);
  298. //发送短信
  299. Map<String, String> params = new HashMap<>();
  300. params.put("project_no", no);
  301. params.put("apply_name", Constant.ProjectType.PROJECT_MATTERS);
  302. String tempateCode = Constant.SMS_TemplateCode.RPOJECT_APPLY_SUBMIT;
  303. String paramStr = JSONObject.toJSONString(params);
  304. User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
  305. AlibabaSMSUtil.sendSMS(
  306. companyAdmin.getPhone(), tempateCode, Constant.SINGNAMW, paramStr);
  307. }
  308. }
  309. return flag;
  310. }
  311. //项目填报更新
  312. public void updateProjectApply(ProjectMatters apply) throws ClientException, InterruptedException {
  313. ProjectMattersDeclaration declaration = projectMattersDeclarationService.findById(apply.getDeclaration_id());
  314. // //更新项目类别
  315. // ProjectServiceCategory category = projectServiceCategoryService.findById(apply.getProject_id());
  316. // if (category != null){
  317. // apply.setProject_type_name(category.getProject_type_name());
  318. // }
  319. if (apply.getIsDraft().equals(Constant.IsDraft.NOT_DRAFT)) {
  320. User user = userService.findById(ShiroUtils.getUserId());
  321. apply.setCompany_id(user.getCompany_id());
  322. //提交申请
  323. if (declaration != null && declaration.getIs_street_audit().equals("1")) {
  324. apply.setApply_status(Constant.ProjectMattersStatus_Company.IN_AUDIT);
  325. apply.setApprove_status(Constant.ProjectMattersStatus.LOCAL_AUDIT);
  326. } else {
  327. apply.setApply_status(Constant.ProjectMattersStatus_Company.IN_AUDIT);
  328. apply.setApprove_status(Constant.ProjectMattersStatus.CENTRE_AUDIT);
  329. }
  330. //申请日期
  331. if (StringUtils.isBlank(apply.getApply_date())) {
  332. apply.setApply_date(DateUtil.getTimeStringShort(new Date()));
  333. }//申请单号
  334. if (StringUtils.isBlank(apply.getApply_no())) {
  335. String no = GenerateNoUtil.generateProjectApplyNo(Constant.ProjectNoHeader.PROJECT_MATTERS);
  336. apply.setApply_no(no);
  337. }
  338. //提交申请,同步数据至企业信息表和企业经营数据表
  339. copyCompanyData(apply);
  340. saveMessage(apply);
  341. }
  342. if (this.updateSelective(apply) > 0) {
  343. //保存企业基本信息
  344. if (null != apply.getCompanyInfo()) {
  345. projectApplicationCompanyInfoService.updateSelective(apply.getCompanyInfo());
  346. }
  347. //保存经营信息
  348. if (null != apply.getOperationsInfo() && apply.getOperationsInfo().size() > 0) {
  349. List<ProjectApplicationOperationsInfo> operationsInfoList = apply.getOperationsInfo();
  350. for (ProjectApplicationOperationsInfo info : operationsInfoList) {
  351. projectApplicationOperationsInfoService.updateSelective(info);
  352. }
  353. }
  354. //保存材料
  355. if (null != apply.getFileDown() && null != apply.getFileDown().getFile_id()) {
  356. List<Attachment> attachments = attachmentDao.selectByIdAndBusinessId(Constant.Attachment.PROJECT_PROVINCES, apply.getId(), apply.getFileDown().getFile_id());
  357. if (attachments.size() == 0) {
  358. //size为0,则是重新上传的文件,更新附件
  359. attachmentDao.deleteByBusiness(Constant.Attachment.PROJECT_MATTERS, apply.getId());
  360. attachmentDao.updateAttachment(Constant.Attachment.PROJECT_MATTERS, apply.getId(), apply.getFileDown().getFile_id());
  361. }
  362. }
  363. if (apply.getIsDraft().equals(Constant.IsDraft.NOT_DRAFT)) {
  364. Approval latestApproval = approvalService.getLatestApproval(apply.getId(), Constant.DictionaryType.PROJECT_MATTERS);
  365. //直接提交申请,添加流程信息
  366. Approval approval = new Approval();
  367. approval.setApply_id(apply.getId());
  368. approval.setAfter_approvalstatus(apply.getApprove_status());
  369. String centerCheckers = getCenterChecker();
  370. if (StringUtils.isBlank(centerCheckers)) {
  371. throw new BaseException("项目填报材料受理组不存在审核人,请联系政府管理员配置。");
  372. }
  373. approval.setNextchecker(centerCheckers);
  374. approval.setChecker(ShiroUtils.getUserId());
  375. approval.setType(Constant.DictionaryType.PROJECT_MATTERS);
  376. approval.setDepartment(ShiroUtils.getUserEntity().getCompany_name());
  377. if (null == latestApproval) {
  378. //还没提交
  379. approval.setOper_type(Constant.OperType.SUBMIT);
  380. approval.setApproval_round(1);
  381. } else {
  382. //退回编辑
  383. approval.setBefore_approvalstatus(latestApproval.getAfter_approvalstatus());
  384. approval.setOper_type(Constant.OperType.EDIT);
  385. approval.setApproval_round(latestApproval.getApproval_round() == null ? 1 : latestApproval.getApproval_round() + 1);
  386. }
  387. approvalService.insertAndGetId(approval);
  388. }
  389. //发送短信
  390. Map<String, String> params = new HashMap<>();
  391. params.put("project_no", apply.getApply_no());
  392. params.put("apply_name", Constant.ProjectType.PROJECT_MATTERS);
  393. String tempateCode = Constant.SMS_TemplateCode.RPOJECT_APPLY_SUBMIT;
  394. String paramStr = JSONObject.toJSONString(params);
  395. User companyAdmin = userService.findCompanyAdmin(apply.getCompany_id());
  396. AlibabaSMSUtil.sendSMS(
  397. companyAdmin.getPhone(), tempateCode, Constant.SINGNAMW, paramStr);
  398. }
  399. }
  400. public String getCenterChecker() {
  401. //根据工作组名称查出工作组
  402. Group group = groupService.findByNameAndUserType(Constant.SSSBZX, null, Constant.UserType.GOVERNMENT, null);
  403. //如果不为空
  404. if (null != group) {
  405. //根据工作组id查出UserGroup
  406. List<UserGroup> list = userGroupService.findByGroupId(group.getId());
  407. if (null == list || list.size() == 0) {
  408. return null;
  409. }
  410. StringBuffer sb = new StringBuffer("");
  411. for (UserGroup userGroup : list) {
  412. Integer userId = userGroup.getUser_id();
  413. sb.append(userId + ",");
  414. }
  415. return sb.toString();
  416. }
  417. return null;
  418. }
  419. public String getNestChecker(String groupName, Integer userType) {
  420. //根据工作组名称查出工作组
  421. Group group = groupService.findByNameAndUserType(groupName, null, userType, null);
  422. //如果不为空
  423. if (null != group) {
  424. //根据工作组id查出UserGroup
  425. List<UserGroup> list = userGroupService.findByGroupId(group.getId());
  426. if (null == list || list.size() == 0) {
  427. return null;
  428. }
  429. StringBuffer sb = new StringBuffer("");
  430. for (UserGroup userGroup : list) {
  431. Integer userId = userGroup.getUser_id();
  432. sb.append(userId + ",");
  433. }
  434. return sb.toString();
  435. }
  436. return null;
  437. }
  438. public String getStreetChecker() {
  439. User currUser = ShiroUtils.getUserEntity();
  440. StringBuffer sb = new StringBuffer("");
  441. List<User> userList = userService.findUsersByStreetId(currUser.getStreet_id());
  442. //Group group = groupService.findByName(Constant.FWSXJD, null);
  443. Group group = groupService.findByNameAndUserType(Constant.FWSXJD, null, Constant.UserType.STREET, ShiroUtils.getStreetId());
  444. if (null == group) {
  445. throw new BaseException("操作失败,服务事项街道没有该项目责任单位的审核人员,请联系管理员配置");
  446. }
  447. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  448. if (userList != null && userList.size() > 0) {
  449. for (User user : userList) {
  450. for (UserGroup userGroup : userGroups) {
  451. if (Objects.equals(userGroup.getUser_id(), user.getId())) {
  452. Integer userId = user.getId();
  453. sb.append(userId + ",");
  454. }
  455. }
  456. }
  457. }
  458. return sb.toString();
  459. }
  460. public ProjectFilling initFilling(Integer declarationId) {
  461. ProjectFilling projectApply = new ProjectFilling();
  462. ProjectProvincesDeclaration dec = projectProvincesDeclarationService.selectById(String.valueOf(declarationId));
  463. if (null != dec) {
  464. projectApply.setService_type_name(dec.getProject_service_type_name());
  465. }
  466. return projectApply;
  467. }
  468. //是否已经填报过
  469. /*public Boolean isExistFilling(ProjectFilling apply) {
  470. List<ProjectFilling> existFilling = projectProvincesDao.findExistFilling(apply);
  471. if (null != existFilling && existFilling.size() > 0) {
  472. return true;
  473. }
  474. return false;
  475. }*/
  476. /**
  477. * 获取对应项目填报的填报企业数
  478. *
  479. * @param id
  480. * @return
  481. */
  482. /* public Integer getQuantityByDeclarationId(String id) {
  483. Example example = new Example(ProjectFilling.class);
  484. Example.Criteria criteria = example.createCriteria();
  485. criteria.andEqualTo("del_flag", "0");
  486. criteria.andEqualTo("declaration_id", id);
  487. criteria.andNotEqualTo("apply_status", Constant.ProjectFillingStatus_Company.PENDING_SUBMIT);
  488. List<ProjectFilling> list = this.selectByExample(example);
  489. if (CollectionUtils.isEmpty(list)) {
  490. return 0;
  491. }
  492. return list.size();
  493. }*/
  494. public PageInfo<ProjectMatters> findPageById(Integer pageNum, Integer pageSize, String id) {
  495. PageHelper.startPage(pageNum, pageSize);
  496. String streetId = "";
  497. if (Objects.equals(ShiroUtils.getUserType(), Constant.UserType.STREET)) {
  498. streetId = ShiroUtils.getStreetId() + "";
  499. }
  500. List<ProjectMatters> applys = projectMattersDao.findPageById(id, streetId);
  501. for (ProjectMatters projectApply : applys) {
  502. getFullInfo(projectApply);
  503. }
  504. return new PageInfo<ProjectMatters>(applys);
  505. }
  506. public PageInfo<ProjectMatters> findPageByIdAndApproveStatus(Integer pageNum, Integer pageSize, String id, String approve_status) {
  507. PageHelper.startPage(pageNum, pageSize);
  508. String streetId = "";
  509. if (Objects.equals(ShiroUtils.getUserType(), Constant.UserType.STREET)) {
  510. streetId = ShiroUtils.getStreetId() + "";
  511. }
  512. List<ProjectMatters> applys = projectMattersDao.findPageByIdAndApproveStatus(id, streetId, approve_status);
  513. for (ProjectMatters projectApply : applys) {
  514. getFullInfo(projectApply);
  515. }
  516. return new PageInfo<ProjectMatters>(applys);
  517. }
  518. public List<ProjectMatters> findListById(String id) {
  519. String streetId = "";
  520. if (Objects.equals(ShiroUtils.getUserType(), Constant.UserType.STREET)) {
  521. streetId = ShiroUtils.getStreetId() + "";
  522. }
  523. List<ProjectMatters> applys = projectMattersDao.findPageById(id, streetId);
  524. for (ProjectMatters projectApply : applys) {
  525. getFullInfo(projectApply);
  526. }
  527. return applys;
  528. }
  529. public List<ProjectMatters> findListByIdAndApproveStatus(String id, String approve_status) {
  530. String streetId = "";
  531. if (Objects.equals(ShiroUtils.getUserType(), Constant.UserType.STREET)) {
  532. streetId = ShiroUtils.getStreetId() + "";
  533. }
  534. List<ProjectMatters> applys = projectMattersDao.findPageByIdAndApproveStatus(id, streetId, approve_status);
  535. for (ProjectMatters projectApply : applys) {
  536. getFullInfo(projectApply);
  537. }
  538. return applys;
  539. }
  540. public List<ProjectMatters> selectByDeclarationIdAndCompanyId(Integer did, Integer cid) {
  541. Example example = new Example(ProjectMatters.class);
  542. Example.Criteria criteria = example.createCriteria();
  543. criteria.andEqualTo("declaration_id", did);
  544. criteria.andEqualTo("company_id", cid);
  545. //倒序
  546. example.orderBy("create_time").desc();
  547. return this.selectByExample(example);
  548. }
  549. private void copyCompanyData(ProjectMatters apply) {
  550. //同步企业基本信息
  551. ProjectApplicationCompanyInfo companyInfo = apply.getCompanyInfo();
  552. Company preCompanyInfo = companyService.findById(companyInfo.getCompany_id());
  553. if (StringUtils.isNotBlank(companyInfo.getCompany_name())) {
  554. preCompanyInfo.setCompany_name(companyInfo.getCompany_name());
  555. }
  556. if (StringUtils.isNotBlank(companyInfo.getRegistration_address())) {
  557. preCompanyInfo.setRegistration_address(companyInfo.getRegistration_address());
  558. }
  559. if (null != companyInfo.getCurrency_unit()) {
  560. preCompanyInfo.setCurrency_unit(companyInfo.getCurrency_unit());
  561. }
  562. if (null != companyInfo.getRegistration_capital()) {
  563. preCompanyInfo.setRegistration_capital(companyInfo.getRegistration_capital());
  564. }
  565. if (StringUtils.isNotBlank(companyInfo.getLegal_representative())) {
  566. preCompanyInfo.setLegal_representative(companyInfo.getLegal_representative());
  567. }
  568. if (StringUtils.isNotBlank(companyInfo.getLr_position())) {
  569. preCompanyInfo.setLr_position(companyInfo.getLr_position());
  570. }
  571. companyService.updateSelective(preCompanyInfo);
  572. //同步企业营业收入
  573. // List<ProjectApplicationOperationsInfo> operationsInfo = apply.getOperationsInfo();
  574. // for (ProjectApplicationOperationsInfo info : operationsInfo) {
  575. // if (null != info.getOperation_income()) {
  576. // CompanyOprationsInfo preInfo = companyOprationsInfoService.findCompanyOprationsByCidAndYear(companyInfo.getCompany_id(), String.valueOf(com.feilong.core.date.DateUtil.getYear(new Date())), Constant.DictionaryType.PROJECT_MATTERS);
  577. // if (null != preInfo) {
  578. // preInfo.setOperation_income(Double.parseDouble(info.getOperation_income()));
  579. // companyOprationsInfoService.updateSelective(preInfo);
  580. // }
  581. // }
  582. // }
  583. }
  584. public ProjectMattersDeclaration selectById(ProjectMatters projectMatters) {
  585. ProjectMattersDeclaration projectDeclaration = projectMattersDeclarationDao.selectById(projectMatters.getDeclaration_id().toString());
  586. //责任单位
  587. if (null != projectDeclaration.getDepartment_id() && !projectDeclaration.getDepartment_id().equals("")) {
  588. Department dept = departmentService.findById(Integer.parseInt(projectDeclaration.getDepartment_id()));
  589. if (null != dept) {
  590. projectDeclaration.setDepartment_name(dept.getName());
  591. }
  592. }
  593. // //项目大类
  594. // String superType = projectDeclaration.getProject_service_type();
  595. // if (StringUtils.isNotBlank(superType)) {
  596. // DictionaryItem superTypeItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_SERVICE_SUPER_TYPE, superType);
  597. // if (null != superTypeItem) {
  598. // projectDeclaration.setProject_type_name(superTypeItem.getName());
  599. // }
  600. // }
  601. //服务事项
  602. String serviceType = projectDeclaration.getProject_service_type();
  603. if (StringUtils.isNotBlank(serviceType)) {
  604. List<ProjectServiceType> projectServiceTypeList = projectServiceTypeService.findById(serviceType);
  605. if (!CollectionUtils.isEmpty(projectServiceTypeList)) {
  606. projectDeclaration.setProject_service_type_name(projectServiceTypeList.get(0).getService_type_name());
  607. }
  608. }
  609. //项目来源
  610. String source = projectDeclaration.getProject_source();
  611. if (StringUtils.isNotBlank(source)) {
  612. DictionaryItem sourceItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_SOURCE, source);
  613. if (null != sourceItem) {
  614. projectDeclaration.setProject_source_name(sourceItem.getName());
  615. }
  616. }
  617. //文件
  618. List<Attachment> attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.PROJECT_MATTERS, projectMatters.getId(), null);
  619. if (null != attachments && attachments.size() > 0) {
  620. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  621. projectDeclaration.setFileDown(fileDown);
  622. }
  623. // String companyIds = projectDeclaration.getPush_company_ids();
  624. // String[] companyIdsArr = companyIds.split(",");
  625. // projectDeclaration.setTotal(companyIdsArr.length);
  626. // projectDeclaration.setCount(getQuantityByDeclarationId(projectDeclaration.getId().toString()));
  627. // try {
  628. // projectDeclaration = getPushNames(projectDeclaration);
  629. // } catch (Exception e) {
  630. // e.printStackTrace();
  631. // }
  632. return projectDeclaration;
  633. }
  634. /**
  635. * 获取省市申报列表
  636. *
  637. * @param pageNum
  638. * @param pageSize
  639. * @param keyword
  640. * @param searchCondition
  641. * @return
  642. */
  643. public PageInfo<ProjectMatters> findProvincesPage(Integer pageNum, Integer pageSize, String keyword, ProjectProvincesSearchCondition searchCondition) {
  644. if (ShiroUtils.getUserType().equals(Constant.UserType.COMPANY)) {
  645. Integer companyId = ShiroUtils.getCompanyId();
  646. if (null != companyId) {
  647. searchCondition.setCompanyId(companyId);
  648. }
  649. }
  650. if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
  651. Integer streetId = ShiroUtils.getStreetId();
  652. if (null != streetId) {
  653. searchCondition.setStreetId(streetId);
  654. }
  655. }
  656. //倒序
  657. PageHelper.startPage(pageNum, pageSize);
  658. List<ProjectMatters> projectProvincesList = projectMattersDao.findProvincesList(searchCondition);
  659. for (ProjectMatters projectApply : projectProvincesList) {
  660. getFullInfo(projectApply);
  661. }
  662. return new PageInfo<ProjectMatters>(projectProvincesList);
  663. }
  664. /**
  665. * 已经申请的取项目申报的新数据,新增申请时根据Companyid查询
  666. *
  667. * @param companyId
  668. * @param apply
  669. * @return
  670. */
  671. public List<ProjectApplicationOperationsInfo> getOperationsInfo(Integer companyId, ProjectMatters apply) {
  672. if (null != apply) {
  673. ProjectApplication projectApplication = new ProjectApplication();
  674. projectApplication.setId(apply.getId());
  675. //已经申请的取新数据
  676. List<ProjectApplicationOperationsInfo> infos = projectApplicationOperationsInfoService.findOperationsInfoByApply(projectApplication, Constant.DictionaryType.PROJECT_MATTERS);
  677. return infos;
  678. } else {
  679. List<ProjectApplicationOperationsInfo> operationsInfo = new ArrayList<ProjectApplicationOperationsInfo>();
  680. int year = com.feilong.core.date.DateUtil.getYear(new Date());
  681. for (int i = 1; i <= 3; i++) {
  682. int dataYear = year - i;
  683. ProjectApplicationOperationsInfo info = new ProjectApplicationOperationsInfo();
  684. info.setCid(companyId);
  685. info.setYear(String.valueOf(dataYear));
  686. //企业在数据填报处已经填报的经营信息,带出来
  687. CompanyOprationsInfo beforeInfo = companyOprationsInfoService.findCompanyOprationsByCidAndYear(companyId, String.valueOf(dataYear), Constant.DictionaryType.PROJECT_MATTERS);
  688. if (null != beforeInfo) {
  689. info.setCurrOperationInfoId(beforeInfo.getId());
  690. if (beforeInfo.getOperation_income() != null) {
  691. info.setOperation_income(beforeInfo.getOperation_income().toString());
  692. }
  693. }
  694. operationsInfo.add(info);
  695. }
  696. return operationsInfo;
  697. }
  698. }
  699. private void saveMessage(ProjectMatters apply) {
  700. Message messages = new Message();
  701. messages.setApply_id(apply.getId());
  702. messages.setTitle("企业提交服务事项");
  703. ProjectMattersDeclaration declaration = projectMattersDeclarationService.findById(apply.getDeclaration_id());
  704. String projectName = declaration.getProject_name();
  705. SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日");
  706. String now = sdf2.format(new Date());
  707. String message = ShiroUtils.getUserName() + ",您好。您于“" + now + "”提交的“" + projectName + "服务事项”的申请已提交,进入审核流程。";
  708. messages.setContent(message);
  709. messages.setBusiness_type(Constant.Message_Business_type.PROJECT_MATTERS_APPLY);
  710. String[] streetArr = ShiroUtils.getCompanyId().toString().split(",");
  711. Set<String> set = new HashSet<>();
  712. for (int i = 0; i < streetArr.length; i++) {
  713. set.add(streetArr[i]);
  714. }
  715. String[] streetArrs = (String[]) set.toArray(new String[set.size()]);
  716. int[] streetArrInt = new int[streetArrs.length];
  717. for (int i = 0; i < streetArrs.length; i++) {
  718. streetArrInt[i] = Integer.parseInt(streetArrs[i]);
  719. }
  720. messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.COMPANY);
  721. Company company = companyService.findById(ShiroUtils.getCompanyId());
  722. waitToDoService.completeAllTODO(apply.getId(), Constant.DictionaryType.PROJECT_MATTERS);
  723. Message messages1 = new Message();
  724. messages1.setApply_id(apply.getId());
  725. messages1.setBusiness_type(Constant.Message_Business_type.PROJECT_MATTERS_APPLY);
  726. if (declaration.getIs_street_audit().equals("1")) {
  727. messages1.setTitle("提醒街道审核");
  728. List<User> users = userService.findUsersByStreetId(ShiroUtils.getStreetId());
  729. List<User> pusers = userService.findUsersByPermission("S_PROJECT_APPROVE");
  730. for (User user : users) {
  731. for (User puser : pusers) {
  732. if (Objects.equals(user.getId(), puser.getId())) {
  733. String message1 = puser.getNick_name() + ",您好。“" + company.getCompany_name() + "企业”的“" + projectName + "服务事项”申请需要您审核。谢谢。";
  734. messages1.setContent(message1);
  735. int[] streetArrInt1 = new int[1];
  736. streetArrInt1[0] = user.getId();
  737. messageService.saveMessageAndPush(messages1, streetArrInt1, Constant.UserType.STREET);
  738. waitToDoService.newTODO("服务事项审核", "/government/projectMatters/approve/" + apply.getId(), Constant.WaitToDo_OperType.AUDIT, apply.getId(),
  739. Constant.DictionaryType.PROJECT_MATTERS, apply.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
  740. }
  741. }
  742. }
  743. } else {
  744. messages1.setTitle("提醒中心审核");
  745. Group group = groupService.findByNameOnly(Constant.FWSXZX);
  746. if (null == group) {
  747. throw new BaseException("操作失败,项目填报材料审核组没有该项目责任单位的审核人员,请联系管理员配置");
  748. }
  749. List<UserGroup> userGroups = userGroupService.findByGroupId(group.getId());
  750. List<User> users = userService.findListByWhere(new User());
  751. for (UserGroup userGroup : userGroups) {
  752. User user = userService.findById(userGroup.getUser_id());
  753. String message1 = user.getUser_name() + ",您好。“" + company.getCompany_name() + "企业”的“" + projectName + "服务事项”申请需要您审核。谢谢。";
  754. messages1.setContent(message1);
  755. int[] streetArrInt1 = new int[1];
  756. streetArrInt1[0] = userGroup.getUser_id();
  757. messageService.saveMessageAndPush(messages1, streetArrInt1, Constant.UserType.GOVERNMENT);
  758. waitToDoService.newTODO("服务事项审核", "/government/projectMatters/approve/" + apply.getId(), Constant.WaitToDo_OperType.AUDIT, apply.getId(),
  759. Constant.DictionaryType.PROJECT_MATTERS, apply.getApply_no(), user.getId().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
  760. }
  761. }
  762. }
  763. /**
  764. * 获取服务事项
  765. *
  766. * @param id
  767. * @return
  768. */
  769. public ProjectMattersDeclaration findMattersDeclaration(Integer id) {
  770. ProjectMattersDeclaration declaration = projectMattersDeclarationService.findByProjectServerTypeId(id);
  771. if (declaration != null) {
  772. //项目来源
  773. String source = declaration.getProject_source();
  774. if (StringUtils.isNotBlank(source)) {
  775. DictionaryItem sourceItem = dictionaryItemService.findByTypeAndValue(Constant.DictionaryType.PROJECT_SOURCE, source);
  776. if (null != sourceItem) {
  777. declaration.setProject_source_name(sourceItem.getName());
  778. }
  779. }
  780. //发布部门
  781. String departmentId = declaration.getDepartment_id();
  782. if (StringUtils.isNotBlank(departmentId)) {
  783. Department department = departmentService.findById(Integer.parseInt(departmentId));
  784. declaration.setDepartment_name(department.getName());
  785. }
  786. //附件
  787. List<Attachment> attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.PROJECT_MATTERS_DEC, declaration.getId(), null);
  788. if (null != attachments && attachments.size() > 0) {
  789. FileDown fileDown = new FileDown(attachments.get(0).getId(), attachments.get(0).getFile_name(), attachments.get(0).getFile_url(), attachments.get(0).getDownload_uri());
  790. declaration.setFileDown(fileDown);
  791. }
  792. }
  793. return declaration;
  794. }
  795. @Transactional(readOnly = true)
  796. public Integer getMattersNum() {
  797. Example example = new Example(ProjectMatters.class);
  798. Example.Criteria criteria = example.createCriteria();
  799. criteria.andEqualTo("del_flag", "0");
  800. criteria.andNotEqualTo("apply_status", 0);
  801. return this.selectByExample(example).size();
  802. }
  803. @Transactional(readOnly = true)
  804. public List<ProjectMatters> getMattersAcceptVolume(BusinessSearchDto businessSearchDto) {
  805. Example example = new Example(ProjectMatters.class);
  806. Example.Criteria criteria = example.createCriteria();
  807. criteria.andEqualTo("del_flag", "0");
  808. criteria.andNotEqualTo("apply_status", 0);
  809. if (businessSearchDto.getWeek()) {
  810. criteria.andBetween("create_time", DateUtil.getTimesWeekmorning(), DateUtil.getTimesWeeknight());
  811. }
  812. if (businessSearchDto.getMonth()) {
  813. criteria.andBetween("create_time", DateUtil.getTimesMonthmorning(), DateUtil.getTimesMonthnight());
  814. }
  815. return this.selectByExample(example);
  816. }
  817. public Integer getMattersDecNum(Integer departmentId) {
  818. Example example = new Example(ProjectMattersDeclaration.class);
  819. Example.Criteria criteria = example.createCriteria();
  820. criteria.andEqualTo("del_flag", 0);
  821. // criteria.andNotEqualTo("apply_status", 0);
  822. criteria.andEqualTo("department_id", departmentId);
  823. return projectMattersDeclarationService.selectByExample(example).size();
  824. }
  825. public Integer getProjectServiceTypeNum(Integer type) {
  826. Example example = new Example(ProjectServiceType.class);
  827. Example.Criteria criteria = example.createCriteria();
  828. // criteria.andEqualTo("del_flag", 0);
  829. // criteria.andEqualTo("status", 1);
  830. criteria.andEqualTo("service_super_type", type);
  831. return projectServiceTypeService.selectByExample(example).size();
  832. }
  833. /**
  834. * 功能描述:获取服务事项申请单据占比饼图
  835. *
  836. * @param:
  837. * @return:
  838. * @auther: huZhiHao
  839. * @date: 2018/9/18 17:11
  840. */
  841. public List<StatisticView> getAnalysisType(StaticSearchCondition searchCondition) {
  842. List<StatisticView> list = new ArrayList<>();
  843. List<ProjectMatters> applys = projectMattersDao.findAll(searchCondition);
  844. List<ProjectServiceType> typeList = projectServiceTypeService.findAllWithProvincesDec();
  845. for (ProjectServiceType type : typeList) {
  846. StatisticView statisticView = new StatisticView();
  847. statisticView.setName(type.getService_type_name());
  848. int count = 0;
  849. for (ProjectMatters project : applys) {
  850. if (Objects.equals(project.getDeclaration_id(), type.getDeclaration_id())) {
  851. count++;
  852. }
  853. }
  854. statisticView.setY(count);
  855. list.add(statisticView);
  856. }
  857. return list;
  858. }
  859. /**
  860. * 功能描述:获取服务事项申请结果数量饼图
  861. *
  862. * @param:
  863. * @return:
  864. * @auther: huZhiHao
  865. * @date: 2018/9/18 17:11
  866. */
  867. public List<StatisticView> getAnalysisResult(StaticSearchCondition searchCondition) {
  868. int pass = 0, refuse = 0, processing = 0;
  869. List<ProjectMatters> applys = projectMattersDao.findAll(searchCondition);
  870. for (ProjectMatters project : applys) {
  871. //通过
  872. if (Objects.equals(Constant.ProjectMattersStatus_Company.SUCCESS, project.getApply_status())) {
  873. pass++;
  874. //不通过
  875. } else if (Objects.equals(Constant.ProjectMattersStatus_Company.FAILURE, project.getApply_status())) {
  876. refuse++;
  877. //审核中
  878. } else if (Objects.equals(Constant.ProjectMattersStatus_Company.IN_AUDIT, project.getApply_status())) {
  879. processing++;
  880. }
  881. }
  882. StatisticView passEntity = new StatisticView();
  883. passEntity.setName("通过");
  884. passEntity.setY(pass);
  885. StatisticView refuseEntity = new StatisticView();
  886. refuseEntity.setName("不通过");
  887. refuseEntity.setY(refuse);
  888. StatisticView processingEntity = new StatisticView();
  889. processingEntity.setName("审核中");
  890. processingEntity.setY(processing);
  891. List<StatisticView> list = new ArrayList<>();
  892. list.add(passEntity);
  893. list.add(refuseEntity);
  894. list.add(processingEntity);
  895. return list;
  896. }
  897. /**
  898. * 功能描述:获取服务事项申请趋势折线图
  899. *
  900. * @param:
  901. * @return:
  902. * @auther: huZhiHao
  903. * @date: 2018/9/18 17:11
  904. */
  905. public StatisticView getAnalysisTrend(StaticSearchCondition condition) {
  906. Calendar date = Calendar.getInstance();
  907. int year = date.get(Calendar.YEAR);
  908. Integer startYear = condition.getStartYear();
  909. Integer endYear = condition.getEndYear();
  910. if (startYear == null && endYear == null) {
  911. startYear = year - 2;
  912. endYear = year;
  913. } else {
  914. startYear = startYear == null ? year : startYear;
  915. endYear = endYear == null ? year : endYear;
  916. }
  917. StatisticView result = new StatisticView();
  918. List<StatisticView> statisticViewList = new ArrayList<>();
  919. List<String> categories = new ArrayList<>();
  920. List<ProjectServiceType> typeList = projectServiceTypeService.findAllWithProvincesDec();
  921. for (ProjectServiceType type : typeList) {
  922. List<Double> data = new ArrayList<>();
  923. List<ProjectMatters> applys = projectMattersDao.findAll(new StaticSearchCondition());
  924. StatisticView statisticView = new StatisticView();
  925. statisticView.setName(type.getService_type_name());
  926. for (int i = startYear; i <= endYear; i++) {
  927. categories.add(i + "");
  928. int count = 0;
  929. for (ProjectMatters project : applys) {
  930. if (Objects.equals(project.getDeclaration_id(), type.getDeclaration_id())) {
  931. if (Objects.equals(project.getApply_date().split("-")[0], i + "")) {
  932. count++;
  933. }
  934. }
  935. }
  936. data.add(new Double(count));
  937. }
  938. result.setCategories(categories);
  939. statisticView.setData(data);
  940. statisticViewList.add(statisticView);
  941. }
  942. result.setStatisticViewList(statisticViewList);
  943. return result;
  944. }
  945. public List<ProjectMatters> findListByCondition(SearchCondition searchCondition) {
  946. return projectMattersDao.findListByCondition(searchCondition);
  947. }
  948. }