CustomerInfoFeedbackService.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package com.ygj.yuemum.service.customer;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.github.pagehelper.PageHelper;
  4. import com.ygj.yuemum.dao.customer.CustomerInfoFeedbackDao;
  5. import com.ygj.yuemum.domain.admin.JlAdminUser;
  6. import com.ygj.yuemum.domain.customer.CustomerInfoFeedback;
  7. import com.ygj.yuemum.domain.customer.CustomerInfoServiceLog;
  8. import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackCyDto;
  9. import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackDto;
  10. import com.ygj.yuemum.service.admin.JlAdminUserService;
  11. import org.apache.commons.lang.StringUtils;
  12. import org.apache.shiro.SecurityUtils;
  13. import org.springframework.stereotype.Service;
  14. import javax.annotation.Resource;
  15. import java.util.Date;
  16. import java.util.List;
  17. @Service
  18. public class CustomerInfoFeedbackService {
  19. @Resource
  20. CustomerInfoFeedbackDao feedbackDao;
  21. @Resource
  22. CustomerInfoServiceLogService customerInfoServiceLogService;
  23. @Resource
  24. JlAdminUserService jladminuserService;
  25. public List<CustomerInfoFeedback> selectByPageNumSize(CustomerInfoFeedbackDto customerInfoFeedbackDto) {
  26. PageHelper.startPage(customerInfoFeedbackDto.getPage(), customerInfoFeedbackDto.getLimit(), true, false);
  27. return feedbackDao.selectByPageNumSize(customerInfoFeedbackDto);
  28. }
  29. public int insertInfoFeedback(CustomerInfoFeedback customerInfoFeedback) {
  30. if (StringUtils.isBlank(customerInfoFeedback.getFb_remarks())) {
  31. customerInfoFeedback.setFb_remarks("");
  32. }
  33. int count = feedbackDao.insertInfoFeedback(customerInfoFeedback);
  34. if (count != 0) {
  35. this.insertServiceLog(customerInfoFeedback.getId(), "新增", customerInfoFeedback);
  36. return count;
  37. }
  38. return 0;
  39. }
  40. public CustomerInfoFeedback getById(Integer id) {
  41. return feedbackDao.getById(id);
  42. }
  43. public int updateByPrimaryKeySelective(CustomerInfoFeedback customerInfoFeedback) {
  44. this.insertServiceLog(customerInfoFeedback.getId(), "修改", customerInfoFeedback);
  45. return feedbackDao.updateByPrimaryKeySelective(customerInfoFeedback);
  46. }
  47. public void insertInfoFeedbackList(List<CustomerInfoFeedbackCyDto> customerInfoFeedbacks) {
  48. feedbackDao.insertInfoFeedbackList(customerInfoFeedbacks);
  49. }
  50. private void insertServiceLog(Integer sl_no, String type, CustomerInfoFeedback customerInfoBasic) {
  51. String principal = (String) SecurityUtils.getSubject().getPrincipal();
  52. JlAdminUser jlAdminUser = jladminuserService.getUserMkt(principal);
  53. CustomerInfoServiceLog customerInfoServiceLog = new CustomerInfoServiceLog();
  54. customerInfoServiceLog.setSl_userid(jlAdminUser.getId());
  55. customerInfoServiceLog.setSl_username(jlAdminUser.getName());
  56. customerInfoServiceLog.setSl_createdate(new Date());
  57. customerInfoServiceLog.setSl_no(sl_no);
  58. customerInfoServiceLog.setSl_table("customer_info_feedback");
  59. customerInfoServiceLog.setSl_type(type);
  60. customerInfoServiceLog.setSl_comment(JSONObject.toJSONString(customerInfoBasic));
  61. customerInfoServiceLogService.insert(customerInfoServiceLog);
  62. }
  63. }