OrderProjectApiController.java 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. package com.goafanti.order.controller;
  2. import java.io.IOException;
  3. import java.text.ParseException;
  4. import java.text.SimpleDateFormat;
  5. import javax.servlet.http.HttpServletRequest;
  6. import javax.servlet.http.HttpServletResponse;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RequestMethod;
  10. import org.springframework.web.bind.annotation.RestController;
  11. import com.goafanti.common.bo.Result;
  12. import com.goafanti.common.constant.ErrorConstants;
  13. import com.goafanti.common.controller.CertifyApiController;
  14. import com.goafanti.common.model.TTaskHours;
  15. import com.goafanti.common.utils.StringUtils;
  16. import com.goafanti.order.bo.TOrderTaskDetailBo;
  17. import com.goafanti.order.bo.TaskProgressBo;
  18. import com.goafanti.order.bo.inuptTaskHoursListBo;
  19. import com.goafanti.order.bo.inuptTaskListBo;
  20. import com.goafanti.order.service.OrderProjectService;
  21. @RestController
  22. @RequestMapping(value = "/api/admin/orderProject")
  23. public class OrderProjectApiController extends CertifyApiController {
  24. @Autowired
  25. private OrderProjectService orderProjectService;
  26. /**
  27. * 项目分配
  28. * taskId 项目ID
  29. * taskReceiverId 受理人ID
  30. * specially 0 任务派单(咨询师经理派单) 1项目派单(咨询师管理员派单)2咨询师退回给经理
  31. */
  32. @RequestMapping(value = "/projectDistribution", method = RequestMethod.POST)
  33. public Result projectDistribution(Integer taskId,String taskReceiverId,Integer specially ,String remarks){
  34. Result res = new Result();
  35. if(null==taskId || StringUtils.isBlank(taskReceiverId)){
  36. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "任务编号和受理人"));
  37. return res;
  38. }
  39. res.setData(orderProjectService.updateProjectDistribution( taskId, taskReceiverId,specially,remarks));
  40. return res;
  41. }
  42. /**
  43. * 任务派单列表 我的任务,我的外包任务
  44. * specially 0我的任务 1任务派单
  45. */
  46. @RequestMapping(value="/orderTaskList" ,method = RequestMethod.GET)
  47. public Result orderTaskList(inuptTaskListBo ib){
  48. Result res=new Result();
  49. res.setData(orderProjectService.orderTaskList(ib));
  50. return res;
  51. }
  52. /**
  53. * 任务派单查询
  54. */
  55. @RequestMapping(value="/selectTaskList" ,method = RequestMethod.GET)
  56. public Result selectTaskList(String name,String orderNo,String taskId,Integer taskStatus,String adminName,Integer specially ,String depId ,Integer pageNo,Integer pageSize){
  57. Result res=new Result();
  58. res.setData(orderProjectService.selectTaskList( name, orderNo, taskId, taskStatus, adminName,specially , depId ,pageNo, pageSize));
  59. return res;
  60. }
  61. /**
  62. * 经理查询订单
  63. */
  64. @RequestMapping(value="/managerSelect" ,method = RequestMethod.GET)
  65. public Result managerSelect(String name,String orderNo,String contractNo,String cid,String projectType,
  66. String depId,String techDepId ,Integer declarationBatch ,String commodityPrice,String startTime,
  67. String endTime,Integer pageNo,Integer pageSize){
  68. Result res=new Result();
  69. res.setData(orderProjectService.managerSelect( name, orderNo, contractNo, cid, projectType,
  70. depId, techDepId , declarationBatch ,commodityPrice,startTime, endTime , pageNo, pageSize));
  71. return res;
  72. }
  73. /**
  74. * 任务详情
  75. */
  76. @RequestMapping(value="/orderTaskDetail" ,method = RequestMethod.GET)
  77. public Result orderTaskDetail(String id){
  78. Result res=new Result();
  79. res.setData(orderProjectService.orderTaskDetail(id));
  80. return res;
  81. }
  82. /**
  83. * 任务修改(咨询师)
  84. */
  85. @RequestMapping(value="/updateOrderTask" ,method = RequestMethod.POST)
  86. public Result updateOrderTask(TOrderTaskDetailBo t){
  87. Result res=new Result();
  88. res.setData(orderProjectService.updateOrderTask(t));
  89. return res;
  90. }
  91. /**
  92. * 修改状态(咨询师)
  93. */
  94. @RequestMapping(value="/updateProjectStatus" ,method = RequestMethod.POST)
  95. public Result updateProjectStatus(Integer tid,Integer projectStatus,String timeRecord ){
  96. Result res=new Result();
  97. res.setData(orderProjectService.updateProjectStatus(tid, projectStatus, timeRecord ));
  98. return res;
  99. }
  100. /**
  101. * 添加工时
  102. */
  103. @RequestMapping(value="/addTaskHours" ,method = RequestMethod.POST)
  104. public Result addTaskHours(TTaskHours t,String taskDate){
  105. Result res=new Result();
  106. if (t.getHours()==null) {
  107. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "任务时间"));
  108. return res;
  109. }
  110. if (StringUtils.isBlank(taskDate)) {
  111. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "工作日期"));
  112. return res;
  113. }
  114. if (StringUtils.isBlank(t.getRemarks())) {
  115. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "工作内容"));
  116. return res;
  117. }
  118. if (StringUtils.isNotBlank(taskDate)) {
  119. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  120. try {
  121. t.setTaskDay(sdf.parse(taskDate));
  122. } catch (ParseException e) {
  123. e.printStackTrace();
  124. }
  125. }
  126. res.setData(orderProjectService.addTaskHours(t));
  127. return res;
  128. }
  129. /**
  130. * 任务工时列表
  131. */
  132. @RequestMapping(value="/taskHoursList" ,method = RequestMethod.GET)
  133. public Result taskHoursList(inuptTaskHoursListBo ib,
  134. Integer pageNo, Integer pageSize){
  135. Result res=new Result();
  136. res.setData(orderProjectService.taskHoursList(ib,pageNo, pageSize));
  137. return res;
  138. }
  139. /**
  140. * 任务工时详情列表
  141. */
  142. @RequestMapping(value="/taskHoursDetailsList" ,method = RequestMethod.GET)
  143. public Result taskHoursDetailsList( String taskId ){
  144. Result res=new Result();
  145. if (StringUtils.isBlank(taskId)) {
  146. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "项目编号"));
  147. return res;
  148. }
  149. res.setData(orderProjectService.taskHoursDetailsList(taskId));
  150. return res;
  151. }
  152. /**
  153. * 任务操作日志
  154. */
  155. @RequestMapping(value="/TaskLogList" ,method = RequestMethod.GET)
  156. public Result TaskLogList(Integer id){
  157. Result res=new Result();
  158. res.setData(orderProjectService.TaskLogList(id));
  159. return res;
  160. }
  161. /** 任务文件上传 **/
  162. @RequestMapping(value = "/uploadOrderTaskFile", method = RequestMethod.POST)
  163. public Result uploadOrderTaskFile(HttpServletRequest req,String sign){
  164. Result res = new Result();
  165. res.setData(handleFile(res, "/order_task_file/", false, req, sign));
  166. return res;
  167. }
  168. /**
  169. * 新增项目申报进度
  170. */
  171. @RequestMapping(value="/createTaskProgress" ,method = RequestMethod.POST)
  172. public Result createTaskProgress(TaskProgressBo t){
  173. Result res=new Result();
  174. if ( null==t.getTaskId()|| null==t.getAlreadyNumber()) {
  175. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  176. }
  177. res.setData(orderProjectService.createTaskProgress(t));
  178. return res;
  179. }
  180. /**
  181. * 修改项目申报进度
  182. */
  183. @RequestMapping(value="/updateTaskProgress" ,method = RequestMethod.POST)
  184. public Result updateTaskProgress(TaskProgressBo t){
  185. Result res=new Result();
  186. if (null==t.getTaskId()|| null==t.getAlreadyNumber()) {
  187. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  188. }
  189. res.setData(orderProjectService.updateTaskProgress(t));
  190. return res;
  191. }
  192. /**
  193. * 删除项目申报进度
  194. */
  195. @RequestMapping(value="/delectTaskProgress" ,method = RequestMethod.POST)
  196. public Result delectTaskProgress(Integer id){
  197. Result res=new Result();
  198. if (null==id) {
  199. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  200. }
  201. res.setData(orderProjectService.delectTaskProgress(id));
  202. return res;
  203. }
  204. /**
  205. * 查看项目申报进度
  206. */
  207. @RequestMapping(value="/selectTaskProgress" ,method = RequestMethod.GET)
  208. public Result selectTaskProgress(Integer tid){
  209. Result res=new Result();
  210. if (null==tid) {
  211. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  212. }
  213. res.setData(orderProjectService.selectTaskProgress(tid));
  214. return res;
  215. }
  216. /**
  217. * 项目申报进度日志
  218. */
  219. @RequestMapping(value="/selectTaskProgressLog" ,method = RequestMethod.GET)
  220. public Result selectTaskProgressLog(Integer tid){
  221. Result res=new Result();
  222. if (null==tid) {
  223. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"参数","参数"));
  224. }
  225. res.setData(orderProjectService.selectTaskProgressLog(tid));
  226. return res;
  227. }
  228. /**
  229. * 拆分项目
  230. */
  231. @RequestMapping(value="/addSplitProject" ,method = RequestMethod.POST)
  232. public Result addSplitProject(Integer tid,String splitList){
  233. Result res=new Result();
  234. if (null==tid||StringUtils.isBlank(splitList)) {
  235. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"项目和拆分数","项目和拆分数"));
  236. return res;
  237. }
  238. int i=orderProjectService.pushSplitProject(tid,splitList);
  239. if (i==-1) {
  240. res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"拆分数","拆分数"));
  241. return res;
  242. }
  243. res.setData(i);
  244. return res;
  245. }
  246. /**
  247. * 拆分项目列表
  248. */
  249. @RequestMapping(value="/splitProjectList" ,method = RequestMethod.GET)
  250. public Result splitProjectList(Integer tid){
  251. Result res=new Result();
  252. if (null==tid) {
  253. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"项目和拆分数","项目和拆分数"));
  254. return res;
  255. }
  256. res.setData(orderProjectService.splitProjectList(tid));
  257. return res;
  258. }
  259. /**
  260. * 我的工时列表导出xls
  261. * @throws IOException
  262. */
  263. @RequestMapping(value = "/exportMyTaskList", method = RequestMethod.GET)
  264. public Result exportMyTaskList(HttpServletResponse response,inuptTaskHoursListBo ib, Integer pageNo, Integer pageSize) throws IOException{
  265. Result res=new Result();
  266. try {
  267. orderProjectService.exportMyTaskList( response, ib, pageNo, pageSize);
  268. } catch (Exception e) {
  269. res.getError().add(buildError("格式不正确"));
  270. e.printStackTrace();
  271. return res;
  272. }
  273. res.data(1);
  274. return res;
  275. }
  276. /**
  277. * 我的任务列表导出xls
  278. * @throws IOException
  279. */
  280. @RequestMapping(value = "/exporProjectList", method = RequestMethod.GET)
  281. public Result exporProjectList(HttpServletResponse response,inuptTaskListBo ib) throws IOException{
  282. Result res=new Result();
  283. try {
  284. orderProjectService.exporProjectList( response, ib);
  285. } catch (Exception e) {
  286. res.getError().add(buildError("格式不正确"));
  287. e.printStackTrace();
  288. return res;
  289. }
  290. res.data(1);
  291. return res;
  292. }
  293. }