|
|
@@ -1,9 +1,16 @@
|
|
|
package com.goafanti.order.service.impl;
|
|
|
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
+import org.apache.commons.beanutils.ConvertUtils;
|
|
|
+import org.apache.commons.beanutils.converters.DateConverter;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -18,6 +25,8 @@ import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.order.bo.TOrderNewBo;
|
|
|
import com.goafanti.order.bo.TOrderRefundBo;
|
|
|
import com.goafanti.order.bo.TOrderTaskBo;
|
|
|
+import com.goafanti.order.bo.TOrderTaskDetailBo;
|
|
|
+import com.goafanti.order.bo.TOrderTaskListBo;
|
|
|
import com.goafanti.order.enums.ProcessStatus;
|
|
|
import com.goafanti.order.service.OrderProjectService;
|
|
|
import com.goafanti.techproject.enums.TaskState;
|
|
|
@@ -29,11 +38,27 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
|
|
|
private TOrderNewMapper tOrderNewMapper;
|
|
|
|
|
|
@Override
|
|
|
- public int updateProjectDistribution(Integer taskId, String taskReceiverId) {
|
|
|
+ public int updateProjectDistribution(Integer taskId, String taskReceiverId,Integer specially) {
|
|
|
TOrderTask t=tOrderTaskMapper.selectByPrimaryKey(taskId);
|
|
|
t.setTaskStatus(TaskState.DISTRIBUTION.getCode());
|
|
|
t.setTaskReceiver(taskReceiverId);
|
|
|
+ t.setTaskDistributionTime(new Date());
|
|
|
tOrderTaskMapper.updateByPrimaryKeySelective(t);
|
|
|
+ if (specially==0&&t.getCommodityQuantity()>1) {
|
|
|
+ for (int i = 0; i < t.getCommodityQuantity(); i++) {
|
|
|
+ TOrderTask tOrderTask=new TOrderTask();
|
|
|
+ try {
|
|
|
+ ConvertUtils.register(new DateConverter(null), java.util.Date.class);
|
|
|
+ BeanUtils.copyProperties(tOrderTask, t);
|
|
|
+ tOrderTask.setId(null);
|
|
|
+ tOrderTask.setCommodityQuantity(1);
|
|
|
+ tOrderTask.setSuperId(t.getId().toString());
|
|
|
+ tOrderTaskMapper.insertSelective(tOrderTask);
|
|
|
+ } catch (IllegalAccessException | InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
List<TOrderTaskBo> taskBos=tOrderTaskMapper.selectOrderTask(t.getOrderNo());
|
|
|
TOrderNew tNew=new TOrderNew();
|
|
|
tNew.setOrderNo(t.getOrderNo());
|
|
|
@@ -53,5 +78,71 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Override
|
|
|
+ public Pagination<TOrderTaskListBo> orderTaskList(String name, String orderNo, String taskId, Integer taskStatus,
|
|
|
+ String adminName,Integer specially, Integer pageNo, Integer pageSize) {
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ if(pageSize==null||pageSize<0)pageSize=10;
|
|
|
+ if(pageNo==null||pageNo<0)pageNo=1;
|
|
|
+ if (specially!=null&&specially==0) {
|
|
|
+ params.put("aid", TokenManager.getAdminId()==null?"e82a4405-2104-481d-ba5f-72a639589efd":TokenManager.getAdminId());
|
|
|
+ }
|
|
|
+ if (null!=specially) params.put("specially", specially);
|
|
|
+ if (StringUtils.isNotBlank(name)) params.put("name", name);
|
|
|
+ if (StringUtils.isNotBlank(orderNo)) params.put("orderNo", orderNo);
|
|
|
+ if (StringUtils.isNotBlank(taskId)) params.put("taskId", taskId);
|
|
|
+ if (StringUtils.isNotBlank(adminName)) params.put("adminName", adminName);
|
|
|
+ if (null != taskStatus) params.put("taskStatus", taskStatus);
|
|
|
+ Pagination<TOrderTaskListBo> p = (Pagination<TOrderTaskListBo>)findPage("selectOrderTaskListByPage", "selectOrderTaskListCount", params, pageNo, pageSize);
|
|
|
+ return p;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TOrderTaskDetailBo orderTaskDetail(String id) {
|
|
|
+ return tOrderTaskMapper.getOrderTaskDetail(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateOrderTask(TOrderTaskDetailBo t) {
|
|
|
+ TOrderTask task=new TOrderTask();
|
|
|
+ task.setAttachmentUrl(t.getAttachmentUrl());
|
|
|
+ task.setId(Integer.valueOf(t.getId()));
|
|
|
+ task.setTaskStatus(t.getTaskStatus());
|
|
|
+ task.setProjectStatus(t.getProjectStatus());
|
|
|
+ task.setTaskComment(t.getTaskComment());
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ try {
|
|
|
+ if(StringUtils.isNotBlank(t.getStartDate()))task.setTaskStartTime(sdf.parse(t.getStartDate()));
|
|
|
+ if(StringUtils.isNotBlank(t.getEndDate()))task.setTaskEndTime(sdf.parse(t.getEndDate()));
|
|
|
+ if(StringUtils.isNotBlank(t.getAcceptDate()))task.setAcceptTime(sdf.parse(t.getAcceptDate()));
|
|
|
+ if(StringUtils.isNotBlank(t.getReviewDate()))task.setReviewTime(sdf.parse(t.getReviewDate()));
|
|
|
+ if(StringUtils.isNotBlank(t.getPublicityDate()))task.setPublicityTime(sdf.parse(t.getPublicityDate()));
|
|
|
+ if(StringUtils.isNotBlank(t.getLicenceDate()))task.setLicenceTime(sdf.parse(t.getLicenceDate()));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ tOrderTaskMapper.updateByPrimaryKeySelective(task);
|
|
|
+ TOrderTask task2=tOrderTaskMapper.selectByPrimaryKey(task.getId());//查询出项目信息
|
|
|
+ if (task2.getSuperId()!=null) {//是否有父项目
|
|
|
+ TOrderTask task3 =tOrderTaskMapper.selectBySuperId(task2.getSuperId());
|
|
|
+ task3.setId(Integer.valueOf(task2.getSuperId()));
|
|
|
+ tOrderTaskMapper.updateByPrimaryKeySelective(task3);
|
|
|
+ meanwhileUpdateOrder(task3);
|
|
|
+ }else {
|
|
|
+ meanwhileUpdateOrder(task2);
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void meanwhileUpdateOrder(TOrderTask task) {
|
|
|
+ if (task.getMain()==1) {//是否是主要项目
|
|
|
+ TOrderNew tNew=new TOrderNew();
|
|
|
+ tNew.setProjectStatus(task.getProjectStatus());
|
|
|
+ tNew.setOrderNo(task.getOrderNo());
|
|
|
+ tOrderNewMapper.updateByPrimaryKeySelective(tNew);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|