|
|
@@ -1,11 +1,9 @@
|
|
|
package com.goafanti.order.service.impl;
|
|
|
|
|
|
|
|
|
-import java.lang.reflect.InvocationTargetException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -13,54 +11,43 @@ import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
-import org.apache.poi.ss.usermodel.DataFormat;
|
|
|
-import org.json.JSONArray;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.goafanti.common.bo.Error;
|
|
|
-import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.dao.OrganizationContactBookMapper;
|
|
|
import com.goafanti.common.dao.TDunLogMapper;
|
|
|
import com.goafanti.common.dao.TOrderBackMapper;
|
|
|
import com.goafanti.common.dao.TOrderDunMapper;
|
|
|
-import com.goafanti.common.dao.TOrderMapper;
|
|
|
import com.goafanti.common.dao.TOrderNewMapper;
|
|
|
import com.goafanti.common.dao.TOrderRefundMapper;
|
|
|
import com.goafanti.common.dao.TOrderTaskMapper;
|
|
|
import com.goafanti.common.dao.UserLockReleaseMapper;
|
|
|
-import com.goafanti.common.enums.UserLockReleaseStatus;
|
|
|
import com.goafanti.common.error.BusinessException;
|
|
|
import com.goafanti.common.model.OrganizationContactBook;
|
|
|
import com.goafanti.common.model.TDunLog;
|
|
|
import com.goafanti.common.model.TOrder;
|
|
|
import com.goafanti.common.model.TOrderBack;
|
|
|
-import com.goafanti.common.model.TOrderDetail;
|
|
|
import com.goafanti.common.model.TOrderDun;
|
|
|
import com.goafanti.common.model.TOrderNew;
|
|
|
-import com.goafanti.common.model.TOrderRefund;
|
|
|
import com.goafanti.common.model.TOrderRefundWithBLOBs;
|
|
|
import com.goafanti.common.model.TOrderTask;
|
|
|
-import com.goafanti.common.model.UserLockRelease;
|
|
|
-import com.goafanti.common.utils.BeanUtilsExt;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.JDBCIdGenerator;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.customer.bo.LockingReleaseBo;
|
|
|
-import com.goafanti.order.bo.BackOrderListBo;
|
|
|
import com.goafanti.order.bo.TDunLogListBo;
|
|
|
import com.goafanti.order.bo.TOrderNewBo;
|
|
|
+import com.goafanti.order.bo.TOrderRefundBo;
|
|
|
import com.goafanti.order.bo.TOrderTaskBo;
|
|
|
import com.goafanti.order.enums.ActiveState;
|
|
|
import com.goafanti.order.enums.ApprovalNewState;
|
|
|
import com.goafanti.order.enums.LiquidationNewState;
|
|
|
import com.goafanti.order.enums.OrderNewState;
|
|
|
-import com.goafanti.order.enums.OrderState;
|
|
|
import com.goafanti.order.enums.ProcessStatus;
|
|
|
import com.goafanti.order.enums.ProjectNewStage;
|
|
|
import com.goafanti.order.enums.TaskState;
|
|
|
@@ -217,20 +204,22 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
if (t.getId()==null||t.getId().equals("")) {//Id为空新增
|
|
|
t.setId(UUID.randomUUID().toString());
|
|
|
t.setDunBy(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
|
|
|
+ t.setDunStatus(0);//催款中
|
|
|
tOrderDunMapper.insertSelective(t);
|
|
|
}else {
|
|
|
tOrderDunMapper.updateByPrimaryKeySelective(t);
|
|
|
}
|
|
|
- boolean flag=true;
|
|
|
- String id="";
|
|
|
- for (TOrderDun t2 : l2) {
|
|
|
+
|
|
|
+ }
|
|
|
+ boolean flag=true;
|
|
|
+ for (TOrderDun t2 : l2) {
|
|
|
+ for (TOrderDun t : l) {
|
|
|
if (t2.getId().equals(t.getId())) {//查询集合与返回集合比较查出删除项
|
|
|
flag=false;
|
|
|
}
|
|
|
- id=t2.getId();
|
|
|
}
|
|
|
- if (!id.equals("")&&flag) {
|
|
|
- tOrderDunMapper.deleteByPrimaryKey(id);
|
|
|
+ if (t2.getId()!=null&&flag) {
|
|
|
+ tOrderDunMapper.deleteByPrimaryKey(t2.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -241,17 +230,18 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
- public Pagination<TOrderNewBo> orderNewList(String name, String orderNo, String starTime, String endTime,Integer specially, Integer pageNo,
|
|
|
+ public Pagination<TOrderNewBo> orderNewList(String name, String orderNo, String starTime, String endTime,Integer specially,Integer distribution, 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?"1":TokenManager.getAdminId());
|
|
|
- params.put("specially",specially);
|
|
|
- }else {
|
|
|
- params.put("specially",specially);
|
|
|
+ }else if(specially!=null&&specially==4){
|
|
|
+ params.put("distribution",distribution);
|
|
|
}
|
|
|
+ params.put("specially",specially);
|
|
|
+
|
|
|
if (StringUtils.isNotBlank(name)) params.put("name", name);
|
|
|
if (StringUtils.isNotBlank(orderNo)) params.put("orderNo", orderNo);
|
|
|
if (StringUtils.isNotBlank(starTime)) params.put("starTime", starTime);
|
|
|
@@ -297,7 +287,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
public Pagination<TOrderNewBo> dunOrderNewList(String name, String orderNo, String starTime, String endTime,
|
|
|
- Integer orderStatus, Integer pageNo, Integer pageSize) {
|
|
|
+ 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;
|
|
|
@@ -338,13 +328,16 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
@Override
|
|
|
public int addOrderRefund(TOrderRefundWithBLOBs t) {
|
|
|
- TOrderNew tOrder= tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
|
|
|
t.setRefundStatus(refundState.DSH.getCode());
|
|
|
t.setCreateTime(new Date());
|
|
|
t.setInitiate(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
|
|
|
t.setAccept("1");
|
|
|
//t.setAccept(tOrder.getFinanceId());
|
|
|
t.setResult("");
|
|
|
+ TOrderNew tOrder=new TOrderNew();
|
|
|
+ tOrder.setOrderNo(t.getOrderNo());
|
|
|
+ tOrder.setOrderStatus(OrderNewState.YTD.getCode());
|
|
|
+ tOrderNewMapper.updateByPrimaryKeySelective(tOrder);
|
|
|
return tOrderRefundMapper.insertSelective(t);
|
|
|
}
|
|
|
|
|
|
@@ -429,11 +422,43 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
@Override
|
|
|
public boolean checkOderSettlementAmount(String orderNo) {
|
|
|
TOrderNew tOrder= tOrderNewMapper.selectByPrimaryKey(orderNo);
|
|
|
- if (tOrder.getSettlementAmount()==null||tOrder.getSettlementAmount().doubleValue()==0){
|
|
|
+ if (tOrder.getSettlementAmount()==null||
|
|
|
+ tOrder.getSettlementAmount().doubleValue()==0||
|
|
|
+ tOrder.getOrderStatus()==OrderNewState.YTD.getCode()){
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Override
|
|
|
+ public Pagination<TOrderRefundBo> orderRefundList(String name, String orderNo, String starTime, String endTime, 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 (StringUtils.isNotBlank(name)) params.put("name", name);
|
|
|
+ if (StringUtils.isNotBlank(orderNo)) params.put("orderNo", orderNo);
|
|
|
+ if (StringUtils.isNotBlank(starTime)) params.put("starTime", starTime);
|
|
|
+ if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
|
|
|
+ Pagination<TOrderRefundBo> p = (Pagination<TOrderRefundBo>)findPage("selectOrderRefundListByPage", "selectOrderRefundListCount", params, pageNo, pageSize);
|
|
|
+ return p;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean checkORderTask(String orderNo) {
|
|
|
+ List<TOrderTaskBo> list=tOrderTaskMapper.selectOrderTask(orderNo);
|
|
|
+ for (TOrderTaskBo t : list) {
|
|
|
+ if (t.getMain()==1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|