|
@ -17,7 +17,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.dao.DataIntegrityViolationException;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
@ -58,7 +58,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
@Autowired
|
|
|
private TaskRuleDao taskRuleDao;
|
|
|
@Autowired
|
|
|
private StringRedisTemplate redisTemplate;
|
|
|
private CreditsUniqueDao creditsUniqueDao;
|
|
|
@Autowired
|
|
|
private ActiveRecordService activeRecordService;
|
|
|
@Autowired
|
|
@ -830,8 +830,6 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
public MixEnvelop<CreditsDetailDO, CreditsDetailDO> stepAddIntegrate(CreditsDetailDO creditsDetailDO){
|
|
|
try {
|
|
|
synchronized (creditsDetailDO.getPatientId()){
|
|
|
// String sqlAccount = "select * from wlyy_health_bank_account ba where ba.patient_id = '"+creditsDetailDO.getPatientId() +"'";
|
|
|
// List<AccountDO> accountDOList = jdbcTemplate.query(sqlAccount,new BeanPropertyRowMapper(AccountDO.class));
|
|
|
List<AccountDO> accountDOList = accountDao.findByPatientId(creditsDetailDO.getPatientId());
|
|
|
if (accountDOList != null && accountDOList.size() != 0){
|
|
|
creditsDetailDO.setAccountId(accountDOList.get(0).getId());
|
|
@ -855,7 +853,6 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
accountDO1.setUpdateTime(new Date());
|
|
|
accountDao.save(accountDO1);
|
|
|
List<AccountDO> accountDOS = accountDao.findByPatientId(creditsDetailDO.getPatientId());
|
|
|
// List<AccountDO> accountDOS = jdbcTemplate.query(sqlAccount,new BeanPropertyRowMapper(AccountDO.class));
|
|
|
creditsDetailDO.setAccountId(accountDOS.get(0).getId());
|
|
|
}
|
|
|
String sql1 = "select * from wlyy_health_bank_task_patient_detail where "+
|
|
@ -895,6 +892,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
creditsDetailDO.setUpdateTime(new Date());
|
|
|
creditsDetailDO.setCreateTime(new Date());
|
|
|
creditsDetailDO.setTradeType("ACTIVITY_TASK");
|
|
|
addCreditsUnique(creditsDetailDO);//新增唯一标识 防止重复领取积分
|
|
|
CreditsDetailDO creditsDetailDO2 = credittsLogDetailDao.save(creditsDetailDO);
|
|
|
AccountDO accountDO = accountDao.findOne(creditsDetailDO2.getAccountId());
|
|
|
accountDO.setTotal(accountDO.getTotal()+creditsDetailDO2.getIntegrate());
|
|
@ -910,6 +908,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
CreditsDetailDO creditsDetailDO1 = new CreditsDetailDO();
|
|
|
if (creditsDetailDO.getStepNumber()>0 && creditsDetailDO.getStepNumber()<=step){
|
|
|
creditsDetailDO1.setIntegrate(creditsDetailDO.getIntegrate());
|
|
|
creditsDetailDO1.setStepNumber(creditsDetailDO.getStepNumber());
|
|
|
creditsDetailDO1.setTradeDirection(1);
|
|
|
creditsDetailDO1.setSaasId("dev");
|
|
|
creditsDetailDO1.setTradeType("ACTIVITY_TASK");
|
|
@ -920,6 +919,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
creditsDetailDO1.setStatus(1);
|
|
|
creditsDetailDO1.setCreateTime(new Date());
|
|
|
creditsDetailDO1.setUpdateTime(new Date());
|
|
|
addCreditsUnique(creditsDetailDO1);//新增唯一标识 防止重复领取积分
|
|
|
creditsDetailDO1.setTransactionId(taskPatientDetailDO.getTaskId());
|
|
|
CreditsDetailDO creditsDetailDO2 = credittsLogDetailDao.save(creditsDetailDO1);
|
|
|
AccountDO accountDO = accountDao.findOne(creditsDetailDO2.getAccountId());
|
|
@ -944,6 +944,11 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
envelop.setDetailModelList(creditsDetailDOS);
|
|
|
return envelop;
|
|
|
}
|
|
|
}catch (DataIntegrityViolationException ce){
|
|
|
MixEnvelop<CreditsDetailDO, CreditsDetailDO> envelop = new MixEnvelop<>();
|
|
|
envelop.setStatus(-1);
|
|
|
envelop.setMessage("请勿重复领取积分");
|
|
|
return envelop;
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
MixEnvelop<CreditsDetailDO, CreditsDetailDO> envelop = new MixEnvelop<>();
|
|
@ -952,6 +957,28 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取现在时间
|
|
|
*
|
|
|
* @return 返回短时间字符串格式yyyy-MM-dd
|
|
|
*/
|
|
|
public static String getStringDateShort() {
|
|
|
Date currentTime = new Date();
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
return formatter.format(currentTime);
|
|
|
}
|
|
|
|
|
|
public void addCreditsUnique(CreditsDetailDO creditsDetailDO){
|
|
|
CreditsUniqueDO creditsUniqueDO = new CreditsUniqueDO();
|
|
|
creditsUniqueDO.setDate(getStringDateShort());
|
|
|
creditsUniqueDO.setCreateTime(new Date());
|
|
|
creditsUniqueDO.setStepNumber(creditsDetailDO.getStepNumber()+"");
|
|
|
creditsUniqueDO.setPatient(creditsDetailDO.getPatientId());
|
|
|
creditsUniqueDO.setIntegrate(creditsDetailDO.getIntegrate()+"");
|
|
|
creditsUniqueDO.setTaskId(creditsDetailDO.getTransactionId());
|
|
|
creditsUniqueDao.save(creditsUniqueDO);
|
|
|
}
|
|
|
|
|
|
public MixEnvelop doctorDescreaseIntegrate(String ruleId,String patientId,String doctorId,String hospital,String hospitalName,Integer integrate,String reason,String type,String name,String idcard) throws Exception {
|
|
|
MixEnvelop envelop = new MixEnvelop<>();
|
|
|
envelop.setObj(true);
|