package com.hx.phip.service.tool; import com.hx.common.service.CommonService; import com.hx.phiappt.common.OperationReasonConstants; import com.hx.phiappt.model.BaseEntity; import com.hx.phiappt.model.User; import com.hx.phiappt.model.order.OrdersTotal; import com.hx.phiappt.model.userMoney.UserMoneyUnclaimed; import com.hx.phip.config.CrmBean; import com.hx.phip.service.UserService; import com.hx.phip.tool.user.UserMessageNotifyTool; import com.hx.phip.util.api.UserMoneyUtil; import com.hx.util.DateUtil; import com.hx.util.StringUtils; import com.hz.his.dto.order.PayDto; import com.hz.his.feign.service.platform.SWxTokenService; import com.hz.sms.feign.FSmsSendService; import com.hz.sms.feign.FWXSendService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.Date; /**订单工具类 * @author CJH*/ @Component public class OrderGeneralServiceTool { /**log4j日志*/ private static Logger logger = LoggerFactory.getLogger(OrderGeneralServiceTool.class.getName()); @Resource private CommonService commonService; @Resource private CrmBean crmBean; @Resource private FWXSendService fwxSendService; @Resource private UserService userService; @Resource private SWxTokenService sWxTokenService; @Resource private FSmsSendService fSmsSendService; /**活动赠送增值金处理-结账时候运行*/ public void giveIncreaseByActivity(PayDto payDto, OrdersTotal ordersTotal){ User user = userService.selectOneByKey(payDto.getGiveIncreaseUserId()); if(user == null){ return; } //增值金到账处理 UserMoneyUnclaimed userMoneyUnclaimed = UserMoneyUtil.setUserMoneyHandle(payDto.getGiveIncreaseUserId(), UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND,payDto.getGiveIncrease(), BaseEntity.YES, OperationReasonConstants.OP_REASON_INVITE_ORDER,payDto.getGiveIncreaseTitle(),payDto.getGiveIncreaseInfo(),ordersTotal.getOperatorId() ,ordersTotal.getId(),ordersTotal.getActivityPageCode(),payDto.getGiveIncreaseId(),commonService); try { //发送服务消息,艾芯荟 UserMessageNotifyTool.sendBurstIncreaseMp(ordersTotal.getOrderNo(), BigDecimal.ZERO,payDto.getGiveIncrease(), DateUtil.formatDate(ordersTotal.getPayTime(),"yyyy-MM-dd") ,ordersTotal.getActivityPageName(),payDto.getGiveIncreaseUserId(),crmBean.getAppId(),crmBean.getVersion(),fwxSendService,commonService); }catch (Exception e){ logger.error("[12546]错误信息:",e); } try { if(StringUtils.noNull(user.getTel())){ //发送短信通知 UserMessageNotifyTool.sendBurstIncreaseSms(ordersTotal.getActivityPageName(),userMoneyUnclaimed.getLimitEndTime(),payDto.getGiveIncrease(),user,crmBean.getAppId(),crmBean.getVersion(),sWxTokenService,fSmsSendService); } }catch (Exception e){ logger.error("[12547]错误信息:",e); } } }