|
|
@@ -32,9 +32,11 @@ import com.goafanti.common.dao.PatentPriceMapper;
|
|
|
import com.goafanti.common.dao.PaymentLogMapper;
|
|
|
import com.goafanti.common.dao.PaymentNodeMapper;
|
|
|
import com.goafanti.common.dao.SoftWritingPriceMapper;
|
|
|
+import com.goafanti.common.dao.TOrderMidMapper;
|
|
|
import com.goafanti.common.dao.TOrderOutsourceMapper;
|
|
|
import com.goafanti.common.dao.TOrderPaymentMapper;
|
|
|
import com.goafanti.common.dao.TOrderTaskMapper;
|
|
|
+import com.goafanti.common.dao.TTaskMidMapper;
|
|
|
import com.goafanti.common.dao.ThirdPartyCompanyMapper;
|
|
|
import com.goafanti.common.enums.NoticeStatus;
|
|
|
import com.goafanti.common.model.Admin;
|
|
|
@@ -47,6 +49,7 @@ import com.goafanti.common.model.PaymentNode;
|
|
|
import com.goafanti.common.model.SoftWritingPrice;
|
|
|
import com.goafanti.common.model.TOrderPayment;
|
|
|
import com.goafanti.common.model.TOrderTask;
|
|
|
+import com.goafanti.common.model.TTaskMid;
|
|
|
import com.goafanti.common.model.ThirdPartyCompany;
|
|
|
import com.goafanti.common.utils.AsyncUtils;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
@@ -103,12 +106,16 @@ public class ThirdPartyCompanyServiceImpl extends BaseMybatisDao<ThirdPartyComp
|
|
|
@Autowired
|
|
|
private TOrderOutsourceMapper tOrderOutsourceMapper;
|
|
|
@Autowired
|
|
|
+ private TTaskMidMapper tTaskMidMapper;
|
|
|
+ @Autowired
|
|
|
+ private TOrderMidMapper tOrderMidMapper;
|
|
|
+ @Autowired
|
|
|
private AsyncUtils asyncUtils;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public int addCompany(ThirdPartyCompany t,Integer calculation) {
|
|
|
+ public int addCompany(ThirdPartyCompany t,Integer calculation,Integer type) {
|
|
|
CompanyLibrary c=new CompanyLibrary();
|
|
|
String aid=TokenManager.getAdminId();
|
|
|
if(calculation==0) {
|
|
|
@@ -124,6 +131,10 @@ public class ThirdPartyCompanyServiceImpl extends BaseMybatisDao<ThirdPartyComp
|
|
|
}
|
|
|
t.setTotalAmount(t.getUnitPrice().multiply(new BigDecimal(t.getQuantity())));
|
|
|
}
|
|
|
+ if (type==1) {
|
|
|
+ tOrderTaskMapper.updateAddCostAmount(t.getTid(), t.getTotalAmount());
|
|
|
+ tOrderMidMapper.updateAddCostAmount(t.getTid(), t.getTotalAmount());
|
|
|
+ }
|
|
|
thirdPartyCompanyMapper.insertSelective(t);
|
|
|
return 1;
|
|
|
}
|
|
|
@@ -250,20 +261,57 @@ public class ThirdPartyCompanyServiceImpl extends BaseMybatisDao<ThirdPartyComp
|
|
|
thirdPartyCompanyMapper.deleteByPrimaryKey(Integer.valueOf(s));
|
|
|
}
|
|
|
}else {
|
|
|
- thirdPartyCompanyMapper.deleteByPrimaryKey(Integer.valueOf(id));
|
|
|
+ Integer tpcId=Integer.valueOf(id);
|
|
|
+ ThirdPartyCompany tpc=thirdPartyCompanyMapper.selectByPrimaryKey(tpcId);
|
|
|
+ thirdPartyCompanyMapper.deleteByPrimaryKey(tpcId);
|
|
|
+
|
|
|
+ List<outOrderPayment> list=tOrderPaymentMapper.selectList(tpcId, null, null);
|
|
|
+ for (outOrderPayment o : list) {
|
|
|
+ TOrderPayment t=new TOrderPayment();
|
|
|
+ t.setId(o.getId());
|
|
|
+ t.setStatus(4);
|
|
|
+ tOrderPaymentMapper.updateByPrimaryKeySelective(t);
|
|
|
+ }
|
|
|
+ paymentNodeMapper.deleteByParam(tpcId,null);
|
|
|
+ sumTaskCost(tpc.getTid());
|
|
|
+ updateCountByTid(tpc.getId());
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public void sumTaskCost(Integer tid) {
|
|
|
+ List<OutThirdPartyCompany>list=thirdPartyCompanyMapper.selectByTid(tid);
|
|
|
+ BigDecimal tCount=new BigDecimal(0);
|
|
|
+ for (OutThirdPartyCompany op : list) {
|
|
|
+ tCount=tCount.add(new BigDecimal(op.getTotalAmount()));
|
|
|
+ }
|
|
|
+ tTaskMidMapper.updateCostAmount(tid,tCount);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
- public int deletePaymentNode(String id) {
|
|
|
- if (id.contains(",")) {
|
|
|
- String []ids =id.split(",");
|
|
|
- for (String s : ids) {
|
|
|
+ public int deletePaymentNode(String ids) {
|
|
|
+ if (ids.contains(",")) {
|
|
|
+ String []ids2 =ids.split(",");
|
|
|
+ for (String s : ids2) {
|
|
|
paymentNodeMapper.deleteByPrimaryKey(Integer.valueOf(s));
|
|
|
}
|
|
|
- }else paymentNodeMapper.deleteByPrimaryKey(Integer.valueOf(id));
|
|
|
+ }else {
|
|
|
+ Integer id=Integer.valueOf(ids);
|
|
|
+ paymentNodeMapper.deleteByPrimaryKey(Integer.valueOf(id));
|
|
|
+ List<outOrderPayment> list=tOrderPaymentMapper.selectList(null, id, null);
|
|
|
+ for (outOrderPayment o : list) {
|
|
|
+ TOrderPayment t=new TOrderPayment();
|
|
|
+ t.setId(o.getId());
|
|
|
+ t.setStatus(4);
|
|
|
+ tOrderPaymentMapper.updateByPrimaryKeySelective(t);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@@ -1019,4 +1067,124 @@ public class ThirdPartyCompanyServiceImpl extends BaseMybatisDao<ThirdPartyComp
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> checkThirdParty(Integer id) {
|
|
|
+ int x =tOrderPaymentMapper.selectByCid(id);
|
|
|
+ int y = paymentNodeMapper.selectByCid(id);
|
|
|
+ Integer i=0;
|
|
|
+ String desc="您已有%s,确定则一并删除。";
|
|
|
+ Map<String, Object> map=new HashedMap<String, Object>();
|
|
|
+ StringBuffer src=new StringBuffer();
|
|
|
+ if(x>0){
|
|
|
+ i++;
|
|
|
+ src.append("付款记录、");
|
|
|
+ }
|
|
|
+ if(y>0){
|
|
|
+ i++;
|
|
|
+ src.append("付款催款、");
|
|
|
+ }
|
|
|
+ map.put("code", i);
|
|
|
+ if (i!=0) {
|
|
|
+ src.delete(src.length()-1, src.length());
|
|
|
+ desc=String.format(desc, src);
|
|
|
+ map.put("desc", desc);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object updateCheck(Integer id,Integer type) {
|
|
|
+ Map<String, Object> map=new HashedMap<String, Object>();
|
|
|
+ if (type==0) {
|
|
|
+ Integer i=0;
|
|
|
+ String desc="您已有%s,确定则一并删除。";
|
|
|
+ StringBuffer src=new StringBuffer();
|
|
|
+ List<OutThirdPartyCompany> list=thirdPartyCompanyMapper.selectByTid(id);
|
|
|
+ List<OutPaymentNode> list2=paymentNodeMapper.selectByTid(id, null);
|
|
|
+ List<outOrderPayment> list3=tOrderPaymentMapper.selectByTid(id, null);
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ src.append("第三方").append("、");
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (!list2.isEmpty()) {
|
|
|
+ src.append("付款催款").append("、");
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (!list3.isEmpty()) {
|
|
|
+ src.append("付款记录").append("、");
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (i!=0) {
|
|
|
+ src.delete(src.length()-1, src.length());
|
|
|
+ desc=String.format(desc, src);
|
|
|
+ map.put("desc", desc);
|
|
|
+ }
|
|
|
+ map.put("code", i);
|
|
|
+ }else if(type==1) {
|
|
|
+ thirdPartyCompanyMapper.deleteByTid(id);
|
|
|
+ paymentNodeMapper.deleteByParam(null,id);
|
|
|
+ List<outOrderPayment> list=tOrderPaymentMapper.selectByTid(id,null);
|
|
|
+ for (outOrderPayment o : list) {
|
|
|
+ TOrderPayment t=new TOrderPayment();
|
|
|
+ t.setId(o.getId());
|
|
|
+ t.setStatus(4);
|
|
|
+ tOrderPaymentMapper.updateByPrimaryKeySelective(t);
|
|
|
+ }
|
|
|
+ tOrderTaskMapper.resstPayment(id);
|
|
|
+ updateCountByTid(id);
|
|
|
+ map.put("desc", "已全部删除");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据项目编号重新计算订单成本与已付
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ private void updateCountByTid(Integer id) {
|
|
|
+ List<TTaskMid> list=tTaskMidMapper.selectListByTid(id);
|
|
|
+ BigDecimal cost=new BigDecimal(0);
|
|
|
+ BigDecimal party=new BigDecimal(0);
|
|
|
+ for (TTaskMid t : list) {
|
|
|
+ cost=cost.add(t.getCostAmount());
|
|
|
+ party=party.add(t.getPartyAmount());
|
|
|
+ }
|
|
|
+ tOrderMidMapper.updateCostAmount(id, cost,party);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object checkNode(Integer id) {
|
|
|
+ Integer i=0;
|
|
|
+ String desc="您已有%s,确定则一并删除。";
|
|
|
+ StringBuffer src=new StringBuffer();
|
|
|
+ Map<String, Object> map=new HashedMap<String, Object>();
|
|
|
+ List<outOrderPayment> list3=tOrderPaymentMapper.selectList(null, id, null);
|
|
|
+ if (!list3.isEmpty()) {
|
|
|
+ src.append("付款记录");
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (i!=0) {
|
|
|
+ desc=String.format(desc, src);
|
|
|
+ map.put("desc", desc);
|
|
|
+ }
|
|
|
+ map.put("code", i);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|