package cn.com.goldenwater.dcproj.service.impl.tac; import cn.com.goldenwater.core.service.AbstractCrudService; import cn.com.goldenwater.dcproj.dao.TacActiveLogDao; import cn.com.goldenwater.dcproj.model.BisInspAllRlationPers; import cn.com.goldenwater.dcproj.model.TacActiveLog; import cn.com.goldenwater.dcproj.model.TacPawpRgstr; import cn.com.goldenwater.dcproj.param.TacActiveLogParam; import cn.com.goldenwater.dcproj.service.BisInspAllRlationPersService; import cn.com.goldenwater.dcproj.service.TacActiveLogService; import cn.com.goldenwater.dcproj.service.TacPawpRgstrService; import cn.com.goldenwater.id.util.UuidUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; /** * @author lune * @date 2019-10-17 */ @Service @Transactional(rollbackFor = Exception.class) public class TacActiveLogServiceImpl extends AbstractCrudService implements TacActiveLogService { @Autowired private TacActiveLogDao tacActiveLogDao; @Autowired private BisInspAllRlationPersService inspAllRlationPersService; @Autowired private TacPawpRgstrService pawpRgstrService; @Autowired private RedisTemplate redisTemplate; public TacActiveLogServiceImpl(TacActiveLogDao tacActiveLogDao) { super(tacActiveLogDao); this.tacActiveLogDao = tacActiveLogDao; } @Override public void addTacLog(String name,String content, String registrId, String type, String state,String stepId, String note, String persId) { if(StringUtils.isBlank(persId)){ return; } TacActiveLog activeLog=new TacActiveLog(); activeLog.setId(UuidUtil.uuid()); activeLog.setName(name); if(StringUtils.isBlank(name)) { TacPawpRgstr pawpRgstr = pawpRgstrService.get(registrId); if (pawpRgstr == null) { return; } activeLog.setName(pawpRgstr.getName()); } activeLog.setContent(content); activeLog.setRegstrId(registrId); activeLog.setType(type); activeLog.setState(state); activeLog.setNote(note); activeLog.setStepId(stepId); activeLog.setPersid(persId); BisInspAllRlationPers allRlationPers= (BisInspAllRlationPers) redisTemplate.opsForValue().get(persId); if(allRlationPers==null) { allRlationPers = inspAllRlationPersService.get(persId); redisTemplate.opsForValue().set(persId,allRlationPers); } activeLog.setPersName(allRlationPers.getPersName()); activeLog.setIntm(new Date()); tacActiveLogDao.insert(activeLog); } }