景区管控

l
chenfeng 7 months ago
parent 6874e05291
commit 60b3520308
  1. 212
      src/main/java/com/cjy/back/ybsjAppointment/controller/YbsjyAppletsAppointmentController.java
  2. 5
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentRecordMapper.xml
  3. 11
      src/main/java/com/cjy/back/ybsjMessageInfo/controller/YbsjMessageInfoController.java
  4. 213
      src/main/java/com/cjy/back/ybsjMessageInfo/dao/YbsjMessageInfoMapper.java
  5. 20
      src/main/java/com/cjy/back/ybsjMessageInfo/dao/YbsjMessageInfoMapper.xml
  6. 51
      src/main/java/com/cjy/back/ybsjMessageInfo/entity/YbsjTkContent.java
  7. 5
      src/main/java/com/cjy/back/ybsjMessageInfo/service/YbsjMessageInfoService.java
  8. 20
      src/main/java/com/cjy/back/ybsjMessageInfo/service/impl/YbsjMessageInfoServiceImpl.java
  9. 171
      src/main/webapp/html/back/ybsjZdLine/list_ybsjZdLineList.js
  10. 79
      src/main/webapp/html/back/yuyue/reservationManagementAdd.js
  11. 56
      src/main/webapp/html/back/yuyueList/reservationRecord.html
  12. 77
      src/main/webapp/html/back/yuyueList/studyReservationRecord.html
  13. 58
      src/main/webapp/html/back/yuyueList/teamReservationRecord.html

@ -6,6 +6,10 @@ import com.cjy.back.ybsjAppointment.entity.vo.ReservationNowVO;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentRecordService;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentSettingService;
import com.cjy.util.ServerResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.FileUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.jupiter.api.extension.MediaType;
@ -16,17 +20,18 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import sun.net.www.http.HttpClient;
import java.io.OutputStream;
import java.io.*;
import java.net.HttpURLConnection;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author liangjiawei
@ -180,63 +185,176 @@ public class YbsjyAppletsAppointmentController {
return ServerResponse.createBySuccess(response);
}
// public static String uploadImage(String accessToken, File imageFile) throws IOException {
// String url = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=" + accessToken + "&type=image";
// OkHttpClient client = new OkHttpClient();
// RequestBody body = new MultipartBody.Builder()
// .setType(MultipartBody.FORM)
// .addFormDataPart("media", imageFile.getName(),
// RequestBody.create(imageFile, MediaType.parse("image/*")))
// .build();
// Request request = new Request.Builder().url(url).post(body).build();
// try (Response response = client.newCall(request).execute()) {
// JSONObject result = new JSONObject(response.body().string());
// return result.getString("media_id"); // 返回永久素材ID
// }
// }
@RequestMapping("/createDraft")
public ServerResponse createDraft(String accessToken, String title, String content, String thumbMediaId) throws IOException {
String url = "https://api.weixin.qq.com/cgi-bin/draft/add?access_token=" + accessToken;
// 构建请求体
JSONObject article = new JSONObject();
article.put("title", title);
article.put("content", content);
article.put("thumb_media_id", thumbMediaId);
article.put("need_open_comment", 0);
JSONArray articles = new JSONArray();
articles.put(article);
JSONObject requestBody = new JSONObject().put("articles", articles);
// 创建连接
// 1. 下载网络图片(支持自动重试)
private static File downloadImage(String imageUrl) throws IOException, InterruptedException {
File tempFile = File.createTempFile("wx_", ".tmp"); // 先创建临时文件
// 下载文件内容
FileUtils.copyURLToFile(new URL(imageUrl), tempFile);
// 验证文件头
try (InputStream is = new FileInputStream(tempFile)) {
byte[] header = new byte[8];
is.read(header);
// PNG头: 89 50 4E 47 0D 0A 1A 0A
// JPEG头: FF D8 FF
if (!(header[0] == (byte) 0x89 && header[1] == 'P' && header[2] == 'N' && header[3] == 'G') &&
!(header[0] == (byte) 0xFF && header[1] == (byte) 0xD8 && header[2] == (byte) 0xFF)) {
throw new IOException("无效的图片格式");
}
}
return tempFile;
}
// 2. 微信图片上传(修复41005错误)
private static String uploadToWeChat(String accessToken, File file) throws IOException {
String newName ="";
// 1. 验证文件类型
String fileName = file.getName().toLowerCase();
if (!fileName.endsWith(".jpg") && !fileName.endsWith(".jpeg") && !fileName.endsWith(".png")) {
// 重命名临时文件为有效扩展名
newName = fileName.split("\\.")[0] + ".jpg";
File newFile = new File(file.getParent(), newName);
file.renameTo(newFile);
file = newFile;
}
FileInputStream input = new FileInputStream(file);
String url = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=" + accessToken + "&type=image";
String boundary = "----WebKitFormBoundary" + System.currentTimeMillis();
String lineEnd = "\r\n";
String twoHyphens = "--";
HttpURLConnection connection = null;
try {
URL requestUrl = new URL(url);
connection = (HttpURLConnection) requestUrl.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Connection", "Keep-Alive");
connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
OutputStream outputStream = connection.getOutputStream();
PrintWriter writer = new PrintWriter(new OutputStreamWriter(outputStream, "UTF-8"), true);
// 添加文件部分
writer.append(twoHyphens + boundary + lineEnd);
writer.append("Content-Disposition: form-data; name=\"media\"; filename=\"" + newName + "\"" + lineEnd);
writer.append("Content-Type: image/*" + lineEnd);
writer.append(lineEnd);
writer.flush();
// 写入文件内容(使用 MultipartFile.getInputStream())
InputStream inputStream = input; // 关键修改点!
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
outputStream.flush();
inputStream.close();
// 结束部分
writer.append(lineEnd);
writer.append(twoHyphens + boundary + twoHyphens + lineEnd);
writer.close();
// 获取响应
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
response.append(line);
}
reader.close();
JSONObject result = new JSONObject(response.toString());
return result.getString("url");
} else {
throw new IOException("Server returned non-OK status: " + responseCode);
}
} finally {
if (connection != null) {
connection.disconnect();
}
}
}
// 3. 替换内容中的图片链接
private static String processContent(String html, String accessToken) throws Exception {
Pattern pattern = Pattern.compile("<img[^>]+src\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>");
Matcher matcher = pattern.matcher(html);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
String imgUrl = matcher.group(1);
File tempFile = downloadImage(imgUrl);
String wechatUrl = uploadToWeChat(accessToken, tempFile);
matcher.appendReplacement(result, "<img src='" + wechatUrl + "'/>");
tempFile.delete();
}
matcher.appendTail(result);
return result.toString();
}
// 4. 创建草稿
private static void createDraft(String accessToken, String title, String content) throws IOException {
String url = "https://api.weixin.qq.com/cgi-bin/draft/add?access_token=" + accessToken;
JSONObject article = new JSONObject()
.put("title", title)
.put("content", content)
.put("thumb_media_id", "qR_BnS7D9o1TqpJLTGV3Pmbnz48dU3zFGu6Y_9ws5iKDXNFBGdIHIyRXJVuIjK1b")
.put("show_cover_pic", 1);
JSONArray articles = new JSONArray().put(article);
String requestBody = new JSONObject().put("articles", articles).toString();
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/json");
// 发送请求
try (OutputStream os = conn.getOutputStream()) {
os.write(requestBody.toString().getBytes("UTF-8"));
os.write(requestBody.getBytes("UTF-8"));
}
// 处理响应
int responseCode = conn.getResponseCode();
if (responseCode != HttpURLConnection.HTTP_OK) {
throw new IOException("HTTP error code: " + responseCode);
}
try (BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream(), "UTF-8"))) {
StringBuilder response = new StringBuilder();
try (BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {
String line;
StringBuilder response = new StringBuilder();
while ((line = br.readLine()) != null) {
response.append(line);
}
JSONObject result = new JSONObject(response.toString());
return result.getString("media_id");
} finally {
conn.disconnect();
System.out.println("草稿创建结果: " + response);
}
}
// 完整流程执行
public static void main(String[] args) {
String accessToken = "91_ylo5YKGyByedvMot_MpRHPR-sECJQR5rJP0AkZUUIxQF4hlmboAj3KHbKu5NhdX-Z4YXMFerlcymRYIuzxczqvrX01iLZHEu1SLRD4Lf7tbuTNIQWN0JXlPJeVEXDRgAHAQWK";
String originalContent = "<p>测试</p><p><img src=\"https://www.lbgjtoa.com//ueditor/jsp/upload/image/20250410/1744249230410003547.png\" title=\"1744249230410003547.png\" alt=\"zhxh.png\"/></p><p>测试</p><p><img src=\"https://www.lbgjtoa.com//ueditor/jsp/upload/image/20250410/1744249247602088781.png\" title=\"1744249247602088781.png\" alt=\"zhxh.png\"/></p>";
try {
// 步骤1: 处理内容中的图片
String processedContent = processContent(originalContent, accessToken);
System.out.println("处理后的内容:\n" + processedContent);
// 步骤2: 创建草稿
createDraft(accessToken, "测试文章1", processedContent);
} catch (Exception e) {
e.printStackTrace();
System.err.println("处理失败: " + e.getMessage());
}
}
}

@ -442,8 +442,9 @@
</select>
<select id="selectPop" resultType="map">
select guid,title,content
from ybsj_message_info
select guid,ybsj_message_info.title,ybsj_tk_content.content,ybsj_tk_content.start_time,ybsj_tk_content.end_time
from ybsj_message_info left join ybsj_tk_content
on ybsj_message_info.guid = ybsj_tk_content.message_info_id
WHERE ispopup = 'YES'
and userkey ='95034a2bb9a843b79dbc93f74599282b'
and isdel = 'NO'

@ -70,6 +70,17 @@ public class YbsjMessageInfoController {
return messageInfoService.updateIspopupMessageInfo(request,session);
}
/**
* 查询弹框内容
* @param messageInfoId
* @return
*/
@RequestMapping("/selectContentById.do")
public ServerResponse selectContentById(Long messageInfoId){
return ServerResponse.createBySuccess(messageInfoService.selectContentById(messageInfoId));
}
/**
*
* @Description: 修改假删除

@ -1,6 +1,7 @@
package com.cjy.back.ybsjMessageInfo.dao;
import com.cjy.back.ybsjMessageInfo.entity.YbsjMessageInfo;
import com.cjy.back.ybsjMessageInfo.entity.YbsjTkContent;
import com.cjy.common.mybatis.page.PageParameter;
import org.apache.ibatis.annotations.Param;
@ -11,205 +12,203 @@ import java.util.Map;
public interface YbsjMessageInfoMapper {
/**
*
* @Description: 查询消息类型列表数据
* @param
* @param page
* @param
* @param page
* @return
* @author hpr
* @date 2019/10/31
*/
List<Map<String,Object>> getListDataFormFilterByPage(@Param("userkey") String userkey, @Param("type") String type, @Param("list") List<Map<String, Object>> tableFeild, @Param("page") PageParameter page, @Param("title") String title, @Param("region") String region, @Param("sort") String sort, @Param("isrecommend") String isrecommend);
* @Description: 查询消息类型列表数据
* @author hpr
* @date 2019/10/31
*/
List<Map<String, Object>> getListDataFormFilterByPage(@Param("userkey") String userkey, @Param("type") String type, @Param("list") List<Map<String, Object>> tableFeild, @Param("page") PageParameter page, @Param("title") String title, @Param("region") String region, @Param("sort") String sort, @Param("isrecommend") String isrecommend);
/**
*
* @Description: 修改排序
* @param id 主键
* @param sort 排序位置
* @return
* @author hpr
* @date 2019/10/31
*/
int updateMessageInfoSort(@Param("guid") Integer id,@Param("sort") String sort);
* @param id 主键
* @param sort 排序位置
* @return
* @Description: 修改排序
* @author hpr
* @date 2019/10/31
*/
int updateMessageInfoSort(@Param("guid") Integer id, @Param("sort") String sort);
/**
*
* @Description: 修改推荐
* @param id 主键
* @param id 主键
* @param isrecommend 是否推荐
* @return
* @Description: 修改推荐
* @author hpr
* @date 2019/10/31
*/
int recommendMessageInfo(@Param("guid") Integer id,@Param("isrecommend") String isrecommend);
int recommendMessageInfo(@Param("guid") Integer id, @Param("isrecommend") String isrecommend);
/**
*
* @Description: 修改弹框
* @param id 主键
* @param id 主键
* @param ispopup 是否弹框
* @return
* @Description: 修改弹框
* @author hpr
* @date 2019/10/31
*/
int updateIspopupMessageInfo(@Param("guid") Integer id,@Param("ispopup") String ispopup);
int updateIspopupMessageInfo(@Param("guid") Integer id, @Param("ispopup") String ispopup);
/**
* 查询有没有已经推荐的数据
*
* @param userkey
* @return
*/
int selectIspopupCount(@Param("userkey")String userkey,@Param("guid") String id);
int selectIspopupCount(@Param("userkey") String userkey, @Param("guid") String id);
/**
*
* @Description: 修改假删除
* @param id 主键
* @param id 主键
* @param isdel 是否假删除
* @return
* @Description: 修改假删除
* @author hpr
* @date 2019/10/31
*/
int isdelMessageInfo(@Param("guid") Integer id,@Param("isdel") String isdel);
int isdelMessageInfo(@Param("guid") Integer id, @Param("isdel") String isdel);
/**
*
* @Description: 查询信息详情
* @param guid 主键
* @param guid 主键
* @param tableFeild
* @return
* @Description: 查询信息详情
* @author hpr
* @date 2019/10/31
*/
Map<String,Object> selectDetailById(@Param("guid") String guid, @Param("list") List<Map<String, Object>> tableFeild);
Map<String, Object> selectDetailById(@Param("guid") String guid, @Param("list") List<Map<String, Object>> tableFeild);
/**
*
* @Description: 修改信息内容
* @param messageInfo 信息实体
* @param messageInfo 信息实体
* @return
* @Description: 修改信息内容
* @author hpr
* @date 2019/11/1
*/
int updateMessageInfo(YbsjMessageInfo messageInfo);
/**
*
* @Description: 新增信息内容
* @param messageInfo 信息实体
* @param messageInfo 信息实体
* @return
* @Description: 新增信息内容
* @author hpr
* @date 2019/11/1
*/
int saveMessageInfo(YbsjMessageInfo messageInfo);
/**
*
* @Description: 新增信息内容
* @param guid 主键
* @param guid 主键
* @return
* @Description: 新增信息内容
* @author hpr
* @date 2019/11/1
*/
void deleteMessageInfo(String guid);
/**
*
* @Description: 根据id查询所有的数据
* @param guid 主键
* @return
* @author hpr
* @date 2019/11/1
*/
* @param guid 主键
* @return
* @Description: 根据id查询所有的数据
* @author hpr
* @date 2019/11/1
*/
YbsjMessageInfo selectDetailAllById(String guid);
/**
*
* @Description: 根据类型与用户id查询信息数据
* @param type 类型 id 用户id
* @return
* @author hpr
* @date 2019/11/11
*/
List<Map<String,Object>> selectDataByType(@Param("type") String type,@Param("userkey") String userkey);
* @param type 类型 id 用户id
* @return
* @Description: 根据类型与用户id查询信息数据
* @author hpr
* @date 2019/11/11
*/
List<Map<String, Object>> selectDataByType(@Param("type") String type, @Param("userkey") String userkey);
/**
*
* @Description: 根据字段值查询对应数据的所有名称
* @param
* @param column_name
* @param
* @param column_name
* @return
* @author hpr
* @date 2019/12/23
*/
String selectCheckSubColumnValueById(@Param("guid") Integer guid,@Param("column_name") String column_name);
* @Description: 根据字段值查询对应数据的所有名称
* @author hpr
* @date 2019/12/23
*/
String selectCheckSubColumnValueById(@Param("guid") Integer guid, @Param("column_name") String column_name);
/**
*
* @Description: 手机端查询数据
* @param filterMap 筛选条件
* @return
* @author hpr
* @date 2020/1/3
*/
List<Map<String,Object>> getMessageInfoFormFilterByPage(@Param("page") PageParameter page, @Param("map") HashMap<String,Object> filterMap);
* @param filterMap 筛选条件
* @return
* @Description: 手机端查询数据
* @author hpr
* @date 2020/1/3
*/
List<Map<String, Object>> getMessageInfoFormFilterByPage(@Param("page") PageParameter page, @Param("map") HashMap<String, Object> filterMap);
/**
*
* @Description: 手机端查询数据
* @param filterMap 筛选条件
* @return
* @author hpr
* @date 2020/1/3
*/
List<Map<String,Object>> getMessageInfoFormFilter_twoByPage(@Param("page") PageParameter page, @Param("map") HashMap<String,Object> filterMap);
* @param filterMap 筛选条件
* @return
* @Description: 手机端查询数据
* @author hpr
* @date 2020/1/3
*/
List<Map<String, Object>> getMessageInfoFormFilter_twoByPage(@Param("page") PageParameter page, @Param("map") HashMap<String, Object> filterMap);
/**
* 功能描述: 手机端查询数据--美食和特产
*
* @param:
* @return:
* @auther: zc
* @date: 2020/3/31 8:58
*/
List<Map<String,Object>> getMessageInfoFormFilter_foodByPage(@Param("page") PageParameter page, @Param("map") HashMap<String,Object> filterMap);
List<Map<String, Object>> getMessageInfoFormFilter_foodByPage(@Param("page") PageParameter page, @Param("map") HashMap<String, Object> filterMap);
/**
*
* @Description: 根据主键查询信息详情
* @param
* @return
* @author hpr
* @date 2020/1/6
*/
Map<String,Object> getMessageDetailFormId(@Param("map") HashMap<String, Object> filterMap);
* @param
* @return
* @Description: 根据主键查询信息详情
* @author hpr
* @date 2020/1/6
*/
Map<String, Object> getMessageDetailFormId(@Param("map") HashMap<String, Object> filterMap);
/**
* 功能描述: 手机端景区列表
*
* @param:
* @return:
* @auther: zc
* @date: 2020/1/3 14:25
*/
List<Map<String,Object>> scenicList(@Param("type") String type,@Param("userkey") String userkey);
List<Map<String, Object>> scenicList(@Param("type") String type, @Param("userkey") String userkey);
/**
*
* @Description: 修改信息的浏览量
* @param
* @return
* @author hpr
* @date 2020/1/8
*/
* @param
* @return
* @Description: 修改信息的浏览量
* @author hpr
* @date 2020/1/8
*/
int updateMessageBrowsenumFeildFormId(@Param("map") HashMap<String, Object> map);
/**
*
* @Description: 修改信息的点赞量
* @param
* @return
* @author hpr
* @date 2020/1/8
*/
* @param
* @return
* @Description: 修改信息的点赞量
* @author hpr
* @date 2020/1/8
*/
int updateMessageUpnumFeildFormId(@Param("map") HashMap<String, Object> map);
String test(String s);
List<Map<String,Object>> selectRecommendedAttractions(@Param("key") String key);
List<Map<String, Object>> selectRecommendedAttractions(@Param("key") String key);
// 添加记录
int insertContent(YbsjTkContent content);
// 修改记录
int updateContent(YbsjTkContent content);
// 根据 message_info_id 查询记录
YbsjTkContent selectContentById(Long message_info_id);
}

