|
@@ -15,10 +15,8 @@ import com.caimei.modules.product.entity.Product;
|
|
|
import com.caimei.modules.sys.utils.UploadImageUtils;
|
|
|
import com.caimei.modules.user.dao.NewCmShopDao;
|
|
|
import com.caimei.modules.user.entity.NewCmShop;
|
|
|
-import com.caimei.redis.RedisService;
|
|
|
import com.caimei.utils.MathUtil;
|
|
|
import com.caimei.utils.StringUtil;
|
|
|
-import com.opensymphony.module.sitemesh.html.CustomTag;
|
|
|
import com.thinkgem.jeesite.common.config.Global;
|
|
|
import com.thinkgem.jeesite.common.persistence.Page;
|
|
|
import com.thinkgem.jeesite.common.service.CrudService;
|
|
@@ -32,8 +30,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.beans.IntrospectionException;
|
|
|
-import java.lang.reflect.InvocationTargetException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -75,8 +71,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
private HeHeNewOrderDao heHeNewOrderDao;
|
|
|
@Resource
|
|
|
private CmRefundShopDao cmRefundShopDao;
|
|
|
- @Resource
|
|
|
- private RedisService redisService;
|
|
|
|
|
|
|
|
|
public List<CmPayShop> exports(Page<CmPayShop> cmPayShopPage, CmPayShop cmPayShop) {
|
|
@@ -976,7 +970,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
payShop.setBankAccount(payShopOther.getBankAccount());
|
|
|
payShop.setBankName(payShopOther.getBankName());
|
|
|
payShop.setType(payShopOther.getType().toString());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
payShop.setApplyTime(format);
|
|
|
payShop.setReviewTime(format);
|
|
@@ -987,7 +981,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
payShop.setWipePayment(0d);
|
|
|
payShop.setApplicant(currentUser.getId());
|
|
|
payShop.setApplyTime(time);
|
|
|
- String status = 2 == payShopOther.getPayType()?"1":"0";
|
|
|
+ String status = 2 == payShopOther.getPayType() ? "1" : "0";
|
|
|
payShop.setStatus(status);
|
|
|
payShop.setDelFlag("0");
|
|
|
if (payShopOther.getPayShopId() == null) {
|
|
@@ -1299,18 +1293,28 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly = false, rollbackFor = Exception.class)
|
|
|
- public void settlement(String shopOrderId, Double settleAmount) throws Exception {
|
|
|
+ public void settlement(String shopOrderId) throws Exception {
|
|
|
// 结算付供应商
|
|
|
String format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
|
|
|
String substring = format.substring(20);
|
|
|
String P3_customerNumber = newOrderDao.findSplitCode(shopOrderId);
|
|
|
- redisService.set("SDJSS", 1, 120L);
|
|
|
- settleOrder("JSCB" + shopOrderId + substring, settleAmount, P3_customerNumber, shopOrderId, 1);
|
|
|
+ Double shopCost = newOrderDao.findShopCost(shopOrderId);
|
|
|
+ settleOrder("JSCB" + shopOrderId + substring, shopCost, P3_customerNumber, shopOrderId, 1);
|
|
|
// 结算佣金 佣金目前分到网络
|
|
|
Double payAmount = newOrderDao.findPayAmount(shopOrderId);
|
|
|
if (null != payAmount && payAmount > 0) {
|
|
|
settleOrder("JSYJ" + shopOrderId + substring, payAmount, Constant.CUSTOMERNUM2, shopOrderId, 2);
|
|
|
}
|
|
|
+ // 有组织佣金/付第三方的情况下,还需要结算组织佣金,付第三方
|
|
|
+ Double payOrganize = newOrderDao.findPayOrganize(shopOrderId);
|
|
|
+ if (null != payOrganize && payOrganize > 0) {
|
|
|
+ String split = newOrderDao.findOrganizeSplitByShopOrder(shopOrderId);
|
|
|
+ settleOrder("JSZZ" + shopOrderId + substring, payOrganize, split, shopOrderId, 3);
|
|
|
+ }
|
|
|
+ Double payOther = newOrderDao.getOtherPaid(shopOrderId);
|
|
|
+ if (null != payOther && payOther > 0) {
|
|
|
+ settleOrder("JSDSF" + shopOrderId + substring, payOther, Constant.CUSTOMERNUM3, shopOrderId, 4);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly = false, rollbackFor = Exception.class)
|
|
@@ -1354,17 +1358,17 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
newOrderDao.insertSettleRecord(settleRecord);
|
|
|
// 修改cm_split_account settlestatus
|
|
|
newOrderDao.updateSettleStatus(shopOrderId, 1);
|
|
|
- //计算供应商成本,结算金额,修改结算状态
|
|
|
- Double shouldPayShopAmount = newOrderDao.findShouldPayShopAmount(shopOrderId);
|
|
|
- Double settleSum = newOrderDao.findSettleSum(shopOrderId);
|
|
|
- if (shouldPayShopAmount > settleSum) {
|
|
|
- //成本>结算金额,部分结算
|
|
|
- newOrderDao.updateShopOrderSettleStatus(shopOrderId, 2);
|
|
|
- } else {
|
|
|
+// //计算供应商成本,结算金额,修改结算状态
|
|
|
+// Double shouldPayShopAmount = newOrderDao.findShouldPayShopAmount(shopOrderId);
|
|
|
+// Double settleSum = newOrderDao.findSettleSum(shopOrderId);
|
|
|
+// if (shouldPayShopAmount > settleSum) {
|
|
|
+// //成本>结算金额,部分结算
|
|
|
+// newOrderDao.updateShopOrderSettleStatus(shopOrderId, 2);
|
|
|
+// } else {
|
|
|
//成本=结算金额 全部结算
|
|
|
newOrderDao.updateShopOrderSettleStatus(shopOrderId, 3);
|
|
|
- }
|
|
|
- } else {
|
|
|
+// }
|
|
|
+ } else {
|
|
|
//佣金结算
|
|
|
settleRecord.setSettleType(settleFlag);
|
|
|
settleRecord.setSettleAmount(settleAmount);
|
|
@@ -1374,8 +1378,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
|
// 修改cm_split_account settlestatus
|
|
|
newOrderDao.updateSettleStatus(shopOrderId, 3);
|
|
|
}
|
|
|
- //解锁
|
|
|
- redisService.remove("SDJSS");
|
|
|
}
|
|
|
}
|
|
|
}
|