33b0a7979fbd66867e3541e75b65171a8e9e1491.svn-base 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package cn.com.goldenwater.dcproj.service.impl.tac;
  2. import cn.com.goldenwater.core.service.AbstractCrudService;
  3. import cn.com.goldenwater.dcproj.dao.TacActiveLogDao;
  4. import cn.com.goldenwater.dcproj.model.BisInspAllRlationPers;
  5. import cn.com.goldenwater.dcproj.model.TacActiveLog;
  6. import cn.com.goldenwater.dcproj.model.TacPawpRgstr;
  7. import cn.com.goldenwater.dcproj.param.TacActiveLogParam;
  8. import cn.com.goldenwater.dcproj.service.BisInspAllRlationPersService;
  9. import cn.com.goldenwater.dcproj.service.TacActiveLogService;
  10. import cn.com.goldenwater.dcproj.service.TacPawpRgstrService;
  11. import cn.com.goldenwater.id.util.UuidUtil;
  12. import org.apache.commons.lang3.StringUtils;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.data.redis.core.RedisTemplate;
  15. import org.springframework.stereotype.Service;
  16. import org.springframework.transaction.annotation.Transactional;
  17. import java.util.Date;
  18. /**
  19. * @author lune
  20. * @date 2019-10-17
  21. */
  22. @Service
  23. @Transactional(rollbackFor = Exception.class)
  24. public class TacActiveLogServiceImpl extends AbstractCrudService<TacActiveLog, TacActiveLogParam> implements TacActiveLogService {
  25. @Autowired
  26. private TacActiveLogDao tacActiveLogDao;
  27. @Autowired
  28. private BisInspAllRlationPersService inspAllRlationPersService;
  29. @Autowired
  30. private TacPawpRgstrService pawpRgstrService;
  31. @Autowired
  32. private RedisTemplate redisTemplate;
  33. public TacActiveLogServiceImpl(TacActiveLogDao tacActiveLogDao) {
  34. super(tacActiveLogDao);
  35. this.tacActiveLogDao = tacActiveLogDao;
  36. }
  37. @Override
  38. public void addTacLog(String name,String content, String registrId, String type, String state,String stepId, String note, String persId) {
  39. if(StringUtils.isBlank(persId)){
  40. return;
  41. }
  42. TacActiveLog activeLog=new TacActiveLog();
  43. activeLog.setId(UuidUtil.uuid());
  44. activeLog.setName(name);
  45. if(StringUtils.isBlank(name)) {
  46. TacPawpRgstr pawpRgstr = pawpRgstrService.get(registrId);
  47. if (pawpRgstr == null) {
  48. return;
  49. }
  50. activeLog.setName(pawpRgstr.getName());
  51. }
  52. activeLog.setContent(content);
  53. activeLog.setRegstrId(registrId);
  54. activeLog.setType(type);
  55. activeLog.setState(state);
  56. activeLog.setNote(note);
  57. activeLog.setStepId(stepId);
  58. activeLog.setPersid(persId);
  59. BisInspAllRlationPers allRlationPers= (BisInspAllRlationPers) redisTemplate.opsForValue().get(persId);
  60. if(allRlationPers==null) {
  61. allRlationPers = inspAllRlationPersService.get(persId);
  62. redisTemplate.opsForValue().set(persId,allRlationPers);
  63. }
  64. activeLog.setPersName(allRlationPers.getPersName());
  65. activeLog.setIntm(new Date());
  66. tacActiveLogDao.insert(activeLog);
  67. }
  68. }