|  | @@ -26,10 +26,12 @@ import com.fs.common.utils.ServletUtils;
 | 
											
												
													
														|  |  import com.fs.common.utils.StringUtils;
 |  |  import com.fs.common.utils.StringUtils;
 | 
											
												
													
														|  |  import com.fs.common.utils.ip.IpUtils;
 |  |  import com.fs.common.utils.ip.IpUtils;
 | 
											
												
													
														|  |  import com.fs.company.domain.Company;
 |  |  import com.fs.company.domain.Company;
 | 
											
												
													
														|  | 
 |  | +import com.fs.company.domain.CompanyDivItem;
 | 
											
												
													
														|  |  import com.fs.company.domain.CompanyUser;
 |  |  import com.fs.company.domain.CompanyUser;
 | 
											
												
													
														|  |  import com.fs.company.mapper.CompanyConfigMapper;
 |  |  import com.fs.company.mapper.CompanyConfigMapper;
 | 
											
												
													
														|  |  import com.fs.company.param.FsStoreStatisticsParam;
 |  |  import com.fs.company.param.FsStoreStatisticsParam;
 | 
											
												
													
														|  |  import com.fs.company.service.ICompanyConfigService;
 |  |  import com.fs.company.service.ICompanyConfigService;
 | 
											
												
													
														|  | 
 |  | +import com.fs.company.service.ICompanyDivItemService;
 | 
											
												
													
														|  |  import com.fs.company.service.ICompanyService;
 |  |  import com.fs.company.service.ICompanyService;
 | 
											
												
													
														|  |  import com.fs.company.service.ICompanyUserService;
 |  |  import com.fs.company.service.ICompanyUserService;
 | 
											
												
													
														|  |  import com.fs.company.vo.FsStorePaymentStatisticsVO;
 |  |  import com.fs.company.vo.FsStorePaymentStatisticsVO;
 | 
											
										
											
												
													
														|  | @@ -206,6 +208,9 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private RedPacketLogMapper redPacketLogMapper;
 |  |      private RedPacketLogMapper redPacketLogMapper;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private ICompanyDivItemService companyDivItemService;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 红包账户锁
 |  |       * 红包账户锁
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
										
											
												
													
														|  | @@ -421,6 +426,8 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 | 
											
												
													
														|  |                  orderType="course";
 |  |                  orderType="course";
 | 
											
												
													
														|  |              }else if (fsStorePayment.getBusinessType()==5){
 |  |              }else if (fsStorePayment.getBusinessType()==5){
 | 
											
												
													
														|  |                  orderType="appvip";
 |  |                  orderType="appvip";
 | 
											
												
													
														|  | 
 |  | +            } else if (fsStorePayment.getBusinessType()==7){
 | 
											
												
													
														|  | 
 |  | +                orderType="payment";
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              if(fsStorePayment.getPayMode().equals("wx")){
 |  |              if(fsStorePayment.getPayMode().equals("wx")){
 | 
											
										
											
												
													
														|  | @@ -508,6 +515,14 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 | 
											
												
													
														|  |                  Map<String, Object> extendInfoMap = new HashMap<>();
 |  |                  Map<String, Object> extendInfoMap = new HashMap<>();
 | 
											
												
													
														|  |                  extendInfoMap.put("org_req_seq_id", orderType+"-"+fsStorePayment.getPayCode());
 |  |                  extendInfoMap.put("org_req_seq_id", orderType+"-"+fsStorePayment.getPayCode());
 | 
											
												
													
														|  |                  request.setExtendInfo(extendInfoMap);
 |  |                  request.setExtendInfo(extendInfoMap);
 | 
											
												
													
														|  | 
 |  | +                //处理分账退款
 | 
											
												
													
														|  | 
 |  | +                //1.判断是否是全额退款
 | 
											
												
													
														|  | 
 |  | +                CompanyDivItem companyDivItem = null;
 | 
											
												
													
														|  | 
 |  | +                try {
 | 
											
												
													
														|  | 
 |  | +                    companyDivItem = HuiFuUtils.doRefundDiv(fsStorePayment.getPayMoney(), fsStorePayment.getPayMoney(), fsStorePayment, extendInfoMap);
 | 
											
												
													
														|  | 
 |  | +                } catch (Exception e) {
 | 
											
												
													
														|  | 
 |  | +                    logger.error("-----------------分账退款处理失败{}", e.getMessage());
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  |                  HuiFuRefundResult refund = huiFuService.refund(request);
 |  |                  HuiFuRefundResult refund = huiFuService.refund(request);
 | 
											
												
													
														|  |                  logger.info("订单退款返回结果:"+paymentId+""+refund);
 |  |                  logger.info("订单退款返回结果:"+paymentId+""+refund);
 | 
											
												
													
														|  |                  if((refund.getResp_code().equals("00000000")||refund.getResp_code().equals("00000100"))&&(refund.getTrans_stat().equals("S")||refund.getTrans_stat().equals("P"))){
 |  |                  if((refund.getResp_code().equals("00000000")||refund.getResp_code().equals("00000100"))&&(refund.getTrans_stat().equals("S")||refund.getTrans_stat().equals("P"))){
 | 
											
										
											
												
													
														|  | @@ -517,6 +532,15 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 | 
											
												
													
														|  |                      paymentMap.setRefundTime(DateUtils.getNowDate());
 |  |                      paymentMap.setRefundTime(DateUtils.getNowDate());
 | 
											
												
													
														|  |                      paymentMap.setRefundMoney(fsStorePayment.getPayMoney());
 |  |                      paymentMap.setRefundMoney(fsStorePayment.getPayMoney());
 | 
											
												
													
														|  |                      fsStorePaymentMapper.updateFsStorePayment(paymentMap);
 |  |                      fsStorePaymentMapper.updateFsStorePayment(paymentMap);
 | 
											
												
													
														|  | 
 |  | +                    try {
 | 
											
												
													
														|  | 
 |  | +                        //处理分账退款明细表
 | 
											
												
													
														|  | 
 |  | +                        if (companyDivItem !=null && companyDivItem.getId() != null) {
 | 
											
												
													
														|  | 
 |  | +                            companyDivItem.setIsRefund(1);
 | 
											
												
													
														|  | 
 |  | +                            companyDivItemService.updateCompanyDivItem(companyDivItem);
 | 
											
												
													
														|  | 
 |  | +                        }
 | 
											
												
													
														|  | 
 |  | +                    } catch (Exception e) {
 | 
											
												
													
														|  | 
 |  | +                        logger.error("-----------------分账退款明细处理失败{}", e.getMessage());
 | 
											
												
													
														|  | 
 |  | +                    }
 | 
											
												
													
														|  |                  }else {
 |  |                  }else {
 | 
											
												
													
														|  |                      throw new CustomException("退款请求失败"+refund.getResp_desc());
 |  |                      throw new CustomException("退款请求失败"+refund.getResp_desc());
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
										
											
												
													
														|  | @@ -1578,6 +1602,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 | 
											
												
													
														|  |          storePayment.setRemark("商城收款订单支付");
 |  |          storePayment.setRemark("商城收款订单支付");
 | 
											
												
													
														|  |          storePayment.setOpenId(openId);
 |  |          storePayment.setOpenId(openId);
 | 
											
												
													
														|  |          storePayment.setUserId(user.getUserId());
 |  |          storePayment.setUserId(user.getUserId());
 | 
											
												
													
														|  | 
 |  | +        storePayment.setPayMode("hf");//目前微信收款仅支持汇付
 | 
											
												
													
														|  |          fsStorePaymentMapper.insertFsStorePayment(storePayment);
 |  |          fsStorePaymentMapper.insertFsStorePayment(storePayment);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          //汇付支付
 |  |          //汇付支付
 |