Browse Source

客服新增字段,以及新增客服日志表

chenyongxing 8 years ago
parent
commit
49fd318acc

+ 16 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java

@ -3,12 +3,14 @@ package com.yihu.wlyy.controller.common.account;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.WlyyCustomerLog;
import com.yihu.wlyy.repository.ManageDictDao;
import com.yihu.wlyy.repository.ManageDictDao;
import com.yihu.wlyy.service.manager.account.CustomerService;
import com.yihu.wlyy.service.manager.account.CustomerService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
import com.yihu.wlyy.service.manager.patient.AdminPatientService;
import com.yihu.wlyy.service.manager.patient.AdminPatientService;
import com.yihu.wlyy.service.manager.sign.SignFamilyService;
import com.yihu.wlyy.service.manager.sign.SignFamilyService;
import com.yihu.wlyy.service.manager.user.UserService;
import com.yihu.wlyy.service.manager.user.UserService;
import com.yihu.wlyy.service.manager.user.WlyyCustomerLogService;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.Map;
import java.util.Map;
/**
/**
@ -41,6 +44,9 @@ public class CustomerController extends BaseController {
    @Autowired
    @Autowired
    private SignFamilyService signFamilyService;
    private SignFamilyService signFamilyService;
    @Autowired
    private WlyyCustomerLogService wlyyCustomerLogService;
    @RequestMapping(value = "/login",produces="application/json;charset=UTF-8")
    @RequestMapping(value = "/login",produces="application/json;charset=UTF-8")
    @ResponseBody
    @ResponseBody
    public String login(@ApiParam(name = "userName", value = "账号", required = true)@RequestParam(required = true, name = "userName") String userName,
    public String login(@ApiParam(name = "userName", value = "账号", required = true)@RequestParam(required = true, name = "userName") String userName,
@ -63,6 +69,11 @@ public class CustomerController extends BaseController {
            req.getSession().setAttribute("name",curUser.getName());
            req.getSession().setAttribute("name",curUser.getName());
            req.getSession().setAttribute("isLogin", "true");
            req.getSession().setAttribute("isLogin", "true");
            req.getSession().setMaxInactiveInterval(-1);//设置session用不过期
            req.getSession().setMaxInactiveInterval(-1);//设置session用不过期
            WlyyCustomerLog wlyyCustomerLog = new WlyyCustomerLog();
            wlyyCustomerLog.setCreateTime(new Date());
            wlyyCustomerLog.setUser(curUser.getCode());
            wlyyCustomerLog.setType(1);
            wlyyCustomerLogService.save(wlyyCustomerLog);
            return write(1,"登入成功","user",curUser);
            return write(1,"登入成功","user",curUser);
        }
        }
    }
    }
@ -75,6 +86,11 @@ public class CustomerController extends BaseController {
        req.getSession().removeAttribute("code");
        req.getSession().removeAttribute("code");
        req.getSession().removeAttribute("name");
        req.getSession().removeAttribute("name");
        req.getSession().removeAttribute("isLogin");
        req.getSession().removeAttribute("isLogin");
        WlyyCustomerLog wlyyCustomerLog = new WlyyCustomerLog();
        wlyyCustomerLog.setCreateTime(new Date());
        wlyyCustomerLog.setUser((String) req.getSession().getAttribute("code"));
        wlyyCustomerLog.setType(0);
        wlyyCustomerLogService.save(wlyyCustomerLog);
        return write(1,"退出成功");
        return write(1,"退出成功");
    }
    }

+ 41 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyCustomerLog.java

@ -0,0 +1,41 @@
package com.yihu.wlyy.entity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "wlyy_customer_log")
public class WlyyCustomerLog extends IdEntity{
    private String user;
    private Date createTime;
    private Integer type;
    @Column(name = "user")
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
}

+ 15 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/WlyyCustomerLogDao.java

@ -0,0 +1,15 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository;
import com.yihu.wlyy.entity.WlyyCustomerLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface WlyyCustomerLogDao extends PagingAndSortingRepository<WlyyCustomerLog, Long>, JpaSpecificationExecutor<WlyyCustomerLog> {
}

+ 26 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/user/WlyyCustomerLogService.java

@ -0,0 +1,26 @@
package com.yihu.wlyy.service.manager.user;
import com.yihu.wlyy.entity.WlyyCustomerLog;
import com.yihu.wlyy.repository.WlyyCustomerLogDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
/**
 * Created by yww on 2016/10/8.
 */
@Service
public class WlyyCustomerLogService extends BaseJpaService<WlyyCustomerLog,WlyyCustomerLogDao> {
    @Autowired
    private WlyyCustomerLogDao wlyyCustomerLogDao;
    @Transient
    public WlyyCustomerLog save(WlyyCustomerLog wlyyCustomerLog){
        wlyyCustomerLogDao.save(wlyyCustomerLog);
        return wlyyCustomerLog;
    }
}