课程实操管理
parent
e46e74604c
commit
d499b4b713
@ -0,0 +1,39 @@
|
||||
package com.ibeetl.admin.core.conf;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@Configuration
|
||||
public class WxMpConfig {
|
||||
@Value("${we_chat.token}")
|
||||
private String token;
|
||||
|
||||
@Value("${we_chat.appId}")
|
||||
private String appid;
|
||||
|
||||
@Value("${we_chat.appSecret}")
|
||||
private String appSecret;
|
||||
|
||||
@Value("${we_chat.aesKey}")
|
||||
private String aesKey;
|
||||
|
||||
public String getToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public String getAppid() {
|
||||
return this.appid;
|
||||
}
|
||||
|
||||
public String getAppSecret() {
|
||||
return this.appSecret;
|
||||
}
|
||||
|
||||
public String getAesKey() {
|
||||
return this.aesKey;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package com.ibeetl.jlw.entity;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.ibeetl.admin.core.entity.BaseEntity;
|
||||
import org.beetl.sql.annotation.entity.*;
|
||||
|
||||
import com.ibeetl.admin.core.util.ValidateConfig;
|
||||
|
||||
import com.ibeetl.admin.core.annotation.Dict;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* 用户微信关联表
|
||||
* gen by Spring Boot2 Admin 2022-11-08
|
||||
*/
|
||||
public class CoreUserWx extends BaseEntity{
|
||||
|
||||
//微信绑定主键
|
||||
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
|
||||
// @SeqID(name = ORACLE_CORE_SEQ_NAME)
|
||||
@AssignID(value = "maskAutoID",param = "com.ibeetl.jlw.entity.CoreUserWx")
|
||||
|
||||
private Long wxId ;
|
||||
|
||||
//微信openID
|
||||
|
||||
private String openid ;
|
||||
|
||||
//系统用户id
|
||||
|
||||
private Long userId ;
|
||||
|
||||
//用户昵称
|
||||
|
||||
private String nickname ;
|
||||
|
||||
|
||||
private Integer sex ;
|
||||
|
||||
|
||||
private String province ;
|
||||
|
||||
|
||||
private String city ;
|
||||
|
||||
|
||||
private String country ;
|
||||
|
||||
//头像
|
||||
|
||||
private String headimgurl ;
|
||||
|
||||
|
||||
private String privilege ;
|
||||
|
||||
|
||||
private String unionid ;
|
||||
|
||||
public CoreUserWx(){
|
||||
}
|
||||
|
||||
/**微信绑定主键
|
||||
*@return
|
||||
*/
|
||||
public Long getWxId(){
|
||||
return wxId;
|
||||
}
|
||||
/**微信绑定主键
|
||||
*@param wxId
|
||||
*/
|
||||
public void setWxId(Long wxId){
|
||||
this.wxId = wxId;
|
||||
}
|
||||
|
||||
/**微信openID
|
||||
*@return
|
||||
*/
|
||||
public String getOpenid(){
|
||||
return openid;
|
||||
}
|
||||
/**微信openID
|
||||
*@param openid
|
||||
*/
|
||||
public void setOpenid(String openid){
|
||||
this.openid = openid;
|
||||
}
|
||||
|
||||
/**系统用户id
|
||||
*@return
|
||||
*/
|
||||
public Long getUserId(){
|
||||
return userId;
|
||||
}
|
||||
/**系统用户id
|
||||
*@param userId
|
||||
*/
|
||||
public void setUserId(Long userId){
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**用户昵称
|
||||
*@return
|
||||
*/
|
||||
public String getNickname(){
|
||||
return nickname;
|
||||
}
|
||||
/**用户昵称
|
||||
*@param nickname
|
||||
*/
|
||||
public void setNickname(String nickname){
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
public Integer getSex(){
|
||||
return sex;
|
||||
}
|
||||
public void setSex(Integer sex){
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getProvince(){
|
||||
return province;
|
||||
}
|
||||
public void setProvince(String province){
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity(){
|
||||
return city;
|
||||
}
|
||||
public void setCity(String city){
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getCountry(){
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country){
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
/**头像
|
||||
*@return
|
||||
*/
|
||||
public String getHeadimgurl(){
|
||||
return headimgurl;
|
||||
}
|
||||
/**头像
|
||||
*@param headimgurl
|
||||
*/
|
||||
public void setHeadimgurl(String headimgurl){
|
||||
this.headimgurl = headimgurl;
|
||||
}
|
||||
|
||||
public String getPrivilege(){
|
||||
return privilege;
|
||||
}
|
||||
public void setPrivilege(String privilege){
|
||||
this.privilege = privilege;
|
||||
}
|
||||
|
||||
public String getUnionid(){
|
||||
return unionid;
|
||||
}
|
||||
public void setUnionid(String unionid){
|
||||
this.unionid = unionid;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package com.ibeetl.jlw.service;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import cn.jlw.util.ToolUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ibeetl.admin.core.entity.CoreUser;
|
||||
import com.ibeetl.admin.core.util.TimeTool;
|
||||
import com.ibeetl.admin.core.web.JsonResult;
|
||||
import com.ibeetl.admin.core.web.JsonReturnCode;
|
||||
import com.ibeetl.jlw.dao.CoreUserWxDao;
|
||||
import com.ibeetl.jlw.entity.CoreUserWx;
|
||||
import com.ibeetl.jlw.web.query.CoreUserWxQuery;
|
||||
import com.ibeetl.jlw.entity.FileEntity;
|
||||
|
||||
import com.ibeetl.admin.core.service.CoreBaseService;
|
||||
import com.ibeetl.admin.core.util.PlatformException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.beetl.sql.core.engine.PageQuery;
|
||||
import org.beetl.sql.core.SqlId;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
|
||||
|
||||
/**
|
||||
* CoreUserWx Service
|
||||
* 当分布式ID开启后请勿使用insert(*,true)
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
@Validated
|
||||
public class CoreUserWxService extends CoreBaseService<CoreUserWx>{
|
||||
|
||||
@Autowired private CoreUserWxDao coreUserWxDao;
|
||||
|
||||
public PageQuery<CoreUserWx>queryByCondition(PageQuery query){
|
||||
PageQuery ret = coreUserWxDao.queryByCondition(query);
|
||||
queryListAfter(ret.getList());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public PageQuery<CoreUserWx>queryByConditionQuery(PageQuery query){
|
||||
PageQuery ret = coreUserWxDao.queryByConditionQuery(query);
|
||||
queryListAfter(ret.getList());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void deleteByList(List list){
|
||||
String ids = "";
|
||||
ToolUtils.deleteNullList(list);
|
||||
for(int i=0;null != list && i<list.size();i++){
|
||||
ids += list.get(i).toString()+(i==list.size()-1?"":",");
|
||||
}
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
coreUserWxDao.deleteCoreUserWxByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteCoreUserWx(String ids){
|
||||
try {
|
||||
coreUserWxDao.deleteCoreUserWxByIds(ids);
|
||||
} catch (Exception e) {
|
||||
throw new PlatformException("批量删除CoreUserWx失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String addAll(CoreUserWxQuery coreUserWxQuery){
|
||||
String msg = "";
|
||||
List<CoreUserWx> coreUserWxList = new ArrayList<>();
|
||||
try {
|
||||
coreUserWxList = JSON.parseArray(coreUserWxQuery.getCoreUserWxJsonStr(), CoreUserWx.class);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
coreUserWxList.add(JSONObject.parseObject(coreUserWxQuery.getCoreUserWxJsonStr(), CoreUserWx.class));
|
||||
} catch (Exception e1) {}
|
||||
}
|
||||
ToolUtils.deleteNullList(coreUserWxList);
|
||||
if(null != coreUserWxList && coreUserWxList.size()>0){
|
||||
for(int i=0;i<coreUserWxList.size();i++){
|
||||
CoreUserWx coreUserWx = coreUserWxList.get(i);
|
||||
coreUserWx.setUserId(coreUserWxQuery.getUserId());
|
||||
}
|
||||
insertBatch(coreUserWxList);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public JsonResult add(CoreUserWxQuery coreUserWxQuery){
|
||||
String msg = "";
|
||||
CoreUserWx coreUserWx = coreUserWxQuery.pojo();
|
||||
coreUserWxDao.insert(coreUserWx);
|
||||
coreUserWxQuery.setWxId(coreUserWx.getWxId());
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setData(coreUserWx.getWxId());//自增的ID丢进去
|
||||
jsonResult.setCode(JsonReturnCode.SUCCESS.getCode());
|
||||
jsonResult.setMsg(msg);
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
public String edit(CoreUserWxQuery coreUserWxQuery){
|
||||
String msg = "";
|
||||
CoreUserWx coreUserWx = coreUserWxQuery.pojo();
|
||||
coreUserWxDao.updateTemplateById(coreUserWx);
|
||||
return msg;
|
||||
}
|
||||
|
||||
public String updateGivenByIds(CoreUserWxQuery coreUserWxQuery){
|
||||
String msg = "";
|
||||
if(StringUtils.isNotBlank(coreUserWxQuery.get_given())){
|
||||
boolean flag = coreUserWxDao.updateGivenByIds(coreUserWxQuery) > 0;
|
||||
if(!flag){
|
||||
msg = "更新指定参数失败";
|
||||
}
|
||||
}else{
|
||||
msg = "指定参数为空";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public List<CoreUserWx> getValues (Object paras){
|
||||
return sqlManager.select(SqlId.of("jlw.coreUserWx.getCoreUserWxValues"), CoreUserWx.class, paras);
|
||||
}
|
||||
|
||||
public List<CoreUserWx> getValuesByQuery (CoreUserWxQuery coreUserWxQuery){
|
||||
return coreUserWxDao.getValuesByQuery(coreUserWxQuery);
|
||||
}
|
||||
|
||||
public List<CoreUserWx> getValuesByQueryNotWithPermission (CoreUserWxQuery coreUserWxQuery){
|
||||
return coreUserWxDao.getValuesByQueryNotWithPermission(coreUserWxQuery);
|
||||
}
|
||||
|
||||
public CoreUserWx getInfo (Long wxId){
|
||||
CoreUserWxQuery coreUserWxQuery = new CoreUserWxQuery();
|
||||
coreUserWxQuery.setWxId(wxId);
|
||||
List<CoreUserWx> list = coreUserWxDao.getValuesByQuery(coreUserWxQuery);
|
||||
if(null != list && list.size()>0){
|
||||
return list.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public CoreUserWx getInfo (CoreUserWxQuery coreUserWxQuery){
|
||||
List<CoreUserWx> list = coreUserWxDao.getValuesByQuery(coreUserWxQuery);
|
||||
if(null != list && list.size()>0){
|
||||
return list.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package com.ibeetl.jlw.service;
|
||||
|
||||
import com.ibeetl.admin.core.conf.WxMpConfig;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
|
||||
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.ExampleMatcher;
|
||||
import org.springframework.stereotype.Service;
|
||||
import sun.rmi.log.LogHandler;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import static me.chanjar.weixin.common.api.WxConsts.EventType.*;
|
||||
import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType.EVENT;
|
||||
import static me.chanjar.weixin.mp.constant.WxMpEventConstants.CustomerService.*;
|
||||
import static me.chanjar.weixin.mp.constant.WxMpEventConstants.POI_CHECK_NOTIFY;
|
||||
|
||||
/**
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@Service
|
||||
public class WeixinService extends WxMpServiceImpl {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private WxMpConfig wxConfig;
|
||||
|
||||
private WxMpMessageRouter router;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
final WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
|
||||
// 设置微信公众号的appid
|
||||
config.setAppId(this.wxConfig.getAppid());
|
||||
// 设置微信公众号的app corpSecret
|
||||
config.setSecret(this.wxConfig.getAppSecret());
|
||||
// 设置微信公众号的token
|
||||
config.setToken(this.wxConfig.getToken());
|
||||
// 设置消息加解密密钥
|
||||
config.setAesKey(this.wxConfig.getAesKey());
|
||||
super.setWxMpConfigStorage(config);
|
||||
|
||||
this.refreshRouter();
|
||||
}
|
||||
|
||||
private void refreshRouter() {
|
||||
final WxMpMessageRouter newRouter = new WxMpMessageRouter(this);
|
||||
|
||||
// 记录所有事件的日志
|
||||
// newRouter.rule().handler(this.logHandler).next();
|
||||
|
||||
// 接收客服会话管理事件
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(KF_CREATE_SESSION)
|
||||
// .handler(this.kfSessionHandler).end();
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(KF_CLOSE_SESSION)
|
||||
// .handler(this.kfSessionHandler).end();
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(KF_SWITCH_SESSION)
|
||||
// .handler(this.kfSessionHandler).end();
|
||||
|
||||
// 门店审核事件
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(POI_CHECK_NOTIFY)
|
||||
// .handler(this.storeCheckNotifyHandler).end();
|
||||
|
||||
// 自定义菜单事件
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(WxConsts.EventType.CLICK).handler(this.menuHandler).end();
|
||||
|
||||
// 点击菜单连接事件
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(WxConsts.EventType.VIEW).handler(this.nullHandler).end();
|
||||
|
||||
// 关注事件
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(SUBSCRIBE).handler(this.subscribeHandler).end();
|
||||
|
||||
// 取消关注事件
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(UNSUBSCRIBE).handler(this.unsubscribeHandler).end();
|
||||
|
||||
// 上报地理位置事件
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(LOCATION).handler(this.locationHandler).end();
|
||||
|
||||
// 接收地理位置消息
|
||||
// newRouter.rule().async(false).msgType(WxConsts.XmlMsgType.LOCATION).handler(this.locationHandler).end();
|
||||
|
||||
// 扫码事件
|
||||
// newRouter.rule().async(false).msgType(EVENT).event(SCAN).handler(this.nullHandler).end();
|
||||
|
||||
// 默认
|
||||
// newRouter.rule().async(false).handler(this.msgHandler).end();
|
||||
|
||||
this.router = newRouter;
|
||||
}
|
||||
|
||||
public WxMpXmlOutMessage route(WxMpXmlMessage message) {
|
||||
try {
|
||||
return this.router.route(message);
|
||||
} catch (Exception e) {
|
||||
this.logger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasKefuOnline() {
|
||||
try {
|
||||
WxMpKfOnlineList kfOnlineList = this.getKefuService().kfOnlineList();
|
||||
return kfOnlineList != null && kfOnlineList.getKfOnlineList().size() > 0;
|
||||
} catch (Exception e) {
|
||||
this.logger.error("获取客服在线状态异常: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,238 @@
|
||||
package com.ibeetl.jlw.web;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.jlw.Interceptor.RFile;
|
||||
import cn.jlw.Interceptor.SCoreUser;
|
||||
import cn.jlw.Interceptor.GetFile;
|
||||
import cn.jlw.util.ToolUtils;
|
||||
import cn.jlw.validate.ValidateConfig;
|
||||
import com.ibeetl.admin.core.entity.CoreUser;
|
||||
import com.ibeetl.admin.core.file.FileService;
|
||||
import com.ibeetl.admin.core.util.ConvertUtil;
|
||||
import com.ibeetl.admin.core.util.PlatformException;
|
||||
import com.ibeetl.admin.core.util.TimeTool;
|
||||
import com.ibeetl.admin.core.web.JsonResult;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||
import me.chanjar.weixin.mp.api.WxMpQrcodeService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.beetl.sql.core.engine.PageQuery;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import com.ibeetl.admin.console.web.dto.DictExcelImportData;
|
||||
import com.ibeetl.admin.console.web.query.UserQuery;
|
||||
import com.ibeetl.admin.core.annotation.Function;
|
||||
import com.ibeetl.jlw.entity.*;
|
||||
import com.ibeetl.jlw.service.*;
|
||||
import com.ibeetl.jlw.web.query.*;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
|
||||
|
||||
/**
|
||||
* CoreUserWx 用户微信关联表 接口
|
||||
* 切记不要对非线程安全的静态变量进行写操作
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
public class CoreUserWxController{
|
||||
|
||||
private final Log log = LogFactory.getLog(this.getClass());
|
||||
private static final String MODEL = "/jlw/coreUserWx";
|
||||
private static final String API = "/api/coreUserWx";
|
||||
|
||||
|
||||
@Autowired private CoreUserWxService coreUserWxService;
|
||||
|
||||
@Autowired FileService fileService;
|
||||
|
||||
|
||||
/* 前端接口 */
|
||||
|
||||
@PostMapping(API + "/getPageList.do")
|
||||
public JsonResult<PageQuery> getPageList(CoreUserWxQuery condition,@SCoreUser CoreUser coreUser){
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
PageQuery page = condition.getPageQuery();
|
||||
coreUserWxService.queryByConditionQuery(page);
|
||||
return JsonResult.success(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(API + "/getInfo.do")
|
||||
public JsonResult<CoreUserWx>getInfo(CoreUserWxQuery param,@SCoreUser CoreUser coreUser) {
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
CoreUserWx coreUserWx = coreUserWxService.getInfo(param);
|
||||
return JsonResult.success(coreUserWx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(API + "/getList.do")
|
||||
public JsonResult<List<CoreUserWx>>getList(CoreUserWxQuery param,@SCoreUser CoreUser coreUser) {
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
List<CoreUserWx>list = coreUserWxService.getValuesByQuery(param);
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 后台页面 */
|
||||
|
||||
@GetMapping(MODEL + "/index.do")
|
||||
@Function("coreUserWx.query")
|
||||
public ModelAndView index() {
|
||||
ModelAndView view = new ModelAndView("/jlw/coreUserWx/index.html") ;
|
||||
view.addObject("search", CoreUserWxQuery.class.getName());
|
||||
return view;
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/edit.do")
|
||||
@Function("coreUserWx.edit")
|
||||
public ModelAndView edit(Long wxId) {
|
||||
ModelAndView view = new ModelAndView("/jlw/coreUserWx/edit.html");
|
||||
CoreUserWx coreUserWx = coreUserWxService.queryById(wxId);
|
||||
view.addObject("coreUserWx", coreUserWx);
|
||||
return view;
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/add.do")
|
||||
@Function("coreUserWx.add")
|
||||
public ModelAndView add(Long wxId) {
|
||||
ModelAndView view = new ModelAndView("/jlw/coreUserWx/add.html");
|
||||
if(null != wxId){
|
||||
CoreUserWx coreUserWx = coreUserWxService.queryById(wxId);
|
||||
view.addObject("coreUserWx", coreUserWx);
|
||||
}else {
|
||||
view.addObject("coreUserWx", new CoreUserWx());
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
/* 后台接口 */
|
||||
|
||||
@PostMapping(MODEL + "/list.json")
|
||||
@Function("coreUserWx.query")
|
||||
public JsonResult<PageQuery> list(CoreUserWxQuery condition){
|
||||
PageQuery page = condition.getPageQuery();
|
||||
coreUserWxService.queryByCondition(page);
|
||||
return JsonResult.success(page);
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/addAll.json")
|
||||
@Function("coreUserWx.add")
|
||||
public JsonResult addAll(CoreUserWxQuery coreUserWxQuery,@SCoreUser CoreUser coreUser){
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
coreUserWxQuery.setUserId(coreUser.getId());
|
||||
String msg = coreUserWxService.addAll(coreUserWxQuery);
|
||||
if (StringUtils.isBlank(msg)) {
|
||||
return JsonResult.success();
|
||||
} else {
|
||||
return JsonResult.failMessage("新增失败,"+msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/add.json")
|
||||
@Function("coreUserWx.add")
|
||||
public JsonResult add(@Validated(ValidateConfig.ADD.class) CoreUserWxQuery coreUserWxQuery, BindingResult result,@SCoreUser CoreUser coreUser){
|
||||
if(result.hasErrors()){
|
||||
return JsonResult.failMessage(result);
|
||||
}else{
|
||||
Assert.notNull(coreUser, "请登录后再操作");
|
||||
coreUserWxQuery.setUserId(coreUser.getId());
|
||||
return coreUserWxService.add(coreUserWxQuery);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/edit.json")
|
||||
@Function("coreUserWx.edit")
|
||||
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) CoreUserWxQuery coreUserWxQuery, BindingResult result) {
|
||||
if(result.hasErrors()){
|
||||
return JsonResult.failMessage(result);
|
||||
}else {
|
||||
Assert.notNull(getUser(), "请登录后再操作");
|
||||
coreUserWxQuery.setUserId(null);
|
||||
String msg = coreUserWxService.edit(coreUserWxQuery);
|
||||
if (StringUtils.isBlank(msg)) {
|
||||
return JsonResult.success();
|
||||
} else {
|
||||
return JsonResult.failMessage("更新失败,"+msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(MODEL + "/view.json")
|
||||
@Function("coreUserWx.query")
|
||||
public JsonResult<CoreUserWx>queryInfo(Long wxId) {
|
||||
CoreUserWx coreUserWx = coreUserWxService.queryById( wxId);
|
||||
return JsonResult.success(coreUserWx);
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/getValues.json")
|
||||
@Function("coreUserWx.query")
|
||||
public JsonResult<List<CoreUserWx>>getValues(CoreUserWxQuery param) {
|
||||
List<CoreUserWx>list = coreUserWxService.getValuesByQuery(param);
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(MODEL + "/delete.json")
|
||||
@Function("coreUserWx.delete")
|
||||
@ResponseBody
|
||||
public JsonResult delete(String ids) {
|
||||
coreUserWxService.deleteCoreUserWx(ids);
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package com.ibeetl.jlw.web.query;
|
||||
|
||||
import cn.jlw.validate.ValidateConfig;
|
||||
import com.ibeetl.jlw.entity.CoreUserWx;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.ibeetl.admin.core.annotation.Query;
|
||||
import com.ibeetl.admin.core.util.Tool;
|
||||
import com.ibeetl.admin.core.util.enums.CoreDictType;
|
||||
import com.ibeetl.admin.core.web.query.PageParam;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*CoreUserWx查询
|
||||
*/
|
||||
public class CoreUserWxQuery extends PageParam {
|
||||
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
|
||||
@Query(name = "微信绑定主键", display = false)
|
||||
private Long wxId;
|
||||
@Query(name = "微信openID", display = false)
|
||||
private String openid;
|
||||
@Query(name = "系统用户id", display = false)
|
||||
private Long userId;
|
||||
@Query(name = "用户昵称", display = false)
|
||||
private String nickname;
|
||||
@Query(name = "sex", display = false)
|
||||
private Integer sex;
|
||||
@Query(name = "province", display = false)
|
||||
private String province;
|
||||
@Query(name = "city", display = false)
|
||||
private String city;
|
||||
@Query(name = "country", display = false)
|
||||
private String country;
|
||||
@Query(name = "头像", display = false)
|
||||
private String headimgurl;
|
||||
@Query(name = "privilege", display = false)
|
||||
private String privilege;
|
||||
@Query(name = "unionid", display = false)
|
||||
private String unionid;
|
||||
|
||||
private String userIdPlural;
|
||||
|
||||
private String coreUserWxJsonStr;//json格式
|
||||
|
||||
private String _given;//指定更新的特定字段,多个逗号隔开
|
||||
|
||||
public Long getWxId(){
|
||||
return wxId;
|
||||
}
|
||||
public void setWxId(Long wxId ){
|
||||
this.wxId = wxId;
|
||||
}
|
||||
public String getOpenid(){
|
||||
return openid;
|
||||
}
|
||||
public void setOpenid(String openid ){
|
||||
this.openid = openid;
|
||||
}
|
||||
public Long getUserId(){
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Long userId ){
|
||||
this.userId = userId;
|
||||
}
|
||||
public String getNickname(){
|
||||
return nickname;
|
||||
}
|
||||
public void setNickname(String nickname ){
|
||||
this.nickname = nickname;
|
||||
}
|
||||
public Integer getSex(){
|
||||
return sex;
|
||||
}
|
||||
public void setSex(Integer sex ){
|
||||
this.sex = sex;
|
||||
}
|
||||
public String getProvince(){
|
||||
return province;
|
||||
}
|
||||
public void setProvince(String province ){
|
||||
this.province = province;
|
||||
}
|
||||
public String getCity(){
|
||||
return city;
|
||||
}
|
||||
public void setCity(String city ){
|
||||
this.city = city;
|
||||
}
|
||||
public String getCountry(){
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country ){
|
||||
this.country = country;
|
||||
}
|
||||
public String getHeadimgurl(){
|
||||
return headimgurl;
|
||||
}
|
||||
public void setHeadimgurl(String headimgurl ){
|
||||
this.headimgurl = headimgurl;
|
||||
}
|
||||
public String getPrivilege(){
|
||||
return privilege;
|
||||
}
|
||||
public void setPrivilege(String privilege ){
|
||||
this.privilege = privilege;
|
||||
}
|
||||
public String getUnionid(){
|
||||
return unionid;
|
||||
}
|
||||
public void setUnionid(String unionid ){
|
||||
this.unionid = unionid;
|
||||
}
|
||||
|
||||
public CoreUserWx pojo(){
|
||||
CoreUserWx pojo = new CoreUserWx();
|
||||
pojo.setWxId(this.getWxId());
|
||||
pojo.setOpenid(this.getOpenid());
|
||||
pojo.setUserId(this.getUserId());
|
||||
pojo.setNickname(this.getNickname());
|
||||
pojo.setSex(this.getSex());
|
||||
pojo.setProvince(this.getProvince());
|
||||
pojo.setCity(this.getCity());
|
||||
pojo.setCountry(this.getCountry());
|
||||
pojo.setHeadimgurl(this.getHeadimgurl());
|
||||
pojo.setPrivilege(this.getPrivilege());
|
||||
pojo.setUnionid(this.getUnionid());
|
||||
return pojo;
|
||||
}
|
||||
|
||||
public String getUserIdPlural(){
|
||||
return userIdPlural;
|
||||
}
|
||||
public void setUserIdPlural(String userIdPlural){
|
||||
this.userIdPlural = userIdPlural;
|
||||
}
|
||||
public String getCoreUserWxJsonStr(){
|
||||
return coreUserWxJsonStr;
|
||||
}
|
||||
public void setCoreUserWxJsonStr(String coreUserWxJsonStr ){
|
||||
this.coreUserWxJsonStr = coreUserWxJsonStr;
|
||||
}
|
||||
public String get_given() {
|
||||
return _given;
|
||||
}
|
||||
public void set_given(String _given) {
|
||||
this._given = _given;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
layui.define([ 'form', 'laydate', 'table','coreUserWxApi'], function(exports) {
|
||||
var form = layui.form;
|
||||
var coreUserWxApi = layui.coreUserWxApi;
|
||||
var index = layui.index;
|
||||
var view = {
|
||||
init:function(){
|
||||
Lib.initGenrealForm($("#addForm"),form);
|
||||
this.initSubmit();
|
||||
},
|
||||
initSubmit:function(){
|
||||
$("#addButton").click(function(){
|
||||
form.on('submit(form)', function(){
|
||||
var wxId = $("#addForm input[name='wxId']").val();
|
||||
if(!$.isEmpty(wxId)){
|
||||
coreUserWxApi.updateCoreUserWx($('#addForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("更新成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}else{
|
||||
coreUserWxApi.addCoreUserWx($('#addForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("添加成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$("#addButton-cancel").click(function(){
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
exports('add',view);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
/*访问后台的代码*/
|
||||
layui.define([], function(exports) {
|
||||
var api={
|
||||
updateCoreUserWx:function(form,callback){
|
||||
Lib.submitForm("/jlw/coreUserWx/edit.json",form,{},callback)
|
||||
},
|
||||
addCoreUserWx:function(form,callback){
|
||||
Lib.submitForm("/jlw/coreUserWx/add.json",form,{},callback)
|
||||
},
|
||||
del:function(ids,callback){
|
||||
Common.post("/jlw/coreUserWx/delete.json",{"ids":ids},function(){
|
||||
callback();
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
exports('coreUserWxApi',api);
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
layui.define(['table', 'coreUserWxApi'], function(exports) {
|
||||
var coreUserWxApi = layui.coreUserWxApi;
|
||||
var table=layui.table;
|
||||
var view = {
|
||||
init:function(){
|
||||
},
|
||||
delBatch:function(){
|
||||
var data = Common.getMoreDataFromTable(table,"coreUserWxTable");
|
||||
if(data==null){
|
||||
return ;
|
||||
}
|
||||
Common.openConfirm("确认要删除这些微信登录绑定?",function(){
|
||||
var ids =Common.concatBatchId(data,"wxId");
|
||||
coreUserWxApi.del(ids,function(){
|
||||
Common.info("删除成功");
|
||||
dataReload();
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
exports('del',view);
|
||||
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
layui.define([ 'form', 'laydate', 'table','coreUserWxApi'], function(exports) {
|
||||
var form = layui.form;
|
||||
var coreUserWxApi = layui.coreUserWxApi;
|
||||
var index = layui.index;
|
||||
var view = {
|
||||
init:function(){
|
||||
Lib.initGenrealForm($("#updateForm"),form);
|
||||
this.initSubmit();
|
||||
},
|
||||
initSubmit:function(){
|
||||
$("#updateButton").click(function(){
|
||||
form.on('submit(form)', function(){
|
||||
coreUserWxApi.updateCoreUserWx($('#updateForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("更新成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
});
|
||||
});
|
||||
$("#updateButton-cancel").click(function(){
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
exports('edit',view);
|
||||
|
||||
});
|
@ -0,0 +1,29 @@
|
||||
<!--#layout("/common/layout.html",{"jsBase":"/js/jlw/coreUserWx/"}){ -->
|
||||
<layui:searchForm formId="searchForm" searchList="" condition="${search}">
|
||||
</layui:searchForm>
|
||||
<table id="coreUserWxTable" lay-filter="coreUserWxTable"></table>
|
||||
<!--#} -->
|
||||
|
||||
<script type="text/html" id="toolbar_coreUserWx">
|
||||
<div class="layui-btn-container">
|
||||
<div class="layui-btn-group" >
|
||||
<!--# if(core.searchIsShow(search)) {-->
|
||||
<layui:accessButton function="coreUserWx.query" id="searchFormSearch" action="search"><i class="layui-icon"></i>搜索</layui:accessButton>
|
||||
<!--# }-->
|
||||
<layui:accessButton function="coreUserWx.add" action="add">添加</layui:accessButton>
|
||||
<layui:accessButton function="coreUserWx.edit" action="edit">修改</layui:accessButton>
|
||||
<layui:accessButton function="coreUserWx.del" action="del">删除</layui:accessButton>
|
||||
<!--# if(!isEmpty(search)) {-->
|
||||
<layui:accessButton function="coreUserWx.query" action="refresh"><i class="layui-icon"></i>刷新</layui:accessButton>
|
||||
<!--# }-->
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
|
||||
layui.use(['index'], function(){
|
||||
var index = layui.index;
|
||||
index.init();
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue