|
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
|
|
import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
|
|
|
|
|
|
|
|
+import org.springframework.http.HttpStatus;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -66,7 +67,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
|
|
private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
@Autowired
|
|
@Autowired
|
|
private SysMessageService sysMessageService;
|
|
private SysMessageService sysMessageService;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private CooperationOrganService cooperationOrganService;
|
|
private CooperationOrganService cooperationOrganService;
|
|
|
|
|
|
@@ -86,12 +87,12 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
|
|
}
|
|
}
|
|
replacementInstrumentActivity.setUserId(sysUser.getId());
|
|
replacementInstrumentActivity.setUserId(sysUser.getId());
|
|
//如果用户是43分部,那么修改用户信息
|
|
//如果用户是43分部,那么修改用户信息
|
|
- if(sysUser.getOrganId() == 43){
|
|
|
|
- CooperationOrgan cooperationOrgan = cooperationOrganService.get(replacementInstrumentActivity.getCooperationOrganId());
|
|
|
|
|
|
+ if (sysUser.getOrganId() == 43) {
|
|
|
|
+ CooperationOrgan cooperationOrgan = cooperationOrganService.get(replacementInstrumentActivity.getCooperationOrganId());
|
|
if (cooperationOrgan != null) {
|
|
if (cooperationOrgan != null) {
|
|
- sysUser.setOrganId(cooperationOrgan.getOrganId());
|
|
|
|
- sysUser.setUpdateTime(new Date());
|
|
|
|
- sysUserFeignService.updateSysUser(sysUser);
|
|
|
|
|
|
+ sysUser.setOrganId(cooperationOrgan.getOrganId());
|
|
|
|
+ sysUser.setUpdateTime(new Date());
|
|
|
|
+ sysUserFeignService.updateSysUser(sysUser);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//如果提交过调查问卷,那么覆盖之前的记录
|
|
//如果提交过调查问卷,那么覆盖之前的记录
|
|
@@ -141,15 +142,21 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public Map pay(ReplacementPayDto replacementPayDto) throws Exception {
|
|
public Map pay(ReplacementPayDto replacementPayDto) throws Exception {
|
|
ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityDao.getLock(replacementPayDto.getId());
|
|
ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityDao.getLock(replacementPayDto.getId());
|
|
- if (replacementInstrumentActivity == null) {
|
|
|
|
- throw new BizException("乐器置换不存在,请核查");
|
|
|
|
- }
|
|
|
|
- if (replacementInstrumentActivity.getInstrumentsId() == null || replacementInstrumentActivity.getInstrumentsId() == 0) {
|
|
|
|
- throw new BizException("没有置换的乐器,请核查");
|
|
|
|
- }
|
|
|
|
Integer userId = replacementInstrumentActivity.getUserId();
|
|
Integer userId = replacementInstrumentActivity.getUserId();
|
|
|
|
+
|
|
|
|
+ //处理关闭订单
|
|
|
|
+ if (replacementInstrumentActivity.getPayStatus().equals(1) && replacementPayDto.getRePay()) {
|
|
|
|
+ StudentPaymentOrder oldOrder = studentPaymentOrderService.getUserReplacementIngOrder(userId, replacementInstrumentActivity.getId());
|
|
|
|
+ if (oldOrder != null) {
|
|
|
|
+ oldOrder.setStatus(DealStatusEnum.FAILED);
|
|
|
|
+ oldOrder.setMemo("用户手动关闭");
|
|
|
|
+ studentPaymentOrderService.callOrderCallBack(oldOrder);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
ReplacementInstrument replacementInstrument = replacementInstrumentDao.get(replacementInstrumentActivity.getInstrumentsId());
|
|
ReplacementInstrument replacementInstrument = replacementInstrumentDao.get(replacementInstrumentActivity.getInstrumentsId());
|
|
BigDecimal orderAmount = replacementInstrument.getSalePrice();
|
|
BigDecimal orderAmount = replacementInstrument.getSalePrice();
|
|
BigDecimal amount = replacementPayDto.getAmount(); //扣除余额之前的金额
|
|
BigDecimal amount = replacementPayDto.getAmount(); //扣除余额之前的金额
|
|
@@ -326,4 +333,9 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ReplacementInstrumentActivityStatDto getInfo(Integer id) {
|
|
|
|
+ return replacementInstrumentActivityDao.getInfo(id);
|
|
|
|
+ }
|
|
}
|
|
}
|