|
@ -1067,4 +1067,46 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 健康问答添加积分
|
|
|
*
|
|
|
* @param creditsDetailDO
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public MixEnvelop<CreditsDetailDO,CreditsDetailDO> patientGetInteger(CreditsDetailDO creditsDetailDO) throws Exception {
|
|
|
MixEnvelop<CreditsDetailDO,CreditsDetailDO> envelop = new MixEnvelop<>();
|
|
|
AccountDO accountDO = accountDao.selectByPatientId(creditsDetailDO.getAccountId());
|
|
|
creditsDetailDO.setUpdateTime(new Date());
|
|
|
creditsDetailDO.setCreateTime(new Date());
|
|
|
creditsDetailDO.setStatus(1);
|
|
|
creditsDetailDO.setIntegrate(creditsDetailDO.getIntegrate());
|
|
|
creditsDetailDO.setSaasId("dev");
|
|
|
creditsDetailDO.setTradeType("ACTIVITY_TASK");
|
|
|
creditsDetailDO.setTradeDirection(1);
|
|
|
creditsDetailDO.setAccountId(accountDO.getId());
|
|
|
CreditsDetailDO creditsDetailDO1 = credittsLogDetailDao.save(creditsDetailDO);
|
|
|
if (creditsDetailDO1 == null){
|
|
|
throw new Exception("积分添加失败!");
|
|
|
}
|
|
|
TaskPatientDetailDO patientDetailDO = taskPatientDetailDao.selectByTaskIdAndPatientId(creditsDetailDO.getTransactionId(),creditsDetailDO.getPatientId());
|
|
|
patientDetailDO.setUpdateTime(new Date());
|
|
|
patientDetailDO.setTotal(patientDetailDO.getTotal()+creditsDetailDO.getIntegrate());
|
|
|
patientDetailDO.setStatus(1);
|
|
|
TaskPatientDetailDO taskPatientDetailDO = taskPatientDetailDao.save(patientDetailDO);
|
|
|
if (taskPatientDetailDO == null){
|
|
|
throw new Exception("修改活动状态和积分失败!");
|
|
|
}
|
|
|
accountDO.setTotal(accountDO.getTotal()+creditsDetailDO.getIntegrate());
|
|
|
accountDO.setUpdateTime(new Date());
|
|
|
AccountDO accountDO1 = accountDao.save(accountDO);
|
|
|
if (accountDO1 == null){
|
|
|
throw new Exception("修改银行账户积分失败!");
|
|
|
}
|
|
|
envelop.setObj(creditsDetailDO);
|
|
|
return envelop;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|