|
|
@@ -257,32 +257,42 @@ public class ThirdPartyCompanyServiceImpl extends BaseMybatisDao<ThirdPartyComp
|
|
|
|
|
|
@Override
|
|
|
public int deleteCompany(String id) {
|
|
|
+ Integer tpcId=null;
|
|
|
+ Integer tid=null;
|
|
|
if (id.contains(",")) {
|
|
|
String []ids =id.split(",");
|
|
|
for (String s : ids) {
|
|
|
- thirdPartyCompanyMapper.deleteByPrimaryKey(Integer.valueOf(s));
|
|
|
+ tpcId=Integer.valueOf(s);
|
|
|
+ ThirdPartyCompany tpc=thirdPartyCompanyMapper.selectByPrimaryKey(tpcId);
|
|
|
+ tid=tpc.getTid();
|
|
|
+ thirdPartyCompanyMapper.deleteByPrimaryKey(tpcId);
|
|
|
+ pushDeleteCompany(tpc);
|
|
|
}
|
|
|
}else {
|
|
|
- Integer tpcId=Integer.valueOf(id);
|
|
|
+ tpcId=Integer.valueOf(id);
|
|
|
ThirdPartyCompany tpc=thirdPartyCompanyMapper.selectByPrimaryKey(tpcId);
|
|
|
+ tid=tpc.getTid();
|
|
|
thirdPartyCompanyMapper.deleteByPrimaryKey(tpcId);
|
|
|
+ pushDeleteCompany(tpc);
|
|
|
|
|
|
- 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.getTid());
|
|
|
}
|
|
|
+ sumTaskCost(tid);
|
|
|
+ updateCountByTid(tid);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+ private void pushDeleteCompany(ThirdPartyCompany tpc) {
|
|
|
|
|
|
+ List<outOrderPayment> list=tOrderPaymentMapper.selectList(tpc.getId(), null, null);
|
|
|
+ for (outOrderPayment o : list) {
|
|
|
+ TOrderPayment t=new TOrderPayment();
|
|
|
+ t.setId(o.getId());
|
|
|
+ t.setStatus(4);
|
|
|
+ tOrderPaymentMapper.updateByPrimaryKeySelective(t);
|
|
|
+ }
|
|
|
+ paymentNodeMapper.deleteByParam(tpc.getId(),null);
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
public void sumTaskCost(Integer tid) {
|
|
|
@@ -291,7 +301,15 @@ public class ThirdPartyCompanyServiceImpl extends BaseMybatisDao<ThirdPartyComp
|
|
|
for (OutThirdPartyCompany op : list) {
|
|
|
tCount=tCount.add(new BigDecimal(op.getTotalAmount()));
|
|
|
}
|
|
|
- tTaskMidMapper.updateCostAmount(tid,tCount);
|
|
|
+ BigDecimal party=new BigDecimal(0);
|
|
|
+ List<outOrderPayment> paymentList = tOrderPaymentMapper.selectByTid(tid, null, null);
|
|
|
+ for (outOrderPayment oo : paymentList) {
|
|
|
+ if (oo.getStatus()==3){
|
|
|
+ party=party.add(oo.getApplicationAmount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ tTaskMidMapper.updateCostAmount(tid,tCount,party);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -564,7 +582,7 @@ public class ThirdPartyCompanyServiceImpl extends BaseMybatisDao<ThirdPartyComp
|
|
|
list=tOrderPaymentMapper.selectList(null,p.getNodeId(),p.getChooseType());
|
|
|
}
|
|
|
for (outOrderPayment o : list) {
|
|
|
- a=a.add(new BigDecimal(o.getApplicationAmount()));
|
|
|
+ a=a.add(o.getApplicationAmount());
|
|
|
}
|
|
|
if (p.getChooseType()==0) {
|
|
|
ThirdPartyCompany t=thirdPartyCompanyMapper.selectByPrimaryKey(p.getTpcId());
|