@ -742,5 +742,25 @@
select dicnum from ybsj_message_type where userkey=#{key} and mestype ='yule'
) and userkey=#{key}
</select>
<!-- 添加记录 -->
<insert id="insertContent" parameterType="com.cjy.back.ybsjMessageInfo.entity.YbsjTkContent">
INSERT INTO ybsj_tk_content (messageInfoId, content, startTime, endTime)
VALUES (#{message_info_id}, #{content}, #{start_time}, #{end_time})
</insert>
<!-- 修改记录 -->
<update id="updateContent" parameterType="com.cjy.back.ybsjMessageInfo.entity.YbsjTkContent">
UPDATE ybsj_tk_content
SET content = #{content},
start_time = #{startTime},
end_time = #{endTime}
WHERE message_info_id = #{messageInfoId}
</update>
<!-- 根据 message_info_id 查询记录 -->
<select id="selectContentById" parameterType="java.lang.Long" resultType="com.cjy.back.ybsjMessageInfo.entity.YbsjTkContent">
SELECT message_info_id, content, start_time, end_time,id
FROM ybsj_tk_content
WHERE message_info_id = #{message_info_id}
</select>
</mapper>

@ -0,0 +1,51 @@
package com.cjy.back.ybsjMessageInfo.entity;
import java.util.Date;
public class YbsjTkContent {
private Integer id;
private Integer messageInfoId;
private String content;
private String startTime;
private String endTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getMessageInfoId() {
return messageInfoId;
}
public void setMessageInfoId(Integer messageInfoId) {
this.messageInfoId = messageInfoId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}

@ -1,6 +1,7 @@
package com.cjy.back.ybsjMessageInfo.service;
import com.cjy.back.ybsjMessageInfo.entity.YbsjMessageInfo;
import com.cjy.back.ybsjMessageInfo.entity.YbsjTkContent;
import com.cjy.util.ServerResponse;
import javax.servlet.http.HttpServletRequest;
@ -49,6 +50,10 @@ public interface YbsjMessageInfoService {
* @date 2019/10/31
*/
ServerResponse updateIspopupMessageInfo(HttpServletRequest request, HttpSession session);
// 根据 message_info_id 查询记录
YbsjTkContent selectContentById(Long message_info_id);
/**
*
* @Description: 修改假删除

@ -8,6 +8,7 @@ import com.cjy.back.ybsjAllData.dao.YbsjAllDataMapper;
import com.cjy.back.ybsjFoodSpecialgoodShop.dao.YbsjFoodSpecialgoodShopMapper;
import com.cjy.back.ybsjMessageInfo.dao.YbsjMessageInfoMapper;
import com.cjy.back.ybsjMessageInfo.entity.YbsjMessageInfo;
import com.cjy.back.ybsjMessageInfo.entity.YbsjTkContent;
import com.cjy.back.ybsjMessageInfo.service.YbsjMessageInfoService;
import com.cjy.back.ybsjMessageType.dao.YbsjMessageTypeMapper;
import com.cjy.back.ybsjZdLine.dao.YbsjZdLineMapper;
@ -250,12 +251,31 @@ public class YbsjMessageInfoServiceImpl implements YbsjMessageInfoService {
if (i <= 0) {
return ServerResponse.createByErrorMessage("修改失败");
}
if (is){
String tkId = request.getParameter("tkId");
YbsjTkContent ybsjTkContent =new YbsjTkContent();
ybsjTkContent.setMessageInfoId(Integer.valueOf(guid));
ybsjTkContent.setStartTime(request.getParameter("startTime"));
ybsjTkContent.setEndTime(request.getParameter("endTime"));
ybsjTkContent.setContent(request.getParameter("popupContent"));
if (tkId != null && !tkId.equals("")) {
messageInfoMapper.updateContent(ybsjTkContent);
}else {
messageInfoMapper.insertContent(ybsjTkContent);
}
}
//TODO 重新初始化相关message_info表的redis数据
CorrelationData correlationData = new CorrelationData(admin.getUserkey() + "_message_info_init_" + System.currentTimeMillis());
rabbitTemplate.convertAndSend(RabbitMQConfig.REDIS_EXCHANGE, RabbitMQConfig.MESSAGE_ROUT_KEY, admin.getUserkey(), correlationData);
//initDataRedis.run(admin.getUserkey());
return ServerResponse.createBySuccessMessage(msg);
}
@Override
public YbsjTkContent selectContentById(Long message_info_id) {
return messageInfoMapper.selectContentById(message_info_id);
}
/**
* @param request guid/is 主键和修改后的排序参数
* @return

@ -386,32 +386,161 @@ layui.form.on('switch(isrecommend)', function(data) {
}
});
});
//是否弹框
layui.form.on('switch(ispopup)', function(data) {
var checkbox = data.elem; // 获取当前操作的 checkbox 元素
var originalState = checkbox.checked; // 记录原始状态(用于回滚)
$.ajax({
url : ctx + '/messageInfo/updateIspopupMessageInfo.do',
type : 'post',
datatype : 'json',
data : {
guid : data.elem.value,
ispopup : data.elem.checked
},
xhrFields: {
withCredentials: true // 这里设置了withCredentials
},
success : function(res) {
if(res.success){
layerMessage(res.msg);
}else{
checkbox.checked = !originalState; // 回滚到之前的状态
var checkbox = data.elem;
var originalState = checkbox.checked;
var guid = data.elem.value;
if (data.elem.checked) {
// 先查询是否已有弹窗设置
$.ajax({
url: ctx + '/messageInfo/selectContentById.do?messageInfoId='+guid,
type: 'post',
dataType: 'json',
xhrFields: { withCredentials: true },
success: function(res) {
if(res.success) {
var popupData = res.data || {};
// 弹出设置窗口并回显数据
showPopupSetting(checkbox, guid, popupData);
} else {
checkbox.checked = false;
layui.form.render('checkbox');
error(res);
}
},
error: function() {
checkbox.checked = false;
layui.form.render('checkbox');
error(res);
layer.msg('查询弹窗设置失败');
}
});
} else {
// 关闭弹窗时的处理
$.ajax({
url: ctx + '/messageInfo/updateIspopupMessageInfo.do',
type: 'post',
datatype: 'json',
data: { guid: guid, ispopup: false },
xhrFields: { withCredentials: true },
success: function(res) {
if(!res.success) {
checkbox.checked = originalState;
layui.form.render('checkbox');
error(res);
} else {
layerMessage(res.msg);
}
}
});
}
});
// 显示弹窗设置窗口
function showPopupSetting(checkbox, guid, popupData) {
layer.open({
type: 1,
title: '弹窗设置',
area: ['600px', '300px'],
content: `
<div class="layui-form" style="padding: 20px;">
<div class="layui-form-item">
<label class="layui-form-label">弹出内容</label>
<div class="layui-input-block">
<textarea id="popupContent" placeholder="请输入弹窗内容" class="layui-textarea">${popupData.content || ''}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">弹窗期限</label>
<div class="layui-input-block" style="display: flex; align-items: center;">
<div style="flex: 1; margin-right: 10px;">
<input type="text" id="startTime" class="layui-input" placeholder="开始时间" value="${popupData.startTime || ''}">
</div>
<div style="margin: 0 5px;">-</div>
<div style="flex: 1; margin-left: 10px;">
<input type="text" id="endTime" class="layui-input" placeholder="结束时间" value="${popupData.endTime || ''}">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block" style="text-align: center; margin-top: 20px;">
<button class="layui-btn" id="savePopup">保存</button>
<button class="layui-btn layui-btn-primary" id="cancelPopup">取消</button>
</div>
</div>
</div>
`,
success: function(layero, index) {
// 初始化日期选择器
layui.laydate.render({
elem: '#startTime',
type: 'date', // 只选择日期
format: 'yyyy-MM-dd', // 格式化为年月日
value: popupData.startTime || ''
});
layui.laydate.render({
elem: '#endTime',
type: 'date', // 只选择日期
format: 'yyyy-MM-dd', // 格式化为年月日
value: popupData.endTime || ''
});
// 保存按钮事件
$('#savePopup').on('click', function() {
var popupContent = $('#popupContent').val();
var startTime = $('#startTime').val();
var endTime = $('#endTime').val();
if (!popupContent) {
layer.msg('请填写弹窗内容');
return;
}
if (!startTime || !endTime) {
layer.msg('请选择弹窗期限');
return;
}
$.ajax({
url: ctx + '/messageInfo/updateIspopupMessageInfo.do',
type: 'post',
datatype: 'json',
data: {
guid: guid,
ispopup: true,
popupContent: popupContent,
startTime: startTime,
endTime: endTime,
tkId:popupData.id
},
xhrFields: { withCredentials: true },
success: function(res) {
if(res.success) {
layer.close(index);
layerMessage(res.msg);
} else {
checkbox.checked = false;
layui.form.render('checkbox');
error(res);
}
}
});
});
// 取消按钮事件
$('#cancelPopup').on('click', function() {
checkbox.checked = false;
layui.form.render('checkbox');
layer.close(index);
});
},
cancel: function() {
// 关闭弹窗时恢复原始状态
checkbox.checked = false;
layui.form.render('checkbox');
}
});
});
}
//是否假删除
layui.form.on('switch(isdel)', function(data) {
$.ajax({

@ -41,20 +41,10 @@ $(function() {
$("#isSubscribe").val(json.isSubscribe);
Promise.all([
getAppointmentTypes(),
getVisitLocations()
loadAppointmentTypes(json.bookingCategory),
loadVisitLocations(json.visitTypes)
]).then(function() {
// 设置选中状态
if(json.bookingCategory) {
$('input[name="bookingCategory"][value="'+json.bookingCategory+'"]').prop('checked', true);
}
if(json.visitTypes) {
var locations = json.visitTypes.split(',');
locations.forEach(function(loc) {
$('input[name="visitTypes"][value="'+loc+'"]').prop('checked', true);
});
}
// 重新渲染表单
layui.form.render();
})
@ -259,6 +249,71 @@ $(function() {
})
}
})
// 修改后的加载预约类型函数
function loadAppointmentTypes(selectedValue) {
return new Promise(function(resolve, reject) {
$.ajax({
url: ctx + "/appointmentSetting/selectDicByPid?dicpcode=57",
type: "GET",
dataType: "json",
success: function(res) {
if(res.success && res.data) {
var container = $('#appointmentTypeContainer');
container.empty();
res.data.forEach(function(item) {
var checked = (selectedValue && selectedValue === item.dicnum) ? 'checked' : '';
container.append(
'<input type="radio" name="bookingCategory" value="' + item.dicnum + '" title="' + item.dicname + '" ' + checked + ' lay-filter="bookingCategory">'
);
});
resolve();
} else {
reject('获取预约类型失败');
}
},
error: function() {
reject('获取预约类型失败');
}
});
});
}
// 修改后的加载参观地点函数
function loadVisitLocations(selectedValues) {
return new Promise(function(resolve, reject) {
$.ajax({
url: ctx + "/appointmentSetting/selectDicByPid?dicpcode=58",
type: "GET",
dataType: "json",
success: function(res) {
if(res.success && res.data) {
var container = $('#visitLocationsContainer');
container.empty();
// 将选中的值转为数组
var selectedArray = selectedValues ? selectedValues.split(',') : [];
res.data.forEach(function(item) {
var checked = selectedArray.includes(item.dicnum) ? 'checked' : '';
container.append(
'<input type="checkbox" name="visitTypes" value="' + item.dicnum + '" title="' + item.dicname + '" ' + checked + ' lay-skin="primary">'
);
});
resolve();
} else {
reject('获取参观地点失败');
}
},
error: function() {
reject('获取参观地点失败');
}
});
});
}
function jingqu(){
$.ajax({
type: "post",

@ -55,6 +55,16 @@
<input type="text" class="layui-input" id="reservationEndDate" placeholder=预约结束时间>
</div>
</div>
<div class="layui-block">
<label class="layui-form-label">参观地点</label>
<div class="layui-input-block" style="width: 200px;">
<select id="modifyAppointmentSlot" name="visitTypes" lay-verify="required " multiple>
<option value="">加载中...</option>
</select>
<div class="selected-items"></div>
<div class="dropdown-options"></div>
</div>
</div>
<div class="layui-block">
<button class="layui-btn layui-btn-sm layuiadmin-btn-forum-list" id="search" type="button" data-type="reload">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
@ -130,6 +140,7 @@
//搜索
var $ = layui.$, active = {
reload : function() {
var selected = $('#modifyAppointmentSlot').val()
table.reload('tableId', {
page : {curr : 1},
where : {
@ -137,6 +148,7 @@
reservationPersonName : $('#reservationPersonName').val(),
reservationPersonPhone : $('#reservationPersonPhone').val(),
state: $('#state').val(),
visitTypes:selected.join(','),
reservationStartDate:$('#reservationStartDate').val(),
reservationEndDate:$('#reservationEndDate').val(),
@ -159,6 +171,7 @@
$("#state").val("");
$("#reservationStartDate").val("");
$("#reservationEndDate").val("");
$('#modifyAppointmentSlot').val("");
form.render('select');
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
@ -169,6 +182,7 @@
reservationPersonName : $('#reservationPersonName').val(),
reservationPersonPhone : $('#reservationPersonPhone').val(),
state: $('#state').val(),
visitTypes:$('#modifyAppointmentSlot').val(),
reservationDate:$('#reservationDate').val(),
reservationStartDate:$('#reservationStartDate').val(),
reservationEndDate:$('#reservationEndDate').val(),
@ -255,6 +269,7 @@
reservationPersonPhone : "",
state: "",
reservationDate:"",
visitTypes:"",
}
});
table.refresh('tableId');
@ -268,6 +283,7 @@
reservationPersonPhone : "",
state: "",
reservationDate:"",
visitTypes:"",
}
});
}
@ -344,5 +360,45 @@
};
downloadFile(temp)
});
// 在页面加载完成后调用
$(document).ready(function() {
getVisitLocations(); // 原有的获取参观地点方法
// 其他初始化代码...
});
// 获取参观地点数据
function getVisitLocations() {
$.ajax({
url: ctx + "/appointmentSetting/selectDicByPid?dicpcode=58", // 替换为你的实际接口地址
type: "GET",
dataType: "json",
success: function(res) {
if (res.success && res.data) {
renderTimeSlots(res.data);
} else {
layer.msg('获取参观地点失败', {icon: 2});
}
},
error: function() {
layer.msg('获取参观地点失败', {icon: 2});
}
});
}
// 渲染预约时段下拉框
function renderTimeSlots(slots) {
var $select = $('#modifyAppointmentSlot');
$select.empty(); // 清空现有选项
// 添加默认选项
$select.append('<option value="">全部</option>');
// 添加动态选项
slots.forEach(function(slot) {
$select.append(`<option value="${slot.dicnum}">${slot.dicname}</option>`);
});
// 重新渲染Layui表单
layui.form.render('select');
}
</script>
</html>

@ -6,7 +6,6 @@
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<link rel="stylesheet" href="/html/common/layui/css/layui.css">
<link rel="stylesheet" href="/html/common/css/style.css">
</head>
@ -55,6 +54,16 @@
<input type="text" class="layui-input" id="reservationEndDate" placeholder=预约结束时间>
</div>
</div>
<div class="layui-block">
<label class="layui-form-label">参观地点</label>
<div class="layui-input-block" style="width: 200px;">
<select id="modifyAppointmentSlot" name="visitTypes" lay-verify="required " multiple>
<option value="">加载中...</option>
</select>
<div class="selected-items"></div>
<div class="dropdown-options"></div>
</div>
</div>
<div class="layui-block">
<button class="layui-btn layui-btn-sm layuiadmin-btn-forum-list" id="search" type="button" data-type="reload">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
@ -80,7 +89,7 @@
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="speak"><i class="layui-icon layui-icon-edit"></i>详情</a>
{{# if(d.state== 0){ }}
x
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="cancel">取消预约</a>
{{# } }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除记录</a>
@ -131,6 +140,7 @@
//搜索
var $ = layui.$, active = {
reload : function() {
var selected = $('#modifyAppointmentSlot').val()
table.reload('tableId', {
page : {curr : 1},
where : {
@ -138,6 +148,7 @@
reservationPersonName : $('#reservationPersonName').val(),
reservationPersonPhone : $('#reservationPersonPhone').val(),
state: $('#state').val(),
visitTypes:selected.join(','),
reservationStartDate:$('#reservationStartDate').val(),
reservationEndDate:$('#reservationEndDate').val(),
@ -158,6 +169,7 @@
$("#reservationPersonName").val("");
$("#reservationPersonPhone").val("");
$("#state").val("");
$('#modifyAppointmentSlot').val("");
$("#reservationStartDate").val("");
$("#reservationEndDate").val("");
form.render('select');
@ -170,6 +182,7 @@
reservationPersonName : $('#reservationPersonName').val(),
reservationPersonPhone : $('#reservationPersonPhone').val(),
state: $('#state').val(),
visitTypes:$('#modifyAppointmentSlot').val(),
reservationDate:$('#reservationDate').val(),
reservationStartDate:$('#reservationStartDate').val(),
reservationEndDate:$('#reservationEndDate').val(),
@ -257,6 +270,7 @@
reservationPersonName : "",
reservationPersonPhone : "",
state: "",
visitTypes:"",
reservationDate:"",
}
});
@ -270,6 +284,7 @@
reservationPersonName : "",
reservationPersonPhone : "",
state: "",
visitTypes:"",
reservationDate:"",
}
});
@ -342,10 +357,68 @@
reservationPersonName : $('#reservationPersonName').val(),
reservationPersonPhone : $('#reservationPersonPhone').val(),
state: $('#state').val(),
visitTypes:$('#modifyAppointmentSlot').val(),
reservationStartDate:$("#reservationStartDate").val(),
reservationEndDate: $("#reservationEndDate").val()
};
downloadFile(temp)
});
// 在页面加载完成后调用
$(document).ready(function() {
getVisitLocations(); // 原有的获取参观地点方法
// 其他初始化代码...
});
// 获取参观地点数据
function getVisitLocations() {
$.ajax({
url: ctx + "/appointmentSetting/selectDicByPid?dicpcode=58", // 替换为你的实际接口地址
type: "GET",
dataType: "json",
success: function(res) {
if (res.success && res.data) {
renderTimeSlots(res.data);
} else {
layer.msg('获取参观地点失败', {icon: 2});
}
},
error: function() {
layer.msg('获取参观地点失败', {icon: 2});
}
});
}
// 渲染预约时段下拉框
function renderTimeSlots(slots) {
var $select = $('#modifyAppointmentSlot');
$select.empty(); // 清空现有选项
// 添加默认选项
$select.append('<option value="">全部</option>');
// 添加动态选项
slots.forEach(function(slot) {
$select.append(`<option value="${slot.dicnum}">${slot.dicname}</option>`);
});
// 重新渲染Layui表单
layui.form.render('select');
}
</script>
<style>
.cjy-multiselect {
position: relative;
border: 1px solid #e6e6e6;
padding: 5px;
min-height: 38px;
}
.dropdown-options {
display: none;
position: absolute;
background: #fff;
z-index: 999;
width: 100%;
max-height: 200px;
overflow-y: auto;
}
</style>
</html>

@ -55,6 +55,16 @@
<input type="text" class="layui-input" id="reservationEndDate" placeholder=预约结束时间>
</div>
</div>
<div class="layui-block">
<label class="layui-form-label">参观地点</label>
<div class="layui-input-block" style="width: 200px;">
<select id="modifyAppointmentSlot" name="visitTypes" lay-verify="required " multiple>
<option value="">加载中...</option>
</select>
<div class="selected-items"></div>
<div class="dropdown-options"></div>
</div>
</div>
<div class="layui-block">
<button class="layui-btn layui-btn-sm layuiadmin-btn-forum-list" id="search" type="button" data-type="reload">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
@ -80,7 +90,7 @@
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="speak"><i class="layui-icon layui-icon-edit"></i>详情</a>
{{# if(d.state== 0){ }}
{{# if(d.state== 0 || d.state == 4){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="cancel">取消预约</a>
{{# } }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除记录</a>
@ -131,6 +141,7 @@
//搜索
var $ = layui.$, active = {
reload : function() {
var selected = $('#modifyAppointmentSlot').val()
table.reload('tableId', {
page : {curr : 1},
where : {
@ -138,6 +149,7 @@
reservationPersonName : $('#reservationPersonName').val(),
reservationPersonPhone : $('#reservationPersonPhone').val(),
state: $('#state').val(),
visitTypes:selected.join(','),
reservationStartDate:$('#reservationStartDate').val(),
reservationEndDate:$('#reservationEndDate').val(),
@ -160,6 +172,7 @@
$("#state").val("");
$("#reservationStartDate").val("");
$("#reservationEndDate").val("");
$('#modifyAppointmentSlot').val(""),
form.render('select');
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
@ -171,6 +184,7 @@
reservationPersonPhone : $('#reservationPersonPhone').val(),
state: $('#state').val(),
reservationDate:$('#reservationDate').val(),
visitTypes:$('#modifyAppointmentSlot').val(),
reservationStartDate:$('#reservationStartDate').val(),
reservationEndDate:$('#reservationEndDate').val(),
}
@ -257,6 +271,7 @@
reservationPersonName : "",
reservationPersonPhone : "",
state: "",
visitTypes:"",
reservationDate:"",
}
});
@ -270,6 +285,7 @@
reservationPersonName : "",
reservationPersonPhone : "",
state: "",
visitTypes:"",
reservationDate:"",
}
});
@ -347,5 +363,45 @@
};
downloadFile(temp)
});
// 在页面加载完成后调用
$(document).ready(function() {
getVisitLocations(); // 原有的获取参观地点方法
// 其他初始化代码...
});
// 获取参观地点数据
function getVisitLocations() {
$.ajax({
url: ctx + "/appointmentSetting/selectDicByPid?dicpcode=58", // 替换为你的实际接口地址
type: "GET",
dataType: "json",
success: function(res) {
if (res.success && res.data) {
renderTimeSlots(res.data);
} else {
layer.msg('获取参观地点失败', {icon: 2});
}
},
error: function() {
layer.msg('获取参观地点失败', {icon: 2});
}
});
}
// 渲染预约时段下拉框
function renderTimeSlots(slots) {
var $select = $('#modifyAppointmentSlot');
$select.empty(); // 清空现有选项
// 添加默认选项
$select.append('<option value="">全部</option>');
// 添加动态选项
slots.forEach(function(slot) {
$select.append(`<option value="${slot.dicnum}">${slot.dicname}</option>`);
});
// 重新渲染Layui表单
layui.form.render('select');
}
</script>
</html>

Loading…
Cancel
Save