l
chenfeng 7 months ago
parent ac643fa753
commit a3c7713d8b
  1. 8
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentRecordMapper.java
  2. 153
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentRecordMapper.xml
  3. 27
      src/main/java/com/cjy/back/ybsjAppointment/service/impl/YbsjyAppointmentRecordImpl.java
  4. 52
      src/main/java/com/cjy/back/ybsjMessageInfo/controller/YbsjMessageInfoController.java
  5. 8
      src/main/webapp/html/back/yuyueList/reservationRecord_commont.html
  6. 10
      src/main/webapp/html/back/yuyueList/reservationRecord_commontTwo.html

@ -199,9 +199,15 @@ public interface YbsjyAppointmentRecordMapper {
//查询预约设置时间段
List<Map<String, Object>> getTimeInfo(@Param("timeInfoId") Integer timeInfoId);
//预约统计
//预约统计-预约总数和核销总数
List<Map<String, Object>> selectStatistics(@Param("getAppointmentRecordVO") GetAppointmentRecordVO getAppointmentRecordVO);
//预约统计-取消总数
List<Map<String, Object>> selectStatisticsQx(@Param("getAppointmentRecordVO") GetAppointmentRecordVO getAppointmentRecordVO);
//预约统计- 过期总数
List<Map<String, Object>> selectStatisticsGq(@Param("getAppointmentRecordVO") GetAppointmentRecordVO getAppointmentRecordVO);
//查询弹框内容
Map<String, Object> selectPop();
}

