|
@@ -9,7 +9,6 @@ import com.thinkgem.jeesite.common.config.Global;
|
|
import com.thinkgem.jeesite.common.persistence.Page;
|
|
import com.thinkgem.jeesite.common.persistence.Page;
|
|
import com.thinkgem.jeesite.common.service.CrudService;
|
|
import com.thinkgem.jeesite.common.service.CrudService;
|
|
import com.thinkgem.jeesite.common.utils.DateUtils;
|
|
import com.thinkgem.jeesite.common.utils.DateUtils;
|
|
-import com.thinkgem.jeesite.common.utils.MacUtils;
|
|
|
|
import com.thinkgem.jeesite.common.utils.StringUtils;
|
|
import com.thinkgem.jeesite.common.utils.StringUtils;
|
|
import com.thinkgem.jeesite.modules.sys.entity.User;
|
|
import com.thinkgem.jeesite.modules.sys.entity.User;
|
|
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
|
|
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
|
|
@@ -49,6 +48,8 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
|
|
private NewOrderDao newOrderDao;
|
|
private NewOrderDao newOrderDao;
|
|
@Resource
|
|
@Resource
|
|
private CmReceiptOrderRelationDao cmReceiptOrderRelationDao;
|
|
private CmReceiptOrderRelationDao cmReceiptOrderRelationDao;
|
|
|
|
+ @Resource
|
|
|
|
+ private CmPayShopRecordDao cmPayShopRecordDao;
|
|
|
|
|
|
public CmRefundShop get(String id) {
|
|
public CmRefundShop get(String id) {
|
|
return super.get(id);
|
|
return super.get(id);
|
|
@@ -130,7 +131,7 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
|
|
} else {
|
|
} else {
|
|
so.setRefundsAmount(0d);
|
|
so.setRefundsAmount(0d);
|
|
}
|
|
}
|
|
- refundAmount += (so.getPayedShopAmount()-so.getRefundsAmount()-so.getShouldPayShopAmount());
|
|
|
|
|
|
+ refundAmount += (so.getPayedShopAmount() - so.getRefundsAmount() - so.getShouldPayShopAmount());
|
|
List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
|
|
List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
|
|
/*
|
|
/*
|
|
1. 若发生退货,数量要减去已退货和已取消的数量
|
|
1. 若发生退货,数量要减去已退货和已取消的数量
|
|
@@ -140,15 +141,6 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
|
|
Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
|
|
Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
|
|
returnNum = returnNum == null ? 0 : returnNum;
|
|
returnNum = returnNum == null ? 0 : returnNum;
|
|
p.setReturnedNum(returnNum);
|
|
p.setReturnedNum(returnNum);
|
|
- /*if ( returnNum!=null && returnNum>0 ){
|
|
|
|
- if (p.getPresentNum()>0) {
|
|
|
|
- p.setNum(0);
|
|
|
|
- p.setPresentNum(0);
|
|
|
|
- } else {
|
|
|
|
- p.setNum(p.getNum()-returnNum);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- p.setReturnedNum((returnNum !=null && returnNum>0)?returnNum:0);*/
|
|
|
|
}
|
|
}
|
|
so.setNewOrderProducts(orderProductList);
|
|
so.setNewOrderProducts(orderProductList);
|
|
//主订单退款(退货)总金额
|
|
//主订单退款(退货)总金额
|
|
@@ -167,6 +159,22 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
|
|
} else {
|
|
} else {
|
|
List<NewShopOrder> payOrderList = newShopOrderDao.findByRefundID(cmRefundShop.getId());
|
|
List<NewShopOrder> payOrderList = newShopOrderDao.findByRefundID(cmRefundShop.getId());
|
|
List<CmRefundShopRecord> refundRecord = cmRefundShopRecordDao.getByRefundShopID(cmRefundShop.getId());
|
|
List<CmRefundShopRecord> refundRecord = cmRefundShopRecordDao.getByRefundShopID(cmRefundShop.getId());
|
|
|
|
+ //差价退款备注
|
|
|
|
+ for (CmRefundShopRecord shopRecord : refundRecord) {
|
|
|
|
+ if (shopRecord.getRefundType() != null && "5".equals(shopRecord.getRefundType())) {
|
|
|
|
+ cmRefundShop.setRecordRefundType(5);
|
|
|
|
+ List<ChangePayShopDifference> shopDifferenceList = cmPayShopRecordDao.findShopDifference(Integer.valueOf(shopRecord.getShopOrderID()));
|
|
|
|
+ if (shopDifferenceList != null && shopDifferenceList.size() > 0) {
|
|
|
|
+ ChangePayShopDifference difference = shopDifferenceList.get(0);
|
|
|
|
+ User user = UserUtils.get(difference.getModifyUserId().toString());
|
|
|
|
+ if (user != null) {
|
|
|
|
+ difference.setSystemName(user.getName());
|
|
|
|
+ }
|
|
|
|
+ cmRefundShop.setShopDifference(difference);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
for (NewShopOrder so : payOrderList) {
|
|
for (NewShopOrder so : payOrderList) {
|
|
//统计该子订单的主的收款金额和收款状态
|
|
//统计该子订单的主的收款金额和收款状态
|
|
NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
|
|
NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
|
|
@@ -191,14 +199,6 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
|
|
Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
|
|
Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
|
|
returnNum = returnNum == null ? 0 : returnNum;
|
|
returnNum = returnNum == null ? 0 : returnNum;
|
|
p.setReturnedNum(returnNum);
|
|
p.setReturnedNum(returnNum);
|
|
- /*if ( returnNum!=null && returnNum>0 ){
|
|
|
|
- if (p.getPresentNum()>0) {
|
|
|
|
- p.setNum(0);
|
|
|
|
- p.setPresentNum(0);
|
|
|
|
- } else {
|
|
|
|
- p.setNum(p.getNum()-returnNum);
|
|
|
|
- }
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|
|
so.setNewOrderProducts(orderProductList);
|
|
so.setNewOrderProducts(orderProductList);
|
|
so.setRefundAmount(record.getRefundAmount());
|
|
so.setRefundAmount(record.getRefundAmount());
|