OrderProjectApiController.java 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. package com.goafanti.order.controller;
  2. import com.goafanti.common.bo.Result;
  3. import com.goafanti.common.constant.AFTConstants;
  4. import com.goafanti.common.constant.ErrorConstants;
  5. import com.goafanti.common.controller.CertifyApiController;
  6. import com.goafanti.common.enums.OfficialPatentType;
  7. import com.goafanti.common.model.TTaskHours;
  8. import com.goafanti.common.utils.ParamUtils;
  9. import com.goafanti.common.utils.StringUtils;
  10. import com.goafanti.common.utils.excel.NewExcelUtil;
  11. import com.goafanti.core.mybatis.page.Pagination;
  12. import com.goafanti.core.shiro.token.TokenManager;
  13. import com.goafanti.order.bo.*;
  14. import com.goafanti.order.enums.ApprovalTypeEnums;
  15. import com.goafanti.order.service.OrderNewService;
  16. import com.goafanti.order.service.OrderProjectService;
  17. import org.springframework.beans.BeanUtils;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.beans.factory.annotation.Value;
  20. import org.springframework.validation.BindingResult;
  21. import org.springframework.validation.annotation.Validated;
  22. import org.springframework.web.bind.annotation.RequestMapping;
  23. import org.springframework.web.bind.annotation.RequestMethod;
  24. import org.springframework.web.bind.annotation.RestController;
  25. import javax.servlet.http.HttpServletRequest;
  26. import javax.servlet.http.HttpServletResponse;
  27. import javax.validation.Valid;
  28. import java.text.ParseException;
  29. import java.text.SimpleDateFormat;
  30. import java.util.ArrayList;
  31. import java.util.Arrays;
  32. import java.util.List;
  33. @RestController
  34. @RequestMapping(value = "/api/admin/orderProject")
  35. public class OrderProjectApiController extends CertifyApiController {
  36. @Autowired
  37. private OrderProjectService orderProjectService;
  38. @Autowired
  39. private OrderNewService orderNewService;
  40. @Value(value = "${upload.path}")
  41. private String uploadPath = null;
  42. /**
  43. * 项目分配、项目派单、项目转交
  44. * taskId 项目ID
  45. * taskReceiverId 受理人ID
  46. * type 0管理员派单 1经理转交 2经理派单 3咨询师转交 4回退
  47. */
  48. @RequestMapping(value = "/projectDistribution", method = RequestMethod.POST)
  49. public Result projectDistribution(Integer taskId,String taskReceiverId ,String remarks,Integer type){
  50. Result res = new Result();
  51. if(null==taskId || StringUtils.isBlank(taskReceiverId)){
  52. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "任务编号和受理人"));
  53. return res;
  54. }
  55. if(type==null) type=0;
  56. boolean flag=true;
  57. if (type==0&&(TokenManager.hasRole(AFTConstants.TECH_ADMIN)||TokenManager.hasRole(AFTConstants.SUPERADMIN)))flag=false;
  58. else if ((type==1||type==2)&&TokenManager.hasRole(AFTConstants.TECH_MANAGER))flag=false;
  59. else if ((type==3||type==4)&&TokenManager.hasRole(AFTConstants.TECH))flag=false;
  60. if (flag) {
  61. res.getError().add(buildError("角色不正确,请勿在浏览器登录多个账号!"));
  62. return res;
  63. }
  64. res.setData(orderProjectService.updateProjectDistribution( taskId, taskReceiverId,remarks,type));
  65. return res;
  66. }
  67. /**
  68. * 任务派单列表 我的任务,我的外包任务
  69. * specially 0我的任务 1任务派单
  70. * 我的任务不看父项目,只看子项目 ,任务派单子项目父项目都会存在
  71. */
  72. @RequestMapping(value="/orderTaskList" ,method = RequestMethod.GET)
  73. public Result orderTaskList(inuptTaskListBo ib){
  74. Result res=new Result();
  75. res.setData(orderProjectService.orderTaskList(ib));
  76. return res;
  77. }
  78. /**
  79. * 任务派单查询
  80. */
  81. @RequestMapping(value="/selectTaskList" ,method = RequestMethod.GET)
  82. public Result selectTaskList(String name,String orderNo,String taskId,Integer taskStatus,String adminName,Integer specially ,String depId,String thchId
  83. ,String type,Integer pageNo,Integer pageSize){
  84. Result res=new Result();
  85. res.setData(orderProjectService.selectTaskList( name, orderNo, taskId, taskStatus, adminName,specially , depId,thchId ,type ,pageNo, pageSize));
  86. return res;
  87. }
  88. /**
  89. * 经理查询订单
  90. */
  91. @RequestMapping(value="/managerSelect" ,method = RequestMethod.GET)
  92. public Result managerSelect(String name,String orderNo,String contractNo,String cid,String projectType,String thchId,
  93. String depId,String techDepId ,Integer declarationBatch ,String commodityPrice,String startTime,
  94. String endTime,String type,Integer pageNo,Integer pageSize){
  95. Result res=new Result();
  96. res.setData(orderProjectService.managerSelect( name, orderNo, contractNo, cid, projectType,thchId,
  97. depId, techDepId , declarationBatch ,commodityPrice,startTime, endTime,type , pageNo, pageSize));
  98. return res;
  99. }
  100. /**
  101. * 经理查询订单
  102. */
  103. @RequestMapping(value="/exportManagerSelect" ,method = RequestMethod.GET)
  104. public Result exportManagerSelect(String name,String orderNo,String contractNo,String cid,String projectType,String thchId,
  105. String depId,String techDepId ,Integer declarationBatch ,String commodityPrice,String startTime,
  106. String endTime,String type,Integer pageNo,Integer pageSize){
  107. List<managerListBo> list=(List<managerListBo>) orderProjectService.managerSelect( name, orderNo, contractNo,
  108. cid, projectType,thchId,depId, techDepId , declarationBatch ,commodityPrice,startTime, endTime ,type, pageNo, pageSize).getList();
  109. for (managerListBo e : list) {
  110. if (StringUtils.isNotEmpty(e.getType())){
  111. String[] split = e.getType().split(",");
  112. StringBuilder stringBuilder = new StringBuilder();
  113. Arrays.stream(split).forEach(
  114. s->{
  115. stringBuilder.append(ApprovalTypeEnums.getDesc(s)).append(",");
  116. }
  117. );
  118. e.setType(stringBuilder.substring(0,stringBuilder.length()-1));
  119. }
  120. }
  121. NewExcelUtil<managerListBo> excel=new NewExcelUtil<>(managerListBo.class);
  122. return excel.exportExcel(list, "企业项目查询列表", uploadPath);
  123. }
  124. /**
  125. * 任务详情
  126. */
  127. @RequestMapping(value="/orderTaskDetail" ,method = RequestMethod.GET)
  128. public Result orderTaskDetail(Integer id){
  129. Result res=new Result();
  130. res.setData(orderProjectService.orderTaskDetail(id));
  131. return res;
  132. }
  133. /**
  134. * 任务修改(咨询师)
  135. */
  136. @RequestMapping(value="/updateOrderTask" ,method = RequestMethod.POST)
  137. public Result updateOrderTask(TOrderTaskDetailBo t){
  138. Result res=new Result();
  139. if (!StringUtils.isContainChinese(t.getContacts())){
  140. res.getError().add(buildError("联系人名称必须是中文。"));
  141. return res;
  142. }
  143. if (!StringUtils.isContactMobile(t.getContactMobile())){
  144. res.getError().add(buildError(ErrorConstants.MOBILE_PATTERN_ERROR));
  145. return res;
  146. }
  147. res.setData(orderProjectService.updateOrderTask(t));
  148. return res;
  149. }
  150. /**
  151. * 修改项目状态(咨询师)、项目状态修改
  152. */
  153. @RequestMapping(value="/updateProjectStatus" ,method = RequestMethod.POST)
  154. public Result updateProjectStatus(@Valid UpdateProjectStatusBo a,BindingResult bindingResult){
  155. Result res=new Result();
  156. if (bindingResult.hasErrors()) {
  157. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage()));
  158. return res;
  159. }
  160. res.setData(orderProjectService.updateProjectStatus( a));
  161. return res;
  162. }
  163. /**
  164. * 添加工时
  165. */
  166. @RequestMapping(value="/addTaskHours" ,method = RequestMethod.POST)
  167. public Result addTaskHours(TTaskHours t,String taskDate){
  168. Result res=new Result();
  169. if (t.getHours()==null) {
  170. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "任务时间"));
  171. return res;
  172. }
  173. if (StringUtils.isBlank(taskDate)) {
  174. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "工作日期"));
  175. return res;
  176. }
  177. if (StringUtils.isBlank(t.getRemarks())) {
  178. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "工作内容"));
  179. return res;
  180. }
  181. if (StringUtils.isNotBlank(taskDate)) {
  182. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  183. try {
  184. t.setTaskDay(sdf.parse(taskDate));
  185. } catch (ParseException e) {
  186. e.printStackTrace();
  187. }
  188. }
  189. res.setData(orderProjectService.addTaskHours(t));
  190. return res;
  191. }
  192. /**
  193. * 任务工时列表
  194. */
  195. @RequestMapping(value="/taskHoursList" ,method = RequestMethod.GET)
  196. public Result taskHoursList(inuptTaskHoursListBo ib,
  197. Integer pageNo, Integer pageSize){
  198. Result res=new Result();
  199. res.setData(orderProjectService.taskHoursList(ib,pageNo, pageSize));
  200. return res;
  201. }
  202. /**
  203. * 任务工时详情列表
  204. */
  205. @RequestMapping(value="/taskHoursDetailsList" ,method = RequestMethod.GET)
  206. public Result taskHoursDetailsList( String taskId ){
  207. Result res=new Result();
  208. if (StringUtils.isBlank(taskId)) {
  209. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "项目编号"));
  210. return res;
  211. }
  212. res.setData(orderProjectService.taskHoursDetailsList(taskId));
  213. return res;
  214. }
  215. /**
  216. * 任务操作日志
  217. */
  218. @RequestMapping(value="/TaskLogList" ,method = RequestMethod.GET)
  219. public Result TaskLogList(Integer id){
  220. Result res=new Result();
  221. res.setData(orderProjectService.TaskLogList(id));
  222. return res;
  223. }
  224. /**
  225. * 任务派单日志
  226. */
  227. @RequestMapping(value="/dispatchTaskLog" ,method = RequestMethod.GET)
  228. public Result dispatchTaskLog(Integer id){
  229. Result res=new Result();
  230. res.setData(orderProjectService.dispatchTaskLog(id));
  231. return res;
  232. }
  233. /** 任务文件上传 **/
  234. @RequestMapping(value = "/uploadOrderTaskFile", method = RequestMethod.POST)
  235. public Result uploadOrderTaskFile(HttpServletRequest req,String sign){
  236. Result res = new Result();
  237. res.setData(handleFile(res, "/order_task_file/", false, req, sign));
  238. return res;
  239. }
  240. /**
  241. * 新增项目申报进度
  242. */
  243. @RequestMapping(value="/createTaskProgress" ,method = RequestMethod.POST)
  244. public Result createTaskProgress(TaskProgressBo t){
  245. Result res=new Result();
  246. if ( null==t.getTaskId()|| null==t.getAlreadyNumber()) {
  247. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  248. }
  249. res.setData(orderProjectService.createTaskProgress(t));
  250. return res;
  251. }
  252. /**
  253. * 修改项目申报进度
  254. */
  255. @RequestMapping(value="/updateTaskProgress" ,method = RequestMethod.POST)
  256. public Result updateTaskProgress(TaskProgressBo t){
  257. Result res=new Result();
  258. if (null==t.getTaskId()|| null==t.getAlreadyNumber()) {
  259. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  260. }
  261. res.setData(orderProjectService.updateTaskProgress(t));
  262. return res;
  263. }
  264. /**
  265. * 删除项目申报进度
  266. */
  267. @RequestMapping(value="/delectTaskProgress" ,method = RequestMethod.POST)
  268. public Result delectTaskProgress(Integer id){
  269. Result res=new Result();
  270. if (null==id) {
  271. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  272. }
  273. res.setData(orderProjectService.delectTaskProgress(id));
  274. return res;
  275. }
  276. /**
  277. * 查看项目申报进度
  278. */
  279. @RequestMapping(value="/selectTaskProgress" ,method = RequestMethod.GET)
  280. public Result selectTaskProgress(Integer tid){
  281. Result res=new Result();
  282. if (null==tid) {
  283. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  284. }
  285. res.setData(orderProjectService.selectTaskProgress(tid));
  286. return res;
  287. }
  288. /**
  289. * 项目申报进度日志
  290. */
  291. @RequestMapping(value="/selectTaskProgressLog" ,method = RequestMethod.GET)
  292. public Result selectTaskProgressLog(Integer tid){
  293. Result res=new Result();
  294. if (null==tid) {
  295. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  296. }
  297. res.setData(orderProjectService.selectTaskProgressLog(tid));
  298. return res;
  299. }
  300. /**
  301. * 拆分项目
  302. */
  303. @RequestMapping(value="/addSplitProject" ,method = RequestMethod.POST)
  304. public Result addSplitProject(Integer tid,String splitList){
  305. Result res=new Result();
  306. if (null==tid||StringUtils.isBlank(splitList)) {
  307. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"项目和拆分数","项目和拆分数"));
  308. return res;
  309. }
  310. int i=orderProjectService.pushSplitProject(tid,splitList);
  311. if (i==-1) {
  312. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"拆分数","拆分数"));
  313. return res;
  314. }
  315. res.setData(i);
  316. return res;
  317. }
  318. /**
  319. * 拆分项目列表
  320. */
  321. @RequestMapping(value="/splitProjectList" ,method = RequestMethod.GET)
  322. public Result splitProjectList(Integer tid){
  323. Result res=new Result();
  324. if (null==tid) {
  325. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"项目和拆分数","项目和拆分数"));
  326. return res;
  327. }
  328. res.setData(orderProjectService.splitProjectList(tid,1));
  329. return res;
  330. }
  331. /**
  332. * 我的工时列表导出xls
  333. */
  334. @RequestMapping(value = "/exportMyTaskList", method = RequestMethod.GET)
  335. public Result exportMyTaskList(inuptTaskHoursListBo ib, Integer pageNo, Integer pageSize) {
  336. if(pageSize==null)pageSize=999999;
  337. List<TOrderTaskListBo> list=(List<TOrderTaskListBo>) orderProjectService.taskHoursList(ib, pageNo, pageSize).getList();
  338. NewExcelUtil<TOrderTaskListBo> excel=new NewExcelUtil<>(TOrderTaskListBo.class);
  339. return excel.exportExcel(list, "工时信息记录表",uploadPath);
  340. }
  341. /**
  342. * 我的任务列表导出xls
  343. */
  344. @RequestMapping(value = "/exporProjectList", method = RequestMethod.GET)
  345. public Result exporProjectList(HttpServletResponse response,inuptTaskListBo ib) {
  346. if(ib.getPageSize()==null)ib.setPageSize(99999);
  347. String str="项目任务列表";
  348. List<TOrderTaskListBo> list=(List<TOrderTaskListBo>) orderProjectService.orderTaskList(ib).getList();
  349. list.forEach(e->{
  350. if(e.getType()!=null) {
  351. String[] split = e.getType().split(",");
  352. StringBuilder stringBuilder = new StringBuilder();
  353. Arrays.stream(split).forEach(
  354. s->{
  355. if (ApprovalTypeEnums.QT.getCode().equals(Integer.valueOf(s))){
  356. stringBuilder.append(ApprovalTypeEnums.getDesc(s))
  357. .append("(").append(e.getTypeExplain()).append(")")
  358. .append(",");
  359. }else {
  360. stringBuilder.append(ApprovalTypeEnums.getDesc(s)).append(",");
  361. }
  362. }
  363. );
  364. e.setType(stringBuilder.substring(0,stringBuilder.length()-1));
  365. }
  366. }
  367. );
  368. NewExcelUtil<TOrderTaskListBo>excel=new NewExcelUtil<>(TOrderTaskListBo.class);
  369. return excel.exportExcel(list, str, response);
  370. }
  371. /**
  372. * 项目日志 (转交日志)
  373. */
  374. @RequestMapping(value = "/taskAttributionLog",method = RequestMethod.GET)
  375. public Result taskAttributionLog(Integer tid) {
  376. Result res =new Result();
  377. if (tid==null) {
  378. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"项目编号","项目编号"));
  379. return res;
  380. }
  381. res.data(orderProjectService.taskAttributionLog(tid));
  382. return res;
  383. }
  384. /**
  385. * 客户项目列表
  386. */
  387. @RequestMapping(value = "/selectUidByproject",method = RequestMethod.GET)
  388. public Result selectUidByproject(String uid) {
  389. Result res =new Result();
  390. if (uid==null) {
  391. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"客户编号","客户编号"));
  392. return res;
  393. }
  394. res.data( orderProjectService.selectUidByproject(uid) );
  395. return res;
  396. }
  397. /**
  398. * 发起项目核对
  399. */
  400. @RequestMapping(value = "/addProjectCheck",method = RequestMethod.POST)
  401. public Result addProjectCheck(Integer tid) {
  402. Result res =new Result();
  403. if (tid==null) {
  404. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"项目编号","项目编号"));
  405. return res;
  406. }
  407. res.data( orderProjectService.addProjectCheck(tid) );
  408. return res;
  409. }
  410. /**
  411. * 核对日志
  412. */
  413. @RequestMapping(value = "/projectCheckLog",method = RequestMethod.GET)
  414. public Result projectCheckLog(Integer tid) {
  415. Result res =new Result();
  416. if (tid==null) {
  417. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"项目编号","项目编号"));
  418. return res;
  419. }
  420. res.data( orderProjectService.projectCheckLog(tid) );
  421. return res;
  422. }
  423. /**
  424. * 获取专利分类
  425. */
  426. @RequestMapping(value = "/getPatentType",method = RequestMethod.GET)
  427. public Result getPatentType() {
  428. Result res =new Result();
  429. res.data(OfficialPatentType.getStatus());
  430. return res;
  431. }
  432. /**
  433. * 核对列表
  434. */
  435. @RequestMapping(value = "/selectProjectCheck",method = RequestMethod.GET)
  436. public Result selectProjectCheck(InputProjectCheck in) {
  437. Result res =new Result();
  438. res.data(orderProjectService.selectProjectCheck(in));
  439. return res;
  440. }
  441. /**
  442. * 高新复审统计
  443. */
  444. @RequestMapping(value = "/highNewRetrialStatistics",method = RequestMethod.GET)
  445. public Result highNewRetrialStatistics(String depId,String startDate,String endDate) {
  446. Result res =new Result();
  447. res.data(orderProjectService.highNewRetrialStatistics(depId,startDate,endDate));
  448. return res;
  449. }
  450. /**
  451. * 高新复审统计
  452. */
  453. @RequestMapping(value = "/highNewRetrialStatistics/export",method = RequestMethod.GET)
  454. public Result highNewRetrialStatisticsExport(String depId,String startDate,String endDate,String depName) {
  455. List<OutHighNewRetrialStatistics> list=orderProjectService.highNewRetrialStatistics(depId,startDate,endDate);
  456. NewExcelUtil<OutHighNewRetrialStatistics> newExcelUtil=new NewExcelUtil<>(OutHighNewRetrialStatistics.class);
  457. StringBuilder str=new StringBuilder("搜索条件=》");
  458. if (depName!=null)str.append("部门:").append(depName).append(",");
  459. if (startDate!=null&&endDate!=null)str.append("时间:").append(startDate).append("~").append(endDate).append(",");
  460. return newExcelUtil.exportExcel(list,"高新复审统计",uploadPath,str.substring(0,str.toString().length()-1));
  461. }
  462. /**
  463. * 高新复审详情列表
  464. */
  465. @RequestMapping(value = "/highNewRetrialList",method = RequestMethod.GET)
  466. public Result highNewRetrialList(String province,String depId,String startDate,String endDate,String aid,Integer sort) {
  467. Result res =new Result();
  468. res.data(orderProjectService.highNewRetrialList(province,depId,aid,sort,startDate,endDate));
  469. return res;
  470. }
  471. @RequestMapping(value = "/highNewRetrialList/export",method = RequestMethod.GET)
  472. public Result highNewRetrialListExport(String province,String provinceName,String depId,String depName,String startDate,String endDate,String aid,
  473. String aName,Integer sort) {
  474. List<OutHighNewRetrialList> list=orderProjectService.highNewRetrialList(province,depId,aid,sort,startDate,endDate);
  475. NewExcelUtil<OutHighNewRetrialList> newExcelUtil=new NewExcelUtil<>(OutHighNewRetrialList.class);
  476. StringBuilder str=new StringBuilder("搜索条件=》");
  477. if (provinceName!=null)str.append("省份:").append(provinceName).append(",");
  478. if (depName!=null)str.append("部门:").append(depName).append(",");
  479. if (aName!=null)str.append("跟进人:").append(aName).append(",");
  480. if (startDate!=null&&endDate!=null)str.append("时间:").append(startDate).append("~").append(endDate).append(",");
  481. if(sort!=null){
  482. str.append("排序:");
  483. if(sort==0)str.append("按签通过高新排序");
  484. else if(sort==1)str.append("按未通过高新排序");
  485. }
  486. return newExcelUtil.exportExcel(list,"高新复审详情",uploadPath,str.substring(0,str.toString().length()-1));
  487. }
  488. /**
  489. * 新增会员项目
  490. */
  491. @RequestMapping(value = "/addMemberProject" ,method = RequestMethod.POST)
  492. public Result addMemberProject(InputAddTask t){
  493. Result res = new Result();
  494. if(StringUtils.isBlank(t.getOrderNo())){
  495. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单编号"));
  496. return res;
  497. }
  498. t.setProcessStatus(1);
  499. t.setMain(0);
  500. return res.data(orderNewService.addMemberProject(t));
  501. }
  502. /**
  503. * 会员项目审核
  504. */
  505. @RequestMapping(value = "/examineMemberProject" ,method = RequestMethod.POST)
  506. public Result examineMemberProject(InputMenber in){
  507. Result res = new Result();
  508. if(in.getId()==null){
  509. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"项目编号"));
  510. return res;
  511. }
  512. return res.data(orderProjectService.pushExamineMemberProject(in));
  513. }
  514. /**
  515. * 会员项目修改
  516. */
  517. @RequestMapping(value = "/updateMemberProject" ,method = RequestMethod.POST)
  518. public Result updateMemberProject(InputAddTask t){
  519. Result res = new Result();
  520. if(t.getId()==null){
  521. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"项目编号"));
  522. return res;
  523. }
  524. return res.data(orderProjectService.updateMemberProject(t));
  525. }
  526. /**
  527. * 会员项目列表
  528. */
  529. @RequestMapping(value = "/memberList" ,method = RequestMethod.GET)
  530. public Result memberList(InputMemberList in){
  531. Result res = new Result();
  532. return res.data(orderProjectService.memberList(in));
  533. }
  534. /**
  535. * 会员项目列表
  536. */
  537. @RequestMapping(value = "/memberLog" ,method = RequestMethod.GET)
  538. public Result memberLog(Integer id){
  539. Result res = new Result();
  540. return res.data(orderProjectService.memberLog(id));
  541. }
  542. /**
  543. * 会员项目列表
  544. */
  545. @RequestMapping(value = "/memberList/export" ,method = RequestMethod.GET)
  546. public Result memberListExport(InputMemberList in){
  547. return orderProjectService.memberListExport(in);
  548. }
  549. /** 文件上传 **/
  550. @RequestMapping(value = "/uploadMemberFile", method = RequestMethod.POST)
  551. public Result uploadOrderInvoiceFile(HttpServletRequest req,String sign){
  552. Result res = new Result();
  553. res.setData(handleFile(res, "/member_project/", false, req, sign));
  554. return res;
  555. }
  556. /**
  557. * 新增会员子项目(发起新增、无需审核)
  558. *
  559. */
  560. @RequestMapping(value = "/addMemberFirstSonProject" ,method = RequestMethod.POST)
  561. public Result addMemberFirstSonProject(Integer tid,String serviceYear,String taskComment){
  562. Result res = new Result();
  563. if(tid==null||StringUtils.isBlank(serviceYear)){
  564. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","参数"));
  565. return res;
  566. }
  567. if (orderProjectService.checkOrderProcessStatus(tid,0)){
  568. res.getError().add(buildError("项目已发起,不允许使用首次新增会员子项目。"));
  569. return res;
  570. }
  571. return res.data(orderProjectService.addMemberSonProject( tid, serviceYear, taskComment,null,null));
  572. }
  573. /**
  574. * 新增会员子项目(审核)
  575. *
  576. */
  577. @RequestMapping(value = "/addMemberSonProject" ,method = RequestMethod.POST)
  578. public Result addMemberSonProject(Integer tid,String serviceYear,String taskComment,Integer memberType,String pictureUrl){
  579. Result res = new Result();
  580. if(tid==null||StringUtils.isBlank(serviceYear)){
  581. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","参数"));
  582. return res;
  583. }
  584. return res.data(orderProjectService.addMemberSonProject( tid, serviceYear, taskComment,memberType, pictureUrl));
  585. }
  586. /**
  587. * 删除会员子项目
  588. *
  589. */
  590. @RequestMapping(value = "/deleteMemberSonProject" ,method = RequestMethod.POST)
  591. public Result deleteMemberSonProject(Integer id){
  592. Result res = new Result();
  593. if(id==null){
  594. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单编号"));
  595. return res;
  596. }
  597. return res.data(orderProjectService.deleteMemberSonProject( id));
  598. }
  599. /**
  600. * 项目暂停
  601. *
  602. */
  603. @RequestMapping(value = "/addProjectStop" ,method = RequestMethod.POST)
  604. public Result addProjectStop(@Validated InputProjectStop in,BindingResult bindingResult){
  605. Result res = new Result();
  606. if (bindingResult.hasErrors()) {
  607. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  608. ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
  609. return res;
  610. }
  611. if (in.getIds()==null){
  612. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"编号","编号"));
  613. return res;
  614. }
  615. return res.data(orderProjectService.addProjectStop( in));
  616. }
  617. /**
  618. * 项目暂停
  619. *
  620. */
  621. @RequestMapping(value = "/updateProjectStop" ,method = RequestMethod.POST)
  622. public Result updateProjectStop(@Validated InputProjectStop in,BindingResult bindingResult){
  623. Result res = new Result();
  624. if (bindingResult.hasErrors()) {
  625. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  626. ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
  627. return res;
  628. }
  629. if (in.getStopId()==null){
  630. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"暂停编号","暂停编号"));
  631. return res;
  632. }
  633. return res.data(orderProjectService.updateProjectStop(in));
  634. }
  635. /**
  636. * 项目暂停审核
  637. *
  638. */
  639. @RequestMapping(value = "/examineProjectStop" ,method = RequestMethod.POST)
  640. public Result examineProjectStop(@Validated InputTaskStopLog in,BindingResult bindingResult){
  641. Result res = new Result();
  642. if (bindingResult.hasErrors()) {
  643. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  644. ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
  645. return res;
  646. }
  647. return res.data(orderProjectService.pushExamineProjectStop( in));
  648. }
  649. /**
  650. * 项目暂停日志列表
  651. *
  652. */
  653. @RequestMapping(value = "/projectStopList" ,method = RequestMethod.GET)
  654. public Result projectStopList(Integer taskStopId){
  655. Result res = new Result();
  656. if (taskStopId==null){
  657. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"项目暂停编号","项目暂停编号"));
  658. return res;
  659. }
  660. return res.data(orderProjectService.projectStopList( taskStopId));
  661. }
  662. /**
  663. * 项目暂停列表
  664. * @param shiroType 0=我的列表 1=审核列表
  665. */
  666. @RequestMapping(value = "/selectProjectStop" ,method = RequestMethod.GET)
  667. public Result selectProjectStop(String orderNo,String userName,String depId,String contractNo, String projectName,Integer status,
  668. String startTime, String endTime, String receiverId,
  669. Integer shiroType,Integer pageNo,Integer pageSize){
  670. Result res = new Result();
  671. return res.data(orderProjectService.selectProjectStop( orderNo, userName, depId, contractNo,
  672. projectName, status,startTime,endTime,receiverId, shiroType,pageNo, pageSize));
  673. }
  674. /**
  675. * 项目暂停列表
  676. *
  677. */
  678. @RequestMapping(value = "/selectProjectStop/export" ,method = RequestMethod.GET)
  679. public Result selectProjectSotpExport(String orderNo,String userName,String depId,String contractNo, String projectName,Integer status,
  680. String startTime, String endTime, String receiverId,Integer shiroType, Integer pageNo,Integer pageSize){
  681. NewExcelUtil newExcelUtil=new NewExcelUtil(OutselectProjectSotpBo.class);
  682. Pagination<?> p = orderProjectService.selectProjectStop(orderNo, userName, depId, contractNo,
  683. projectName, status, startTime, endTime, receiverId, shiroType, pageNo, pageSize);
  684. List<OutselectProjectSotp> list = (List<OutselectProjectSotp>) p.getList();
  685. List<OutselectProjectSotpBo> list2=new ArrayList<>();
  686. for (OutselectProjectSotp use : list) {
  687. OutselectProjectSotpBo o = new OutselectProjectSotpBo();
  688. BeanUtils.copyProperties(use,o);
  689. StringBuilder str =new StringBuilder();
  690. if (o.getStopStatus()==0){
  691. str.append("已发起");
  692. }else if (o.getStopStatus()==1){
  693. str.append("已完成");
  694. }else if (o.getStopStatus()==2){
  695. str.append("已拒绝");
  696. }
  697. if (o.getStopType()==0){
  698. str.append("暂停");
  699. }else if (o.getStopStatus()==1){
  700. str.append("重启");
  701. }
  702. o.setStatusName(str.toString());
  703. list2.add(o);
  704. }
  705. return newExcelUtil.exportExcel(list2,"暂停项目列表",uploadPath);
  706. }
  707. /** 文件上传 **/
  708. @RequestMapping(value = "/uploadStopFile", method = RequestMethod.POST)
  709. public Result uploadStopFile(HttpServletRequest req,String sign){
  710. Result res = new Result();
  711. res.setData(handleFile(res, "/projectStopFile/", false, req, sign));
  712. return res;
  713. }
  714. /** 文件上传 **/
  715. @RequestMapping(value = "/upload/satisfactionDegree", method = RequestMethod.POST)
  716. public Result uploadsatisfactionDegree(HttpServletRequest req,String sign,Integer id){
  717. Result res = new Result();
  718. String path="/satisfactionDegree/"+id+"/";
  719. res.setData(handleFile(res, path, false, req, sign));
  720. return res;
  721. }
  722. @RequestMapping(value="/updateSatisfactionDegree",method = RequestMethod.POST)
  723. public Result updateSatisfactionDegree(Integer id,Integer formRetrieve,Integer satisfactionDegree,String satisfactionDegreeUrl){
  724. Result res=new Result();
  725. if (id ==null){
  726. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"项目编号"));
  727. return res;
  728. }
  729. if (formRetrieve ==null){
  730. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"满意度回收状态"));
  731. return res;
  732. }
  733. if (formRetrieve==2){
  734. if (satisfactionDegree ==null){
  735. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"满意度"));
  736. return res;
  737. }
  738. if (StringUtils.isBlank(satisfactionDegreeUrl)){
  739. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"满意度附件"));
  740. return res;
  741. }
  742. }
  743. if (formRetrieve==4){
  744. if (StringUtils.isBlank(satisfactionDegreeUrl)){
  745. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"满意度附件"));
  746. return res;
  747. }
  748. }
  749. res.setData(orderProjectService.updateSatisfactionDegree( id, formRetrieve, satisfactionDegree, satisfactionDegreeUrl));
  750. return res;
  751. }
  752. }