@ -426,27 +426,160 @@
<select id="selectStatistics" resultType="map">
SELECT
( SELECT GROUP_CONCAT( cnm.dicname ) FROM sys_dictionary cnm WHERE FIND_IN_SET( cnm.dicnum, b.visit_types ) AND dicpcode = 58 ) visitingPlace,
SUM( CASE WHEN write_off = 0 THEN 1 ELSE 0 END ) AS unverified,
SUM( CASE WHEN write_off = 1 THEN 1 ELSE 0 END ) AS verified,
SUM( CASE WHEN write_off = 3 THEN 1 ELSE 0 END ) AS cancel,
SUM( CASE WHEN expired_state = 1 THEN 1 ELSE 0 END ) AS hasExpired,
COUNT( * ) AS altogether
visitingPlace,
SUM( altogether ) AS altogether, -- 预约总数
SUM( verified_personal + verified_team ) AS verified -- 核销总数
FROM
ybsj_appointment_people_info a
LEFT JOIN ybsj_appointment_documents_info b ON a.appointment_documents_id = b.id
WHERE
1 = 1
(
SELECT
( SELECT GROUP_CONCAT( cnm.dicname ) FROM sys_dictionary cnm WHERE FIND_IN_SET( cnm.dicnum, a.visit_types ) AND dicpcode = 58 ) AS visitingPlace,-- 总预约数
a.appointment_count AS altogether,-- 团队核销数
CASE
WHEN a.appointment_documents_write_off = 1
AND a.appointment_type_id != 5701 THEN
a.appointment_count ELSE 0
END AS verified_team,-- 个人核销数
CASE
WHEN a.appointment_type_id = 5701 THEN
( SELECT COUNT( b.id ) FROM ybsj_appointment_people_info b WHERE b.appointment_documents_id = a.id AND b.write_off = 1 ) ELSE 0
END AS verified_personal
FROM
ybsj_appointment_documents_info a
where 1 = 1
and a.del_flag = 0
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''">
and a.appointment_date &gt;= #{getAppointmentRecordVO.reservationStartDate}
</if>
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''">
and a.appointment_date &lt;= #{getAppointmentRecordVO.reservationEndDate}
</if>
) base
GROUP BY
visitingPlace
</select>
<select id="selectStatisticsQx" resultType="map">
SELECT
visitingPlace,
SUM(cancel) AS cancel
FROM (
-- 第一个查询
SELECT
SUM(a.appointment_count) AS cancel,
(
SELECT GROUP_CONCAT(cnm.dicname)
FROM sys_dictionary cnm
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58
) AS visitingPlace
FROM
ybsj_appointment_documents_info a
WHERE
a.appointment_documents_write_off = 3
AND a.appointment_type_id != 5701
and a.del_flag = 0
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''">
and a.appointment_date &gt;= #{getAppointmentRecordVO.reservationStartDate}
</if>
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''">
and a.appointment_date &lt;= #{getAppointmentRecordVO.reservationEndDate}
</if>
GROUP BY
(
SELECT GROUP_CONCAT(cnm.dicname)
FROM sys_dictionary cnm
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58
)
UNION ALL
-- 第二个查询
SELECT
COUNT(b.id) AS cancel,
(
SELECT GROUP_CONCAT(cnm.dicname)
FROM sys_dictionary cnm
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58
) AS visitingPlace
FROM
ybsj_appointment_people_info b
LEFT JOIN ybsj_appointment_documents_info a ON a.id = b.appointment_documents_id
WHERE
b.write_off = 3
AND a.appointment_type_id = 5701
and a.del_flag = 0
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''">
and a.appointment_date &gt;= #{getAppointmentRecordVO.reservationStartDate}
</if>
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''">
and a.appointment_date &lt;= #{getAppointmentRecordVO.reservationEndDate}
</if>
GROUP BY
(
SELECT GROUP_CONCAT(cnm.dicname)
FROM sys_dictionary cnm
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58
)
) AS combined
GROUP BY
visitingPlace;
</select>
<select id="selectStatisticsGq" resultType="map">
SELECT
visitingPlace,
SUM(team_cancel + personal_cancel) AS hasExpired
FROM (
-- 团队/研学过期人数
SELECT
(SELECT GROUP_CONCAT(cnm.dicname)
FROM sys_dictionary cnm
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58) AS visitingPlace,
IFNULL(SUM(a.appointment_count), 0) AS team_cancel,
0 AS personal_cancel
FROM
ybsj_appointment_documents_info a
LEFT JOIN ybsj_appointment_people_info b ON a.id = b.appointment_documents_id AND b.expired_state = 1
WHERE
b.expired_state = 1
AND a.appointment_type_id != 5701
and a.del_flag = 0
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''">
and a.appointment_date &gt;= #{getAppointmentRecordVO.reservationStartDate}
</if>
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''">
and a.appointment_date &lt;= #{getAppointmentRecordVO.reservationEndDate}
</if>
GROUP BY visitingPlace
UNION ALL
-- 个人过期人数
SELECT
(SELECT GROUP_CONCAT(cnm.dicname)
FROM sys_dictionary cnm
WHERE FIND_IN_SET(cnm.dicnum, a.visit_types) AND dicpcode = 58) AS visitingPlace,
0 AS team_cancel,
COUNT(b.id) AS personal_cancel
FROM
ybsj_appointment_people_info b
LEFT JOIN ybsj_appointment_documents_info a ON a.id = b.appointment_documents_id
WHERE
b.expired_state = 1
AND a.appointment_type_id = 5701
and a.del_flag = 0
<if test="getAppointmentRecordVO.reservationStartDate !=null and getAppointmentRecordVO.reservationStartDate!=''">
and a.appointment_date &gt;= #{getAppointmentRecordVO.reservationStartDate}
</if>
<if test="getAppointmentRecordVO.reservationEndDate !=null and getAppointmentRecordVO.reservationEndDate!=''">
and a.appointment_date &lt;= #{getAppointmentRecordVO.reservationEndDate}
</if>
GROUP BY visitingPlace
) combined
GROUP BY visitingPlace;
</select>
<select id="selectPop" resultType="map">
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

