From d499b4b713826478b8ab2ef5b625b11131085fd5 Mon Sep 17 00:00:00 2001 From: xuliangtong <1124839262@qq.com> Date: Wed, 9 Nov 2022 12:23:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AE=9E=E6=93=8D=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ibeetl/admin/core/conf/WxMpConfig.java | 39 ++ .../com/ibeetl/jlw/dao/CoreUserWxDao.java | 31 ++ .../com/ibeetl/jlw/entity/CoreUserWx.java | 173 +++++++++ .../ibeetl/jlw/service/CoreUserWxService.java | 170 +++++++++ ...enCourseHandsOnSimulationTasksService.java | 19 +- .../com/ibeetl/jlw/service/WeixinService.java | 119 +++++++ .../ibeetl/jlw/web/CompetitionController.java | 19 +- .../ibeetl/jlw/web/CoreUserWxController.java | 238 +++++++++++++ .../com/ibeetl/jlw/web/WeiXinController.java | 98 ++++++ .../ibeetl/jlw/web/query/CoreUserWxQuery.java | 150 ++++++++ ...OpenCourseHandsOnSimulationTasksQuery.java | 15 +- web/src/main/resources/sql/jlw/coreUserWx.md | 333 ++++++++++++++++++ .../resources/static/js/jlw/coreUserWx/add.js | 38 ++ .../static/js/jlw/coreUserWx/coreUserWxApi.js | 18 + .../resources/static/js/jlw/coreUserWx/del.js | 23 ++ .../static/js/jlw/coreUserWx/edit.js | 28 ++ .../static/js/jlw/coreUserWx/index.js | 199 +++++++++++ .../templates/jlw/coreUserWx/add.html | 94 +++++ .../templates/jlw/coreUserWx/edit.html | 94 +++++ .../templates/jlw/coreUserWx/index.html | 29 ++ 20 files changed, 1918 insertions(+), 9 deletions(-) create mode 100644 admin-core/src/main/java/com/ibeetl/admin/core/conf/WxMpConfig.java create mode 100644 web/src/main/java/com/ibeetl/jlw/dao/CoreUserWxDao.java create mode 100644 web/src/main/java/com/ibeetl/jlw/entity/CoreUserWx.java create mode 100644 web/src/main/java/com/ibeetl/jlw/service/CoreUserWxService.java create mode 100644 web/src/main/java/com/ibeetl/jlw/service/WeixinService.java create mode 100644 web/src/main/java/com/ibeetl/jlw/web/CoreUserWxController.java create mode 100644 web/src/main/java/com/ibeetl/jlw/web/WeiXinController.java create mode 100644 web/src/main/java/com/ibeetl/jlw/web/query/CoreUserWxQuery.java create mode 100644 web/src/main/resources/sql/jlw/coreUserWx.md create mode 100644 web/src/main/resources/static/js/jlw/coreUserWx/add.js create mode 100644 web/src/main/resources/static/js/jlw/coreUserWx/coreUserWxApi.js create mode 100644 web/src/main/resources/static/js/jlw/coreUserWx/del.js create mode 100644 web/src/main/resources/static/js/jlw/coreUserWx/edit.js create mode 100644 web/src/main/resources/static/js/jlw/coreUserWx/index.js create mode 100644 web/src/main/resources/templates/jlw/coreUserWx/add.html create mode 100644 web/src/main/resources/templates/jlw/coreUserWx/edit.html create mode 100644 web/src/main/resources/templates/jlw/coreUserWx/index.html diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/conf/WxMpConfig.java b/admin-core/src/main/java/com/ibeetl/admin/core/conf/WxMpConfig.java new file mode 100644 index 00000000..92a48133 --- /dev/null +++ b/admin-core/src/main/java/com/ibeetl/admin/core/conf/WxMpConfig.java @@ -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; + } + +} \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/CoreUserWxDao.java b/web/src/main/java/com/ibeetl/jlw/dao/CoreUserWxDao.java new file mode 100644 index 00000000..fb95e443 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/dao/CoreUserWxDao.java @@ -0,0 +1,31 @@ +package com.ibeetl.jlw.dao; + +import java.util.List; +import java.util.Map; + +import com.ibeetl.jlw.entity.*; +import com.ibeetl.jlw.web.query.CoreUserWxQuery; + +import org.beetl.sql.mapper.annotation.SqlResource; +import org.springframework.stereotype.Component; +import org.beetl.sql.mapper.BaseMapper; +import org.beetl.sql.core.engine.PageQuery; +import org.beetl.sql.mapper.annotation.Update; + +/** + * CoreUserWx Dao + */ +// 实际可以不用加Component注解,调用的地方注入时候,Idea会报红,看着难受 +@Component +@SqlResource("jlw.coreUserWx") +public interface CoreUserWxDao extends BaseMapper{ + PageQuery queryByCondition(PageQuery query); + PageQuery queryByConditionQuery(PageQuery query); + @Update + void deleteCoreUserWxByIds(String ids); + @Update + int updateGivenByIds(CoreUserWxQuery coreUserWxQuery); + List getByIds(String ids); + List getValuesByQuery(CoreUserWxQuery coreUserWxQuery); + List getValuesByQueryNotWithPermission(CoreUserWxQuery coreUserWxQuery); +} diff --git a/web/src/main/java/com/ibeetl/jlw/entity/CoreUserWx.java b/web/src/main/java/com/ibeetl/jlw/entity/CoreUserWx.java new file mode 100644 index 00000000..9221602e --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/entity/CoreUserWx.java @@ -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; + } + + +} diff --git a/web/src/main/java/com/ibeetl/jlw/service/CoreUserWxService.java b/web/src/main/java/com/ibeetl/jlw/service/CoreUserWxService.java new file mode 100644 index 00000000..cf70decb --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/service/CoreUserWxService.java @@ -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{ + + @Autowired private CoreUserWxDao coreUserWxDao; + + public PageQueryqueryByCondition(PageQuery query){ + PageQuery ret = coreUserWxDao.queryByCondition(query); + queryListAfter(ret.getList()); + return ret; + } + + public PageQueryqueryByConditionQuery(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 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 0; + if(!flag){ + msg = "更新指定参数失败"; + } + }else{ + msg = "指定参数为空"; + } + return msg; + } + + public List getValues (Object paras){ + return sqlManager.select(SqlId.of("jlw.coreUserWx.getCoreUserWxValues"), CoreUserWx.class, paras); + } + + public List getValuesByQuery (CoreUserWxQuery coreUserWxQuery){ + return coreUserWxDao.getValuesByQuery(coreUserWxQuery); + } + + public List getValuesByQueryNotWithPermission (CoreUserWxQuery coreUserWxQuery){ + return coreUserWxDao.getValuesByQueryNotWithPermission(coreUserWxQuery); + } + + public CoreUserWx getInfo (Long wxId){ + CoreUserWxQuery coreUserWxQuery = new CoreUserWxQuery(); + coreUserWxQuery.setWxId(wxId); + List list = coreUserWxDao.getValuesByQuery(coreUserWxQuery); + if(null != list && list.size()>0){ + return list.get(0); + }else{ + return null; + } + } + + public CoreUserWx getInfo (CoreUserWxQuery coreUserWxQuery){ + List list = coreUserWxDao.getValuesByQuery(coreUserWxQuery); + if(null != list && list.size()>0){ + return list.get(0); + }else{ + return null; + } + } + +} diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseHandsOnSimulationTasksService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseHandsOnSimulationTasksService.java index 7800ef3c..32695cb6 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseHandsOnSimulationTasksService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseHandsOnSimulationTasksService.java @@ -2,6 +2,7 @@ package com.ibeetl.jlw.service; import cn.jlw.util.ToolUtils; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ibeetl.admin.core.service.CoreBaseService; import com.ibeetl.admin.core.util.PlatformException; @@ -109,8 +110,9 @@ public class TeacherOpenCourseHandsOnSimulationTasksService extends CoreBaseServ TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks = teacherOpenCourseHandsOnSimulationTasksQuery.pojo(); teacherOpenCourseHandsOnSimulationTasksDao.insert(teacherOpenCourseHandsOnSimulationTasks); teacherOpenCourseHandsOnSimulationTasksQuery.setTaskId(teacherOpenCourseHandsOnSimulationTasks.getTaskId()); - List teacherOpenCourseHandsOnSimulationTasksFiles = teacherOpenCourseHandsOnSimulationTasksQuery.getTeacherOpenCourseHandsOnSimulationTasksFile(); - if (CollectionUtils.isNotEmpty(teacherOpenCourseHandsOnSimulationTasksFiles)) { + String tasksFile = teacherOpenCourseHandsOnSimulationTasksQuery.getTeacherOpenCourseHandsOnSimulationTasksFile(); + if (StringUtils.isNotEmpty(tasksFile)) { + List teacherOpenCourseHandsOnSimulationTasksFiles = JSONArray.parseArray(tasksFile, TeacherOpenCourseHandsOnSimulationTasksFileQuery.class); for (TeacherOpenCourseHandsOnSimulationTasksFileQuery teacherOpenCourseHandsOnSimulationTasksFile : teacherOpenCourseHandsOnSimulationTasksFiles) { teacherOpenCourseHandsOnSimulationTasksFile.setTeacherOpenCourseId(teacherOpenCourseHandsOnSimulationTasks.getTeacherOpenCourseId()); teacherOpenCourseHandsOnSimulationTasksFile.setHandsOnId(teacherOpenCourseHandsOnSimulationTasks.getHandsOnId()); @@ -129,6 +131,19 @@ public class TeacherOpenCourseHandsOnSimulationTasksService extends CoreBaseServ String msg = ""; TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks = teacherOpenCourseHandsOnSimulationTasksQuery.pojo(); teacherOpenCourseHandsOnSimulationTasksDao.updateTemplateById(teacherOpenCourseHandsOnSimulationTasks); + String tasksFile = teacherOpenCourseHandsOnSimulationTasksQuery.getTeacherOpenCourseHandsOnSimulationTasksFile(); + TeacherOpenCourseHandsOnSimulationTasksFile file = new TeacherOpenCourseHandsOnSimulationTasksFile(); + file.setTaskId(teacherOpenCourseHandsOnSimulationTasksQuery.getTaskId()); + teacherOpenCourseHandsOnSimulationTasksFileService.deleteByCondition(file); + if (StringUtils.isNotEmpty(tasksFile)) { + List teacherOpenCourseHandsOnSimulationTasksFiles = JSONArray.parseArray(tasksFile, TeacherOpenCourseHandsOnSimulationTasksFileQuery.class); + for (TeacherOpenCourseHandsOnSimulationTasksFileQuery teacherOpenCourseHandsOnSimulationTasksFile : teacherOpenCourseHandsOnSimulationTasksFiles) { + teacherOpenCourseHandsOnSimulationTasksFile.setTeacherOpenCourseId(teacherOpenCourseHandsOnSimulationTasks.getTeacherOpenCourseId()); + teacherOpenCourseHandsOnSimulationTasksFile.setHandsOnId(teacherOpenCourseHandsOnSimulationTasks.getHandsOnId()); + teacherOpenCourseHandsOnSimulationTasksFile.setTaskId(teacherOpenCourseHandsOnSimulationTasks.getTaskId()); + teacherOpenCourseHandsOnSimulationTasksFileService.add(teacherOpenCourseHandsOnSimulationTasksFile); + } + } return msg; } diff --git a/web/src/main/java/com/ibeetl/jlw/service/WeixinService.java b/web/src/main/java/com/ibeetl/jlw/service/WeixinService.java new file mode 100644 index 00000000..ff74c2f6 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/service/WeixinService.java @@ -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; + } + +} \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/web/CompetitionController.java b/web/src/main/java/com/ibeetl/jlw/web/CompetitionController.java index 5a395246..83c2ad94 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/CompetitionController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/CompetitionController.java @@ -10,15 +10,13 @@ import com.ibeetl.admin.core.file.FileService; import com.ibeetl.admin.core.service.CorePlatformService; import com.ibeetl.admin.core.util.TimeTool; import com.ibeetl.admin.core.web.JsonResult; -import com.ibeetl.jlw.entity.Competition; -import com.ibeetl.jlw.entity.CompetitionNews; -import com.ibeetl.jlw.entity.Student; -import com.ibeetl.jlw.entity.UniversitiesCollegesJurisdictionExperimentalSystem; +import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.service.CompetitionNewsService; import com.ibeetl.jlw.service.CompetitionService; import com.ibeetl.jlw.service.StudentService; import com.ibeetl.jlw.service.TeacherService; import com.ibeetl.jlw.web.query.CompetitionQuery; +import com.ibeetl.jlw.web.query.HandsOnQuery; import com.ibeetl.jlw.web.query.StudentQuery; import com.ibeetl.jlw.web.query.TeacherQuery; import org.apache.commons.lang3.StringUtils; @@ -67,7 +65,20 @@ public class CompetitionController{ FileService fileService; /* 前端接口 */ + @PostMapping(API + "/getList.do") + @ResponseBody + public JsonResult getList(CompetitionQuery condition,@SCoreUser CoreUser coreUser){ + condition.setOrgId(coreUser.getOrgId());//TODO 暂时不存在管理员编辑大赛 + UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther(); + if(null != uSystem && ((Integer)1).equals(uSystem.getType())){ + condition.setResourcesApplicationId(uSystem.getTypeId()); + } + + PageQuery page = condition.getPageQuery(); + competitionService.queryByCondition(page); + return JsonResult.success(page); + } /* 后台页面 */ diff --git a/web/src/main/java/com/ibeetl/jlw/web/CoreUserWxController.java b/web/src/main/java/com/ibeetl/jlw/web/CoreUserWxController.java new file mode 100644 index 00000000..b28c494f --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/web/CoreUserWxController.java @@ -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 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 JsonResultgetInfo(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>getList(CoreUserWxQuery param,@SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return JsonResult.failMessage("请登录后再操作"); + }else{ + Listlist = 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 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 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 JsonResultqueryInfo(Long wxId) { + CoreUserWx coreUserWx = coreUserWxService.queryById( wxId); + return JsonResult.success(coreUserWx); + } + + @GetMapping(MODEL + "/getValues.json") + @Function("coreUserWx.query") + public JsonResult>getValues(CoreUserWxQuery param) { + Listlist = 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(); + } + + + + + +} diff --git a/web/src/main/java/com/ibeetl/jlw/web/WeiXinController.java b/web/src/main/java/com/ibeetl/jlw/web/WeiXinController.java new file mode 100644 index 00000000..06582c20 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/web/WeiXinController.java @@ -0,0 +1,98 @@ +package com.ibeetl.jlw.web; + +import cn.jlw.Interceptor.SCoreUser; +import com.ibeetl.admin.core.entity.CoreUser; +import com.ibeetl.jlw.service.WeixinService; +import lombok.extern.slf4j.Slf4j; +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.bean.message.WxMpXmlMessage; +import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; +import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 类功能说明 + * + * @Version 0.0.1 + * @Author 许良彤 + * @Date 2022/11/8 22:00 + */ +@RestController +@RequestMapping("/wx") +@Slf4j +public class WeiXinController { + + + + @Autowired + private WeixinService weixinService; + + @Autowired private WxMpMessageRouter wxMpMessageRouter; + + /** + * 获取公众号二维码 + * @param coreUser 登录用户绑定 + * @return + * @throws WxErrorException + */ + @GetMapping("/api/getQrCode") + public String getQrCode(@SCoreUser CoreUser coreUser) throws WxErrorException { + WxMpQrcodeService qrcodeService = weixinService.getQrcodeService(); + WxMpQrCodeTicket wxMpQrCodeTicket = qrcodeService.qrCodeCreateTmpTicket(coreUser.getId().toString(), 2592000); + return qrcodeService.qrCodePictureUrl(wxMpQrCodeTicket.getTicket()); + } + + /** + * 接收微信公众号推送 + * @param requestBody + * @param signature + * @param timestamp + * @param nonce + * @param openid + * @param encType + * @param msgSignature + * @return + */ + @PostMapping(produces = "application/xml; charset=UTF-8") + public String post( + @RequestBody String requestBody, + @RequestParam("signature") String signature, + @RequestParam("timestamp") String timestamp, + @RequestParam("nonce") String nonce, + @RequestParam("openid") String openid, + @RequestParam(name = "encrypt_type", required = false) String encType, + @RequestParam(name = "msg_signature", required = false) String msgSignature) { + log.info("接收微信请求:[openid=["+openid+"], [signature=["+signature+"], encType=["+ + encType+"], msgSignature=["+msgSignature+"], timestamp=["+ + timestamp+"], nonce=["+nonce+"], requestBody=["+requestBody+"] "); + String out = null; + if (encType == null) { + // 明文传输的消息 + WxMpXmlMessage inMessage = WxMpXmlMessage.fromXml(requestBody); + WxMpXmlOutMessage outMessage = this.wxMpMessageRouter.route(inMessage); + if (outMessage == null) { + WxMpXmlMessage wxMpXmlMessage = new WxMpXmlMessage(); + return ""; + } + + out = outMessage.toXml(); + } else if ("aes".equalsIgnoreCase(encType)) { + // aes加密的消息 + WxMpXmlMessage inMessage = WxMpXmlMessage.fromEncryptedXml(requestBody, weixinService.getWxMpConfigStorage(), + timestamp, nonce, msgSignature); + log.debug("\n消息解密后内容为:\n"+inMessage.toString()); + WxMpXmlOutMessage outMessage = this.wxMpMessageRouter.route(inMessage); + if (outMessage == null) { + return ""; + } + + out = outMessage.toEncryptedXml(weixinService.getWxMpConfigStorage()); + } + log.debug("\n组装回复信息:"+out); + return out; + } + +} \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/CoreUserWxQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/CoreUserWxQuery.java new file mode 100644 index 00000000..d2e0c845 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/web/query/CoreUserWxQuery.java @@ -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; + } +} diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseHandsOnSimulationTasksQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseHandsOnSimulationTasksQuery.java index cdf20b57..f16983cc 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseHandsOnSimulationTasksQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseHandsOnSimulationTasksQuery.java @@ -54,7 +54,8 @@ public class TeacherOpenCourseHandsOnSimulationTasksQuery extends PageParam { /** * 附件列表 */ - private List teacherOpenCourseHandsOnSimulationTasksFile; + private String teacherOpenCourseHandsOnSimulationTasksFile; + private List teacherOpenCourseHandsOnSimulationTasksFileList; private String taskIdPlural; private String handsOnIdPlural; @@ -227,11 +228,19 @@ public class TeacherOpenCourseHandsOnSimulationTasksQuery extends PageParam { this._given = _given; } - public List getTeacherOpenCourseHandsOnSimulationTasksFile() { + public String getTeacherOpenCourseHandsOnSimulationTasksFile() { return teacherOpenCourseHandsOnSimulationTasksFile; } - public void setTeacherOpenCourseHandsOnSimulationTasksFile(List teacherOpenCourseHandsOnSimulationTasksFile) { + public void setTeacherOpenCourseHandsOnSimulationTasksFile(String teacherOpenCourseHandsOnSimulationTasksFile) { this.teacherOpenCourseHandsOnSimulationTasksFile = teacherOpenCourseHandsOnSimulationTasksFile; } + + public List getTeacherOpenCourseHandsOnSimulationTasksFileList() { + return teacherOpenCourseHandsOnSimulationTasksFileList; + } + + public void setTeacherOpenCourseHandsOnSimulationTasksFileList(List teacherOpenCourseHandsOnSimulationTasksFileList) { + this.teacherOpenCourseHandsOnSimulationTasksFileList = teacherOpenCourseHandsOnSimulationTasksFileList; + } } diff --git a/web/src/main/resources/sql/jlw/coreUserWx.md b/web/src/main/resources/sql/jlw/coreUserWx.md new file mode 100644 index 00000000..626f61e0 --- /dev/null +++ b/web/src/main/resources/sql/jlw/coreUserWx.md @@ -0,0 +1,333 @@ +queryByCondition +=== +* 根据不为空的参数进行分页查询 + + select + @pageTag(){ + t.* + @} + from core_user_wx t + where 1=1 + @//数据权限,该sql语句功能点,如果不考虑数据权限,可以删除此行 + and #function("coreUserWx.query")# + @if(!isEmpty(wxId)){ + and t.wx_id =#wxId# + @} + @if(!isEmpty(openid)){ + and t.openid =#openid# + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + @if(!isEmpty(nickname)){ + and t.nickname =#nickname# + @} + @if(!isEmpty(sex)){ + and t.sex =#sex# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(city)){ + and t.city =#city# + @} + @if(!isEmpty(country)){ + and t.country =#country# + @} + @if(!isEmpty(headimgurl)){ + and t.headimgurl =#headimgurl# + @} + @if(!isEmpty(privilege)){ + and t.privilege =#privilege# + @} + @if(!isEmpty(unionid)){ + and t.unionid =#unionid# + @} + + +queryByConditionQuery +=== +* 根据不为空的参数进行分页查询(无权限) + + select + @pageTag(){ + t.* + @} + from core_user_wx t + where 1=1 + @if(!isEmpty(wxId)){ + and t.wx_id =#wxId# + @} + @if(!isEmpty(openid)){ + and t.openid =#openid# + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + @if(!isEmpty(nickname)){ + and t.nickname =#nickname# + @} + @if(!isEmpty(sex)){ + and t.sex =#sex# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(city)){ + and t.city =#city# + @} + @if(!isEmpty(country)){ + and t.country =#country# + @} + @if(!isEmpty(headimgurl)){ + and t.headimgurl =#headimgurl# + @} + @if(!isEmpty(privilege)){ + and t.privilege =#privilege# + @} + @if(!isEmpty(unionid)){ + and t.unionid =#unionid# + @} + + + + +deleteCoreUserWxByIds +=== + +* 批量删除 + + delete from core_user_wx where find_in_set(wx_id,#ids#) + + + +getByIds +=== + +select * from core_user_wx where find_in_set(wx_id,#ids#) + + +updateGivenByIds +=== + +* 批量更新指定字段,无论此字段是否有值 + + update core_user_wx + set + @if(contain("openid",_given)){ + @if(isEmpty(openid)){ + openid = null , + @}else{ + openid = #openid# , + @} + @} + @if(contain("userId",_given)){ + @if(isEmpty(userId)){ + user_id = null , + @}else{ + user_id = #userId# , + @} + @} + @if(contain("nickname",_given)){ + @if(isEmpty(nickname)){ + nickname = null , + @}else{ + nickname = #nickname# , + @} + @} + @if(contain("sex",_given)){ + @if(isEmpty(sex)){ + sex = null , + @}else{ + sex = #sex# , + @} + @} + @if(contain("province",_given)){ + @if(isEmpty(province)){ + province = null , + @}else{ + province = #province# , + @} + @} + @if(contain("city",_given)){ + @if(isEmpty(city)){ + city = null , + @}else{ + city = #city# , + @} + @} + @if(contain("country",_given)){ + @if(isEmpty(country)){ + country = null , + @}else{ + country = #country# , + @} + @} + @if(contain("headimgurl",_given)){ + @if(isEmpty(headimgurl)){ + headimgurl = null , + @}else{ + headimgurl = #headimgurl# , + @} + @} + @if(contain("privilege",_given)){ + @if(isEmpty(privilege)){ + privilege = null , + @}else{ + privilege = #privilege# , + @} + @} + @if(contain("unionid",_given)){ + @if(isEmpty(unionid)){ + unionid = null , + @}else{ + unionid = #unionid# , + @} + @} + wx_id = wx_id + where find_in_set(wx_id,#wxIdPlural#) + + + +getCoreUserWxValues +=== + +* 根据不为空的参数进行查询 + + select t.* + from core_user_wx t + where 1=1 + @if(!isEmpty(wxId)){ + and t.wx_id =#wxId# + @} + @if(!isEmpty(openid)){ + and t.openid =#openid# + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(nickname)){ + and t.nickname =#nickname# + @} + @if(!isEmpty(sex)){ + and t.sex =#sex# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(city)){ + and t.city =#city# + @} + @if(!isEmpty(country)){ + and t.country =#country# + @} + @if(!isEmpty(headimgurl)){ + and t.headimgurl =#headimgurl# + @} + @if(!isEmpty(privilege)){ + and t.privilege =#privilege# + @} + @if(!isEmpty(unionid)){ + and t.unionid =#unionid# + @} + + +getValuesByQuery +=== + +* 根据不为空的参数进行查询 + + select t.* + from core_user_wx t + where 1=1 and #function("coreUserWx.query")# + @if(!isEmpty(wxId)){ + and t.wx_id =#wxId# + @} + @if(!isEmpty(openid)){ + and t.openid =#openid# + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + @if(!isEmpty(nickname)){ + and t.nickname =#nickname# + @} + @if(!isEmpty(sex)){ + and t.sex =#sex# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(city)){ + and t.city =#city# + @} + @if(!isEmpty(country)){ + and t.country =#country# + @} + @if(!isEmpty(headimgurl)){ + and t.headimgurl =#headimgurl# + @} + @if(!isEmpty(privilege)){ + and t.privilege =#privilege# + @} + @if(!isEmpty(unionid)){ + and t.unionid =#unionid# + @} + + +getValuesByQueryNotWithPermission +=== + +* 根据不为空的参数进行查询(不包含权限) + + select t.* + from core_user_wx t + where 1=1 + @if(!isEmpty(wxId)){ + and t.wx_id =#wxId# + @} + @if(!isEmpty(openid)){ + and t.openid =#openid# + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(userIdPlural)){ + and find_in_set(t.user_id,#userIdPlural#) + @} + @if(!isEmpty(nickname)){ + and t.nickname =#nickname# + @} + @if(!isEmpty(sex)){ + and t.sex =#sex# + @} + @if(!isEmpty(province)){ + and t.province =#province# + @} + @if(!isEmpty(city)){ + and t.city =#city# + @} + @if(!isEmpty(country)){ + and t.country =#country# + @} + @if(!isEmpty(headimgurl)){ + and t.headimgurl =#headimgurl# + @} + @if(!isEmpty(privilege)){ + and t.privilege =#privilege# + @} + @if(!isEmpty(unionid)){ + and t.unionid =#unionid# + @} + + + diff --git a/web/src/main/resources/static/js/jlw/coreUserWx/add.js b/web/src/main/resources/static/js/jlw/coreUserWx/add.js new file mode 100644 index 00000000..3ce6ba93 --- /dev/null +++ b/web/src/main/resources/static/js/jlw/coreUserWx/add.js @@ -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); +}); diff --git a/web/src/main/resources/static/js/jlw/coreUserWx/coreUserWxApi.js b/web/src/main/resources/static/js/jlw/coreUserWx/coreUserWxApi.js new file mode 100644 index 00000000..69214706 --- /dev/null +++ b/web/src/main/resources/static/js/jlw/coreUserWx/coreUserWxApi.js @@ -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); +}); \ No newline at end of file diff --git a/web/src/main/resources/static/js/jlw/coreUserWx/del.js b/web/src/main/resources/static/js/jlw/coreUserWx/del.js new file mode 100644 index 00000000..57aadd74 --- /dev/null +++ b/web/src/main/resources/static/js/jlw/coreUserWx/del.js @@ -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); + +}); \ No newline at end of file diff --git a/web/src/main/resources/static/js/jlw/coreUserWx/edit.js b/web/src/main/resources/static/js/jlw/coreUserWx/edit.js new file mode 100644 index 00000000..1bb44130 --- /dev/null +++ b/web/src/main/resources/static/js/jlw/coreUserWx/edit.js @@ -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); + +}); \ No newline at end of file diff --git a/web/src/main/resources/static/js/jlw/coreUserWx/index.js b/web/src/main/resources/static/js/jlw/coreUserWx/index.js new file mode 100644 index 00000000..e965228a --- /dev/null +++ b/web/src/main/resources/static/js/jlw/coreUserWx/index.js @@ -0,0 +1,199 @@ +layui.define([ 'form', 'laydate', 'table' ], function(exports) { + var form = layui.form; + var laydate = layui.laydate; + var table = layui.table; + var coreUserWxTable = null; + var view ={ + init:function(){ + var that = this + this.initTable(); + this.initSearchForm(); + this.initToolBar(); + window.dataReload = function(){ + Lib.doSearchForm($("#searchForm"),coreUserWxTable) + that.initToolBar(); + } + }, + initTable:function(){ + var sx_ = localStorage.getItem("coreUserWxTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存 + if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);} + coreUserWxTable = table.render({ + elem : '#coreUserWxTable', + height : Lib.getTableHeight(1), + cellMinWidth: 100, + method : 'post', + url : Common.ctxPath + '/jlw/coreUserWx/list.json' // 数据接口 + ,page : Lib.tablePage // 开启分页 + ,toolbar: '#toolbar_coreUserWx' //自定义头部左侧工具栏 + ,defaultToolbar: ['filter', 'print', 'exports'] //头部右侧工具栏 + ,limit : 10, + cols : [ [ // 表头 + { + type : 'checkbox', + + }, + { + field : 'wxId', + title : '微信绑定主键', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['wxId'])?false:sx_['wxId'], + + width : 60, + }, + { + field : 'openid', + title : '微信openID', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['openid'])?false:sx_['openid'], + }, + { + field : 'userId', + title : '系统用户id', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['userId'])?false:sx_['userId'], + }, + { + field : 'nickname', + title : '用户昵称', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['nickname'])?false:sx_['nickname'], + }, + { + field : 'sex', + title : 'sex', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['sex'])?false:sx_['sex'], + }, + { + field : 'province', + title : 'province', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['province'])?false:sx_['province'], + }, + { + field : 'city', + title : 'city', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['city'])?false:sx_['city'], + }, + { + field : 'country', + title : 'country', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['country'])?false:sx_['country'], + }, + { + field : 'headimgurl', + title : '头像', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['headimgurl'])?false:sx_['headimgurl'], + }, + { + field : 'privilege', + title : 'privilege', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['privilege'])?false:sx_['privilege'], + }, + { + field : 'unionid', + title : 'unionid', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['unionid'])?false:sx_['unionid'], + } + ,{ + field : 'operation_',title : '操作',align:"center", templet: function (d) { + var htm = ''; + htm += ''; + return htm; + } + } + + ] ] + + }); + + table.on('checkbox(coreUserWxTable)', function(obj){ + var coreUserWx = obj.data; + if(obj.checked){ + //按钮逻辑Lib.buttonEnable() + }else{ + + } + }) + }, + + initSearchForm:function(){ + Lib.initSearchForm( $("#searchForm"),coreUserWxTable,form); + }, + + initToolBar:function(){ + toolbar = { + add: function () { + var url = "/jlw/coreUserWx/add.do"; + Common.openDlg(url,"微信登录绑定管理>新增"); + }, + edit: function () { + var data = Common.getOneFromTable(table,"coreUserWxTable"); + if(data==null){ + return ; + } + var url = "/jlw/coreUserWx/add.do?wxId="+data.wxId; + Common.openDlg(url,"微信登录绑定管理>"+data.wxId+">编辑"); + }, + del: function () { + layui.use(['del'], function(){ + var delView = layui.del + delView.delBatch(); + }); + }, + search: function () { + Lib.doSearchForm($("#searchForm"), coreUserWxTable, 1); + view.initToolBar() + }, + refresh: function () { + searchForm.reset(); + Lib.doSearchForm($("#searchForm"), coreUserWxTable, 1); + view.initToolBar() + }, + } + //触发事件 + $('.ext-toolbar').on('click', function() { + var type = $(this).data('type'); + toolbar[type] ? toolbar[type].call(this) : ''; + }); + + }, initTableTool: table.on('tool(coreUserWxTable)', function (obj) { + var data = obj.data; + if (obj.event === 'edit') { + var url = "/jlw/coreUserWx/add.do?wxId="+data.wxId; + Common.openDlg(url,"微信登录绑定管理>"+data.wxId+">编辑"); + }else if(obj.event === "del"){ + layer.confirm('是否确定删除该信息?', function (index) { + var ret = Common.postAjax("/jlw/coreUserWx/delete.json",{ids:data.wxId}); + layer.msg(ret.code == 0?"删除成功!":ret.msg, { + offset: ['50%'], + icon: ret.code == 0?1:2, + time: 1500 //2秒关闭(如果不配置,默认是3秒) + },function (){ + if(ret.code == 0){ + Lib.tableRefresh(); + } + }); + }); + } + }) + } + exports('index',view); + +}); diff --git a/web/src/main/resources/templates/jlw/coreUserWx/add.html b/web/src/main/resources/templates/jlw/coreUserWx/add.html new file mode 100644 index 00000000..20cdfd79 --- /dev/null +++ b/web/src/main/resources/templates/jlw/coreUserWx/add.html @@ -0,0 +1,94 @@ + + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + + + diff --git a/web/src/main/resources/templates/jlw/coreUserWx/edit.html b/web/src/main/resources/templates/jlw/coreUserWx/edit.html new file mode 100644 index 00000000..c281e18f --- /dev/null +++ b/web/src/main/resources/templates/jlw/coreUserWx/edit.html @@ -0,0 +1,94 @@ + + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + + + diff --git a/web/src/main/resources/templates/jlw/coreUserWx/index.html b/web/src/main/resources/templates/jlw/coreUserWx/index.html new file mode 100644 index 00000000..e861228c --- /dev/null +++ b/web/src/main/resources/templates/jlw/coreUserWx/index.html @@ -0,0 +1,29 @@ + + + +
+ + + +