123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package com.ygj.yuemum.service.customer;
- import com.alibaba.fastjson.JSONObject;
- import com.github.pagehelper.PageHelper;
- import com.ygj.yuemum.dao.customer.CustomerInfoFeedbackDao;
- import com.ygj.yuemum.domain.admin.JlAdminUser;
- import com.ygj.yuemum.domain.customer.CustomerInfoFeedback;
- import com.ygj.yuemum.domain.customer.CustomerInfoServiceLog;
- import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackCyDto;
- import com.ygj.yuemum.domain.customer.dto.CustomerInfoFeedbackDto;
- import com.ygj.yuemum.service.admin.JlAdminUserService;
- import org.apache.commons.lang.StringUtils;
- import org.apache.shiro.SecurityUtils;
- import org.springframework.stereotype.Service;
- import javax.annotation.Resource;
- import java.util.Date;
- import java.util.List;
- @Service
- public class CustomerInfoFeedbackService {
- @Resource
- CustomerInfoFeedbackDao feedbackDao;
- @Resource
- CustomerInfoServiceLogService customerInfoServiceLogService;
- @Resource
- JlAdminUserService jladminuserService;
- public List<CustomerInfoFeedback> selectByPageNumSize(CustomerInfoFeedbackDto customerInfoFeedbackDto) {
- PageHelper.startPage(customerInfoFeedbackDto.getPage(), customerInfoFeedbackDto.getLimit(), true, false);
- return feedbackDao.selectByPageNumSize(customerInfoFeedbackDto);
- }
- public int insertInfoFeedback(CustomerInfoFeedback customerInfoFeedback) {
- if (StringUtils.isBlank(customerInfoFeedback.getFb_remarks())) {
- customerInfoFeedback.setFb_remarks("");
- }
- int count = feedbackDao.insertInfoFeedback(customerInfoFeedback);
- if (count != 0) {
- this.insertServiceLog(customerInfoFeedback.getId(), "新增", customerInfoFeedback);
- return count;
- }
- return 0;
- }
- public CustomerInfoFeedback getById(Integer id) {
- return feedbackDao.getById(id);
- }
- public int updateByPrimaryKeySelective(CustomerInfoFeedback customerInfoFeedback) {
- this.insertServiceLog(customerInfoFeedback.getId(), "修改", customerInfoFeedback);
- return feedbackDao.updateByPrimaryKeySelective(customerInfoFeedback);
- }
- public void insertInfoFeedbackList(List<CustomerInfoFeedbackCyDto> customerInfoFeedbacks) {
- feedbackDao.insertInfoFeedbackList(customerInfoFeedbacks);
- }
- private void insertServiceLog(Integer sl_no, String type, CustomerInfoFeedback customerInfoBasic) {
- String principal = (String) SecurityUtils.getSubject().getPrincipal();
- JlAdminUser jlAdminUser = jladminuserService.getUserMkt(principal);
- CustomerInfoServiceLog customerInfoServiceLog = new CustomerInfoServiceLog();
- customerInfoServiceLog.setSl_userid(jlAdminUser.getId());
- customerInfoServiceLog.setSl_username(jlAdminUser.getName());
- customerInfoServiceLog.setSl_createdate(new Date());
- customerInfoServiceLog.setSl_no(sl_no);
- customerInfoServiceLog.setSl_table("customer_info_feedback");
- customerInfoServiceLog.setSl_type(type);
- customerInfoServiceLog.setSl_comment(JSONObject.toJSONString(customerInfoBasic));
- customerInfoServiceLogService.insert(customerInfoServiceLog);
- }
- }
|