Administrator
2025-04-21 a217652d33c75df23202828000d82d0ca8555ac2
src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java
@@ -10,8 +10,10 @@
import com.taoke.autopay.entity.agent.ChannelAgentSettings;
import com.taoke.autopay.exception.KeyOrderException;
import com.taoke.autopay.exception.KeyVerifyException;
import com.taoke.autopay.exception.UserCreditException;
import com.taoke.autopay.exception.WxOrderCountException;
import com.taoke.autopay.factory.OrderFactory;
import com.taoke.autopay.manager.UserCreditManager;
import com.taoke.autopay.service.*;
import com.taoke.autopay.service.agent.ChannelAgentService;
import com.taoke.autopay.service.agent.ChannelAgentSettingService;
@@ -22,6 +24,8 @@
import com.taoke.autopay.vo.SubmitKeyInfo;
import com.taoke.autopay.vo.admin.IgnoreAgentOrderSettingVO;
import net.sf.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +44,8 @@
 */
@Service
public class KeyOrderServiceImpl implements KeyOrderService {
    private Logger loggerDebug= LoggerFactory.getLogger("debugLogger");
    @Resource
    private KeyOrderMapper keyOrderMapper;
@@ -70,6 +76,9 @@
    @Resource
    private WxUserService wxUserService;
    @Resource
    private UserCreditManager userCreditManager;
    @Override
@@ -208,6 +217,28 @@
            orderUpdate.setPayTime(new Date());
        }
        update(orderUpdate);
        // 增加积分
        try {
            boolean creditEnable = true;
            // 判断代理是否允许增加积分
            Long agengId = old.getAgentId();
            if(agengId!=null) {
                ChannelAgentSettings agentSettings =   channelAgentSettingService.selectByAgentId(agengId);
                if(agentSettings!=null&&agentSettings.getCreditEnable()!=null) {
                    creditEnable =agentSettings.getCreditEnable();
                }
            }
            if(creditEnable) {
                if (old.getOrderType() == Constant.ORDER_TYPE_DY) {
                    userCreditManager.addDYOrderPayRecord(old.getUid(), id);
                } else if (old.getOrderType() == Constant.ORDER_TYPE_KS) {
                    userCreditManager.addKSOrderPayRecord(old.getUid(), id);
                }
            }
        } catch (UserCreditException e) {
            loggerDebug.error("增加积分出错:"+id, e);
        }
    }
    @Transactional(rollbackFor = Exception.class)