|
@@ -5,9 +5,11 @@ import com.caimei.modules.order.dao.NewShopOrderDao;
|
|
|
import com.caimei.modules.order.entity.NewShopOrder;
|
|
|
import com.caimei.modules.order.entity.OrderReceiptRelationPo;
|
|
|
import com.caimei.modules.order.service.SplitAccountService;
|
|
|
+import com.caimei.redis.RedisService;
|
|
|
import com.thinkgem.jeesite.common.config.Global;
|
|
|
import com.thinkgem.jeesite.common.persistence.Page;
|
|
|
import com.thinkgem.jeesite.common.web.BaseController;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -31,10 +33,23 @@ public class SplitAccountController extends BaseController {
|
|
|
@Resource
|
|
|
private NewOrderDao newOrderDao;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private RedisService redisService;
|
|
|
+
|
|
|
@RequestMapping("split")
|
|
|
- public String SplitAccount(RedirectAttributes redirectAttributes){
|
|
|
+ public String SplitAccount(RedirectAttributes redirectAttributes) {
|
|
|
+ Integer xsfzmds = (Integer) redisService.get("XSFZMDS");
|
|
|
+ //验锁
|
|
|
+ if (null != xsfzmds && xsfzmds > 0) {
|
|
|
+ addMessage(redirectAttributes, "请勿短时间内重复分账,等待支付公司返回分账结果!");
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
|
|
|
+ }
|
|
|
//设置分账间隔,2-3分钟,禁止重复分账
|
|
|
-// newOrderDao.findSplitTime();
|
|
|
+ Date splitTime = newOrderDao.findSplitTime();
|
|
|
+ if (null != splitTime) {
|
|
|
+ addMessage(redirectAttributes, "请勿短时间内重复分账,等待支付公司返回分账结果!");
|
|
|
+ return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
|
|
|
+ }
|
|
|
//查询是否有账单可分账,没有return
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTime(new Date());
|
|
@@ -51,9 +66,11 @@ public class SplitAccountController extends BaseController {
|
|
|
orderRelations.addAll(onlineRelations);
|
|
|
}
|
|
|
if (null != orderRelations && orderRelations.size() > 0) {
|
|
|
+ //设锁
|
|
|
+ redisService.set("XSFZMDS", 1, 120L);
|
|
|
splitAccountService.SplitAccount();
|
|
|
addMessage(redirectAttributes, "分账成功!");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
addMessage(redirectAttributes, "暂无收款金额可进行分账!");
|
|
|
}
|
|
|
return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
|