@ -28,10 +28,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author liangjiawei
@ -51,6 +48,7 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
private String rule;
@Value("${jqzhgk.scjSynchronousWriteOffData}")
private String scjSynchronousWriteOffData;
/**
* 查询预约记录
*
@ -191,7 +189,7 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
List<SynchronousWriteOffDataVO> synchronousWriteOffDataVOS = new ArrayList<>();
//核销人ID
SynchronousWriteOffDataVO synchronousWriteOffDataVO = new SynchronousWriteOffDataVO();
//核销人ID
//核销类型
synchronousWriteOffDataVO.setBookingCategory(2);
synchronousWriteOffDataVO.setWriteOff("3");
synchronousWriteOffDataVO.setDocumentsId(appointmentDocumentsDetails.getId().toString());
@ -474,7 +472,24 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
@Override
public List<Map<String, Object>> selectStatistics(GetAppointmentRecordVO getAppointmentRecordVO) {
return ybsjyAppointmentRecordMapper.selectStatistics(getAppointmentRecordVO);
List<Map<String, Object>> selectStatistics = ybsjyAppointmentRecordMapper.selectStatistics(getAppointmentRecordVO);
List<Map<String, Object>> selectStatisticsQx = ybsjyAppointmentRecordMapper.selectStatisticsQx(getAppointmentRecordVO);
List<Map<String, Object>> selectStatisticsGq = ybsjyAppointmentRecordMapper.selectStatisticsGq(getAppointmentRecordVO);
for (Map<String, Object> map : selectStatistics) {
Optional<Map<String, Object>> objectMap = selectStatisticsQx.stream().filter(map1 -> map.get("visitingPlace").equals(map1.get("visitingPlace"))).findAny();
if (objectMap.isPresent()) {
map.put("cancel",Integer.parseInt(objectMap.get().get("cancel").toString()));
}else {
map.put("cancel",0);
}
Optional<Map<String, Object>> mapOptional = selectStatisticsGq.stream().filter(map1 -> map.get("visitingPlace").equals(map1.get("visitingPlace"))).findAny();
if (mapOptional.isPresent()) {
map.put("hasExpired",Integer.parseInt(mapOptional.get().get("hasExpired").toString()));
}else {
map.put("hasExpired",0);
}
}
return selectStatistics;
}
@Override

@ -33,10 +33,9 @@ public class YbsjMessageInfoController {
private final String appSecret = "bc11e97b8e00841053cfc7ba8497c876";
/**
*
* @Description: 消息类型列表
* @param type 消息类型
* @return
* @Description: 消息类型列表
* @author hpr
* @date 2019/10/30
*/
@ -46,10 +45,9 @@ public class YbsjMessageInfoController {
}
/**
*
* @Description: 修改排序
* @param request guid/sort
* @return
* @Description: 修改排序
* @author hpr
* @date 2019/10/30
*/
@ -59,10 +57,9 @@ public class YbsjMessageInfoController {
}
/**
*
* @Description: 修改是否推荐
* @param request 主键 是否推荐
* @return
* @Description: 修改是否推荐
* @author hpr
* @date 2019/10/30
*/
@ -72,10 +69,9 @@ public class YbsjMessageInfoController {
}
/**
*
* @Description: 修改是否弹框
* @param request 主键 是否弹框
* @return
* @Description: 修改是否弹框
* @author hpr
* @date 2019/10/30
*/
@ -86,6 +82,7 @@ public class YbsjMessageInfoController {
/**
* 查询弹框内容
*
* @param messageInfoId
* @return
*/
@ -96,10 +93,9 @@ public class YbsjMessageInfoController {
/**
*
* @Description: 修改假删除
* @param request 主键 是否推荐
* @return
* @Description: 修改假删除
* @author hpr
* @date 2019/11/4
*/
@ -109,10 +105,9 @@ public class YbsjMessageInfoController {
}
/**
*
* @Description: 查询信息详情
* @param request 主键
* @return
* @Description: 查询信息详情
* @author hpr
* @date 2019/10/30
*/
@ -122,10 +117,9 @@ public class YbsjMessageInfoController {
}
/**
*
* @Description: 查询附加字段的数据内容
* @param request 类型
* @return
* @Description: 查询附加字段的数据内容
* @author hpr
* @date 2019/10/30
*/
@ -135,10 +129,9 @@ public class YbsjMessageInfoController {
}
/**
*
* @Description: 修改信息
* @param messageInfo 信息实体
* @return
* @Description: 修改信息
* @author hpr
* @date 2019/10/30
*/
@ -148,10 +141,9 @@ public class YbsjMessageInfoController {
}
/**
*
* @Description: 新增信息
* @param messageInfo 信息实体
* @return
* @Description: 新增信息
* @author hpr
* @date 2019/11/1
*/
@ -162,10 +154,9 @@ public class YbsjMessageInfoController {
}
/**
*
* @Description: 删除信息
* @param guids 多主键
* @return
* @Description: 删除信息
* @author hpr
* @date 2019/11/1
*/
@ -191,15 +182,18 @@ public class YbsjMessageInfoController {
String processedContent = processContent(messageInfo.getContent(), accessToken);
System.out.println("处理后的内容:" + processedContent);
logger.warn("处理后的内容" + processedContent);
//下载logo图片上传到微信素材中心
File tempFile = downloadImage("https://www.lbgjtoa.com/" + messageInfo.getLogo());
JSONObject jsonObject = uploadToWeChat(accessToken, tempFile);
logger.warn("封面图上传素材中心返回数据" + jsonObject);
// 步骤2: 创建草稿
createDraft(accessToken, messageInfo.getTitle(), processedContent);
createDraft(accessToken, messageInfo.getTitle(), processedContent, jsonObject.getString("media_id"));
} catch (Exception e) {
logger.error("通知公告推送至微信公众号异常:{}", e);
}
}
public String getAccessToken(String appId, String appSecret) throws IOException {
try {
// 目标 URL
@ -236,8 +230,6 @@ public class YbsjMessageInfoController {
}
// 1. 下载网络图片(支持自动重试)
private static File downloadImage(String imageUrl) throws IOException, InterruptedException {
File tempFile = File.createTempFile("wx_", ".tmp"); // 先创建临时文件
@ -262,7 +254,7 @@ public class YbsjMessageInfoController {
}
// 2. 微信图片上传(修复41005错误)
private static String uploadToWeChat(String accessToken, File file) throws IOException {
private static JSONObject uploadToWeChat(String accessToken, File file) throws IOException {
String newName = "";
// 1. 验证文件类型
String fileName = file.getName().toLowerCase();
@ -328,7 +320,7 @@ public class YbsjMessageInfoController {
reader.close();
JSONObject result = new JSONObject(response.toString());
return result.getString("url");
return result;
} else {
throw new IOException("Server returned non-OK status: " + responseCode);
}
@ -349,8 +341,8 @@ public class YbsjMessageInfoController {
while (matcher.find()) {
String imgUrl = matcher.group(1);
File tempFile = downloadImage(imgUrl);
String wechatUrl = uploadToWeChat(accessToken, tempFile);
matcher.appendReplacement(result, "<img src='" + wechatUrl + "'/>");
JSONObject wechatUrl = uploadToWeChat(accessToken, tempFile);
matcher.appendReplacement(result, "<img src='" + wechatUrl.getString("url") + "'/>");
tempFile.delete();
}
matcher.appendTail(result);
@ -358,13 +350,13 @@ public class YbsjMessageInfoController {
}
// 4. 创建草稿
private static void createDraft(String accessToken, String title, String content) throws IOException {
private static void createDraft(String accessToken, String title, String content, String mediaId) 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("thumb_media_id", mediaId)
.put("show_cover_pic", 1);
JSONArray articles = new JSONArray().put(article);
String requestBody = new JSONObject().put("articles", articles).toString();

@ -474,14 +474,6 @@
min: 0,
value: currentDate,
trigger: 'click',
// ✅ 方法 2:如果仍然无效,改用 done 回调手动拦截
done: function(value, date) {
if (value === currentDate) {
layer.msg("不能选择原预约日期!");
$('#modifyAppointmentDate').val(''); // 清空选择
return false;
}
}
});
}, 100);

@ -484,11 +484,11 @@
trigger: 'click',
// ✅ 方法 2:如果仍然无效,改用 done 回调手动拦截
done: function(value, date) {
if (value === currentDate) {
layer.msg("不能选择原预约日期!");
$('#modifyAppointmentDate').val(''); // 清空选择
return false;
}
// if (value === currentDate) {
// layer.msg("不能选择原预约日期!");
// $('#modifyAppointmentDate').val(''); // 清空选择
// return false;
// }
}
});
}, 100);

Loading…
Cancel
Save