Merge pull request '4' (#12) from cqq into develop

develop
prxhap34i 1 month ago
commit be4b589164

@ -1,6 +1,6 @@
package com.controller;
// 导入处理文件操作的类
ppackage com.controller;
import java.io.File;
// 导入用于高精度十进制计算的类
import java.math.BigDecimal;
@ -415,4 +415,5 @@ public class ChatController {
return R.error(511,"查不到数据");
}
}
}
/**

@ -35,13 +35,13 @@ import com.utils.BaiduUtil;
import com.utils.FileUtil;
import com.utils.R;
/**
*
*/
@RestController
public class CommonController{
private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
// 注入CommonService处理通用业务逻辑
@Autowired
private CommonService commonService;
@ -53,14 +53,18 @@ public class CommonController{
private static String BAIDU_DITU_AK = null;
@RequestMapping("/location")
public R location(String lng,String lat) {
if(BAIDU_DITU_AK==null) {
public R location(String lng, String lat) {
// 如果BAIDU_DITU_AK为空从配置中获取
if (BAIDU_DITU_AK == null) {
BAIDU_DITU_AK = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue();
if(BAIDU_DITU_AK==null) {
// 如果配置中未正确配置,返回错误信息
if (BAIDU_DITU_AK == null) {
return R.error("请在配置管理中正确配置baidu_ditu_ak");
}
}
// 调用百度工具类获取城市信息
Map<String, String> map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat);
// 返回包含城市信息的结果对象
return R.ok().put("data", map);
}
@ -68,102 +72,132 @@ public class CommonController{
*
* @param face1 1
* @param face2 2
* @return
* @param request HttpServletRequest
* @return
*/
@RequestMapping("/matchFace")
public R matchFace(String face1, String face2, HttpServletRequest request) {
if(client==null) {
/*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/
// 如果客户端未初始化,进行初始化
if (client == null) {
// 获取APIKey和SecretKey
String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
// 获取访问令牌
String token = BaiduUtil.getAuth(APIKey, SecretKey);
if(token==null) {
// 如果令牌获取失败,返回错误信息
if (token == null) {
return R.error("请在配置管理中正确配置APIKey和SecretKey");
}
// 初始化AipFace客户端
client = new AipFace(null, APIKey, SecretKey);
// 设置连接超时时间
client.setConnectionTimeoutInMillis(2000);
// 设置套接字超时时间
client.setSocketTimeoutInMillis(60000);
}
JSONObject res = null;
try {
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2);
// 获取人脸图片文件
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + face2);
// 将文件转换为Base64编码的字符串
String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
// 创建MatchRequest对象
MatchRequest req1 = new MatchRequest(img1, "BASE64");
MatchRequest req2 = new MatchRequest(img2, "BASE64");
// 创建请求列表
ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
requests.add(req1);
requests.add(req2);
// 进行人脸比对
res = client.match(requests);
// 打印比对结果
System.out.println(res.get("result"));
} catch (FileNotFoundException e) {
// 处理文件未找到异常
e.printStackTrace();
return R.error("文件不存在");
} catch (IOException e) {
// 处理IO异常
e.printStackTrace();
}
return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
}
/**
* tablecolumn()
* @return
* @param tableName
* @param columnName
* @param level
* @param parent
* @return
*/
@RequestMapping("/option/{tableName}/{columnName}")
@IgnoreAuth
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, String level, String parent) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
if(StringUtils.isNotBlank(level)) {
// 如果层级不为空添加到参数Map中
if (StringUtils.isNotBlank(level)) {
params.put("level", level);
}
if(StringUtils.isNotBlank(parent)) {
// 如果父级不为空添加到参数Map中
if (StringUtils.isNotBlank(parent)) {
params.put("parent", parent);
}
// 调用CommonService获取列列表
List<String> data = commonService.getOption(params);
// 返回包含列列表的结果对象
return R.ok().put("data", data);
}
/**
* tablecolumn
* @return
* @param tableName
* @param columnName
* @param columnValue
* @return
*/
@RequestMapping("/follow/{tableName}/{columnName}")
@IgnoreAuth
public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
params.put("columnValue", columnValue);
// 调用CommonService获取单条记录
Map<String, Object> result = commonService.getFollowByOption(params);
// 返回包含单条记录的结果对象
return R.ok().put("data", result);
}
/**
* tablesfsh
* @param map
* @return
* @param tableName
* @param map Map
* @return
*/
@RequestMapping("/sh/{tableName}")
public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
// 将表名添加到参数Map中
map.put("table", tableName);
// 调用CommonService进行状态修改
commonService.sh(map);
// 返回操作成功结果
return R.ok();
}
/**
*
* @param tableName
* @param columnName
* @param type 1: 2:
* @param map
* @return
* @param tableName
* @param columnName
* @param type 1: 2:
* @param map Map
* @return
*/
@RequestMapping("/remind/{tableName}/{columnName}/{type}")
@IgnoreAuth
@ -175,104 +209,130 @@ public class CommonController{
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 获取当前日期
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
// 如果提醒开始日期不为空
if (map.get("remindstart") != null) {
// 解析提醒开始日期偏移量
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
// 将提醒开始日期格式化后添加到参数Map中
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
// 如果提醒结束日期不为空
if (map.get("remindend") != null) {
// 解析提醒结束日期偏移量
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
// 设置日期
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
// 计算提醒结束日期
c.add(Calendar.DAY_OF_MONTH, remindEnd);
remindEndDate = c.getTime();
// 将提醒结束日期格式化后添加到参数Map中
map.put("remindend", sdf.format(remindEndDate));
}
}
int count = commonService.remindCount(map);
// 返回包含提醒记录数的结果对象
return R.ok().put("count", count);
}
/**
*
* @param tableName
* @param params Map
* @return
*/
@IgnoreAuth
@RequestMapping("/group/{tableName}")
public R group1(@PathVariable("tableName") String tableName, @RequestParam Map<String,Object> params) {
public R group1(@PathVariable("tableName") String tableName, @RequestParam Map<String, Object> params) {
// 将表名添加到参数Map中
params.put("table1", tableName);
// 调用CommonService进行图表统计
List<Map<String, Object>> result = commonService.chartBoth(params);
// 返回包含统计结果的结果对象
return R.ok().put("data", result);
}
/**
*
* @param tableName
* @param columnName
* @return
*/
@RequestMapping("/cal/{tableName}/{columnName}")
@IgnoreAuth
public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
// 调用CommonService进行单列求和
Map<String, Object> result = commonService.selectCal(params);
// 返回包含求和结果的结果对象
return R.ok().put("data", result);
}
/**
*
* @param tableName
* @param columnName
* @return
*/
@RequestMapping("/group/{tableName}/{columnName}")
@IgnoreAuth
public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
// 调用CommonService进行分组统计
List<Map<String, Object>> result = commonService.selectGroup(params);
// 返回包含分组统计结果的结果对象
return R.ok().put("data", result);
}
/**
*
* @param tableName
* @param yColumnName y
* @param xColumnName x
* @return
*/
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
@IgnoreAuth
public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
// 调用CommonService进行按值统计
List<Map<String, Object>> result = commonService.selectValue(params);
// 返回包含按值统计结果的结果对象
return R.ok().put("data", result);
}
/**
*
* tableName
* groupColumn
* sumCloum
* @return
* @param params Map
* @return
*/
@RequestMapping("/newSelectGroupSum")
public R newSelectGroupSum(@RequestParam Map<String,Object> params) {
logger.debug("newSelectGroupSum:,,Controller:{},,params:{}",this.getClass().getName(),params);
public R newSelectGroupSum(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectGroupSum:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 调用CommonService进行字典表分组求和
List<Map<String, Object>> result = commonService.newSelectGroupSum(params);
// 返回包含分组求和结果的结果对象
return R.ok().put("data", result);
}
/**
tableName
condition1 1
@ -290,110 +350,76 @@ public class CommonController{
return R.ok().put("data", queryScore);
}
/**
*
* tableName
* groupColumn
* @return
* @param params Map
* @return
*/
@RequestMapping("/newSelectGroupCount")
public R newSelectGroupCount(@RequestParam Map<String,Object> params) {
logger.debug("newSelectGroupCount:,,Controller:{},,params:{}",this.getClass().getName(),params);
public R newSelectGroupCount(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectGroupCount:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 调用CommonService进行字典表分组统计总条数
List<Map<String, Object>> result = commonService.newSelectGroupCount(params);
// 返回包含分组统计总条数结果的结果对象
return R.ok().put("data", result);
}
/**
*
* tableName
* groupColumn
* sumCloum
* dateFormatType 1: 2: 3:
* @return
* @param params Map
* @return
*/
@RequestMapping("/newSelectDateGroupSum")
public R newSelectDateGroupSum(@RequestParam Map<String,Object> params) {
logger.debug("newSelectDateGroupSum:,,Controller:{},,params:{}",this.getClass().getName(),params);
public R newSelectDateGroupSum(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectDateGroupSum:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 获取日期格式化类型
String dateFormatType = String.valueOf(params.get("dateFormatType"));
if("1".equals(dateFormatType)){
// 根据日期格式化类型设置日期格式
if ("1".equals(dateFormatType)) {
params.put("dateFormat", "%Y");
}else if("2".equals(dateFormatType)){
} else if ("2".equals(dateFormatType)) {
params.put("dateFormat", "%Y-%m");
}else if("3".equals(dateFormatType)){
} else if ("3".equals(dateFormatType)) {
params.put("dateFormat", "%Y-%m-%d");
}else{
R.error("日期格式化不正确");
} else {
// 日期格式化类型不正确,返回错误信息
return R.error("日期格式化不正确");
}
// 调用CommonService进行日期分组求和
List<Map<String, Object>> result = commonService.newSelectDateGroupSum(params);
// 返回包含日期分组求和结果的结果对象
return R.ok().put("data", result);
}
/**
* 1
* tableName
* groupColumn
* dateFormatType 1: 2: 3:
* @return
*
* @param params Map
* @return
*/
@RequestMapping("/newSelectDateGroupCount")
public R newSelectDateGroupCount(@RequestParam Map<String,Object> params) {
logger.debug("newSelectDateGroupCount:,,Controller:{},,params:{}",this.getClass().getName(),params);
public R newSelectDateGroupCount(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectDateGroupCount:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 获取日期格式化类型
String dateFormatType = String.valueOf(params.get("dateFormatType"));
if("1".equals(dateFormatType)){
// 根据日期格式化类型设置日期格式
if ("1".equals(dateFormatType)) {
params.put("dateFormat", "%Y");
}else if("2".equals(dateFormatType)){
} else if ("2".equals(dateFormatType)) {
params.put("dateFormat", "%Y-%m");
}else if("3".equals(dateFormatType)){
} else if ("3".equals(dateFormatType)) {
params.put("dateFormat", "%Y-%m-%d");
}else{
R.error("日期格式化类型不正确");
} else {
// 日期格式化类型不正确,返回错误信息
return R.error("日期格式化类型不正确");
}
// 调用CommonService进行日期分组统计总条数
List<Map<String, Object>> result = commonService.newSelectDateGroupCount(params);
// 返回包含日期分组统计总条数结果的结果对象
return R.ok().put("data", result);
}
/**
*
* --
--
-- --
-- --
--
-- --
-- --
--
-- --
-- --
--
--
-- --
-- --
--
-- --
-- --
--
-- --
-- --
*/
/**
*
--
--
-- 2 1
--
--
--
--
--
--
--
--
--
--
*/
/**
*
@ -418,121 +444,131 @@ public class CommonController{
isJoinTableFlag = true;
}
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期
thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));
// 处理当前表日期
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))) {
thisTable.put("date", String.valueOf(thisTable.get("date")).split(","));
one = "thisDate0";
}
if(isJoinTableFlag){//级联表日期
// 处理级联表日期
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){
joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinDate0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinDate0";
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))) {
joinTable.put("date", String.valueOf(joinTable.get("date")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinDate0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinDate0";
}
}
}
}
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串
thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));
if(StringUtil.isEmpty(one)){
one ="thisString0";
}else{
if(StringUtil.isEmpty(two)){
two ="thisString0";
// 处理当前表字符串
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))) {
thisTable.put("string", String.valueOf(thisTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) {
one = "thisString0";
} else {
if (StringUtil.isEmpty(two)) {
two = "thisString0";
}
}
}
if(isJoinTableFlag){//级联表字符串
// 处理级联表字符串
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){
joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinString0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinString0";
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))) {
joinTable.put("string", String.valueOf(joinTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinString0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinString0";
}
}
}
}
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型
thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));
if(StringUtil.isEmpty(one)){
one ="thisTypes0";
}else{
if(StringUtil.isEmpty(two)){
two ="thisTypes0";
// 处理当前表类型
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))) {
thisTable.put("types", String.valueOf(thisTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) {
one = "thisTypes0";
} else {
if (StringUtil.isEmpty(two)) {
two = "thisTypes0";
}
}
}
if(isJoinTableFlag){//级联表类型
// 处理级联表类型
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){
joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinTypes0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinTypes0";
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))) {
joinTable.put("types", String.valueOf(joinTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinTypes0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinTypes0";
}
}
}
}
// 调用CommonService进行柱状图求和
List<Map<String, Object>> result = commonService.barSum(params);
List<String> xAxis = new ArrayList<>();//报表x轴
List<List<String>> yAxis = new ArrayList<>();//y轴
List<String> legend = new ArrayList<>();//标题
// 报表x轴
List<String> xAxis = new ArrayList<>();
// y轴
List<List<String>> yAxis = new ArrayList<>();
// 标题
List<String> legend = new ArrayList<>();
if(StringUtil.isEmpty(two)){//不包含第二列
// 如果不包含第二列
if (StringUtil.isEmpty(two)) {
List<String> yAxis0 = new ArrayList<>();
yAxis.add(yAxis0);
legend.add("数值");
for(Map<String, Object> map :result){
for (Map<String, Object> map : result) {
String oneValue = String.valueOf(map.get(one));
String value = String.valueOf(map.get("value"));
xAxis.add(oneValue);
yAxis0.add(value);
}
}else{//包含第二列
} else {
// 包含第二列
Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
if(StringUtil.isNotEmpty(two)){
for(Map<String, Object> map :result){
if (StringUtil.isNotEmpty(two)) {
for (Map<String, Object> map : result) {
String oneValue = String.valueOf(map.get(one));
String twoValue = String.valueOf(map.get(two));
String value = String.valueOf(map.get("value"));
if(!legend.contains(twoValue)){
legend.add(twoValue);//添加完成后 就是最全的第二列的类型
if (!legend.contains(twoValue)) {
legend.add(twoValue);
}
if(dataMap.containsKey(oneValue)){
dataMap.get(oneValue).put(twoValue,value);
}else{
if (dataMap.containsKey(oneValue)) {
dataMap.get(oneValue).put(twoValue, value);
} else {
HashMap<String, String> oneData = new HashMap<>();
oneData.put(twoValue,value);
dataMap.put(oneValue,oneData);
oneData.put(twoValue, value);
dataMap.put(oneValue, oneData);
}
}
}
for(int i =0; i<legend.size(); i++){
for (int i = 0; i < legend.size(); i++) {
yAxis.add(new ArrayList<String>());
}
Set<String> keys = dataMap.keySet();
for(String key:keys){
for (String key : keys) {
xAxis.add(key);
HashMap<String, String> map = dataMap.get(key);
for(int i =0; i<legend.size(); i++){
for (int i = 0; i < legend.size(); i++) {
List<String> data = yAxis.get(i);
if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
if (StringUtil.isNotEmpty(map.get(legend.get(i)))) {
data.add(map.get(legend.get(i)));
}else{
} else {
data.add("0");
}
}
@ -540,10 +576,12 @@ public class CommonController{
System.out.println();
}
// 创建结果Map
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("xAxis",xAxis);
resultMap.put("yAxis",yAxis);
resultMap.put("legend",legend);
resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis);
resultMap.put("legend", legend);
// 返回包含柱状图求和结果的结果对象
return R.ok().put("data", resultMap);
}
@ -570,121 +608,131 @@ public class CommonController{
isJoinTableFlag = true;
}
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期
thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));
// 处理当前表日期
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))) {
thisTable.put("date", String.valueOf(thisTable.get("date")).split(","));
one = "thisDate0";
}
if(isJoinTableFlag){//级联表日期
// 处理级联表日期
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){
joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinDate0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinDate0";
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))) {
joinTable.put("date", String.valueOf(joinTable.get("date")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinDate0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinDate0";
}
}
}
}
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串
thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));
if(StringUtil.isEmpty(one)){
one ="thisString0";
}else{
if(StringUtil.isEmpty(two)){
two ="thisString0";
// 处理当前表字符串
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))) {
thisTable.put("string", String.valueOf(thisTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) {
one = "thisString0";
} else {
if (StringUtil.isEmpty(two)) {
two = "thisString0";
}
}
}
if(isJoinTableFlag){//级联表字符串
// 处理级联表字符串
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){
joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinString0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinString0";
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))) {
joinTable.put("string", String.valueOf(joinTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinString0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinString0";
}
}
}
}
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型
thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));
if(StringUtil.isEmpty(one)){
one ="thisTypes0";
}else{
if(StringUtil.isEmpty(two)){
two ="thisTypes0";
// 处理当前表类型
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))) {
thisTable.put("types", String.valueOf(thisTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) {
one = "thisTypes0";
} else {
if (StringUtil.isEmpty(two)) {
two = "thisTypes0";
}
}
}
if(isJoinTableFlag){//级联表类型
// 处理级联表类型
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){
joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinTypes0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinTypes0";
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))) {
joinTable.put("types", String.valueOf(joinTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinTypes0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinTypes0";
}
}
}
}
// 调用CommonService进行柱状图统计
List<Map<String, Object>> result = commonService.barCount(params);
List<String> xAxis = new ArrayList<>();//报表x轴
List<List<String>> yAxis = new ArrayList<>();//y轴
List<String> legend = new ArrayList<>();//标题
// 报表x轴
List<String> xAxis = new ArrayList<>();
// y轴
List<List<String>> yAxis = new ArrayList<>();
// 标题
List<String> legend = new ArrayList<>();
if(StringUtil.isEmpty(two)){//不包含第二列
// 如果不包含第二列
if (StringUtil.isEmpty(two)) {
List<String> yAxis0 = new ArrayList<>();
yAxis.add(yAxis0);
legend.add("数值");
for(Map<String, Object> map :result){
for (Map<String, Object> map : result) {
String oneValue = String.valueOf(map.get(one));
String value = String.valueOf(map.get("value"));
xAxis.add(oneValue);
yAxis0.add(value);
}
}else{//包含第二列
} else {
// 包含第二列
Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
if(StringUtil.isNotEmpty(two)){
for(Map<String, Object> map :result){
if (StringUtil.isNotEmpty(two)) {
for (Map<String, Object> map : result) {
String oneValue = String.valueOf(map.get(one));
String twoValue = String.valueOf(map.get(two));
String value = String.valueOf(map.get("value"));
if(!legend.contains(twoValue)){
legend.add(twoValue);//添加完成后 就是最全的第二列的类型
if (!legend.contains(twoValue)) {
legend.add(twoValue);
}
if(dataMap.containsKey(oneValue)){
dataMap.get(oneValue).put(twoValue,value);
}else{
if (dataMap.containsKey(oneValue)) {
dataMap.get(oneValue).put(twoValue, value);
} else {
HashMap<String, String> oneData = new HashMap<>();
oneData.put(twoValue,value);
dataMap.put(oneValue,oneData);
oneData.put(twoValue, value);
dataMap.put(oneValue, oneData);
}
}
}
for(int i =0; i<legend.size(); i++){
for (int i = 0; i < legend.size(); i++) {
yAxis.add(new ArrayList<String>());
}
Set<String> keys = dataMap.keySet();
for(String key:keys){
for (String key : keys) {
xAxis.add(key);
HashMap<String, String> map = dataMap.get(key);
for(int i =0; i<legend.size(); i++){
for (int i = 0; i < legend.size(); i++) {
List<String> data = yAxis.get(i);
if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
if (StringUtil.isNotEmpty(map.get(legend.get(i)))) {
data.add(map.get(legend.get(i)));
}else{
} else {
data.add("0");
}
}
@ -692,10 +740,12 @@ public class CommonController{
System.out.println();
}
// 创建结果Map
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("xAxis",xAxis);
resultMap.put("yAxis",yAxis);
resultMap.put("legend",legend);
resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis);
resultMap.put("legend", legend);
// 返回包含柱状图统计结果的结果对象
return R.ok().put("data", resultMap);
}
}

@ -73,11 +73,9 @@ public class UsersController {
}
/**
*
* @param user
* @return R
*
*/
@IgnoreAuth // 忽略权限验证的注解
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody UsersEntity user) {
// ValidatorUtils.validateEntity(user); // 被注释掉的代码,可能用于验证用户实体的合法性,目前未启用
@ -93,9 +91,7 @@ public class UsersController {
}
/**
* 退
* @param request HTTP
* @return R退
* 退
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {

@ -1,25 +1,41 @@
<!DOCTYPE html>
<html>
<head lang="en">
<!-- 设置字符编码为 UTF-8 -->
<meta charset="utf-8">
<!-- 设置网页标题 -->
<title>首页</title>
<!-- 设置网页描述信息 -->
<meta name="description" content=""/>
<!-- 设置网页关键词 -->
<meta name="keywords" content=""/>
<!-- 设置网页作者 -->
<meta name="author" content="order by mobanxiu.cn"/>
<!-- 指定使用 WebKit 渲染引擎 -->
<meta name="renderer" content="webkit">
<!-- 让 IE 浏览器使用最新的渲染模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<!-- 设置页面在不同设备上的显示效果 -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- 引入 layui 框架的 CSS 文件 -->
<link rel="stylesheet" href="../../layui/css/layui.css">
<!-- 引入自定义的公共 CSS 文件 -->
<link rel="stylesheet" href="../../xznstatic/css/common.css"/>
<!-- 引入自定义的样式 CSS 文件 -->
<link rel="stylesheet" href="../../xznstatic/css/style.css"/>
<!-- 引入 swiper 插件的 CSS 文件 -->
<link rel="stylesheet" href="../../xznstatic/css/swiper.min.css"/>
<!-- 引入 jQuery 库 -->
<script src="../../xznstatic/js/jquery-1.11.3.min.js"></script>
<!-- 引入 SuperSlide 插件 -->
<script src="../../xznstatic/js/jquery.SuperSlide.2.1.1.js"></script>
<!-- 引入 Bootstrap 框架的 CSS 文件 -->
<link rel="stylesheet" href="../../xznstatic/css/bootstrap.min.css" />
<!-- 引入自定义的主题 CSS 文件 -->
<link rel="stylesheet" href="../../css/theme.css"/>
</head>
<style>
/* 为 HTML 元素添加背景样式 */
html::after {
position: fixed;
top: 0;
@ -33,10 +49,12 @@
background-position: center;
}
/* 设置轮播图容器的样式 */
#test1 {
overflow: hidden;
}
/* 设置轮播图指示器的样式 */
#test1 .layui-carousel-ind li {
width: 20px;
height: 10px;
@ -48,6 +66,7 @@
box-shadow: 0 0 6px rgba(255, 0, 0, .8);
}
/* 设置当前激活的轮播图指示器的样式 */
#test1 .layui-carousel-ind li.layui-this {
width: 30px;
height: 10px;
@ -57,6 +76,7 @@
border-radius: 6px;
}
/* 设置推荐区域的样式 */
.recommend {
padding: 10px 0;
display: flex;
@ -66,10 +86,12 @@
background-size: cover;
}
/* 设置推荐区域内容盒子的样式 */
.recommend .box {
width: 1014px;
}
/* 设置推荐区域标题的样式 */
.recommend .box .title {
padding: 10px 5px;
display: flex;
@ -78,22 +100,26 @@
flex-direction: column;
}
/* 设置推荐区域标题文字的样式 */
.recommend .box .title span {
padding: 0 10px;
line-height: 1.4;
}
/* 设置推荐区域列表的样式 */
.recommend .box .list {
display: flex;
flex-wrap: wrap;
}
/* 设置推荐区域列表项的样式,使用变量 var1 控制宽度 */
.index-pv1 .box .list .list-item {
flex: 0 0 ${var1}%;
padding: 0 5px;
box-sizing: border-box;
}
/* 设置推荐区域列表项主体的样式 */
.recommend .box .list .list-item-body {
border: 1px solid rgba(0, 0, 0, 3);
padding: 5px;
@ -101,6 +127,7 @@
cursor: pointer;
}
/* 设置推荐区域列表项图片的样式 */
.recommend .box .list img {
width: 100%;
height: 100px;
@ -110,6 +137,7 @@
max-width: 100%;
}
/* 设置推荐区域列表项名称的样式 */
.recommend .box .list .name {
padding-top: 5px;
color: red;
@ -118,6 +146,7 @@
box-sizing: border-box;
}
/* 设置推荐区域列表项不同布局的宽度 */
.recommend .box .list .list-item1 {
flex: 0 0 100%;
}
@ -139,28 +168,33 @@
}
/* 商品推荐-样式4-开始 */
/* 设置推荐区域样式4的列表样式 */
.recommend .list-4 {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
/* 设置推荐区域样式4的列表主体样式 */
.recommend .list-4 .list-4-body {
display: flex;
flex-direction: column;
}
/* 设置推荐区域样式4的列表项样式 */
.recommend .list-4 .list-4-item {
position: relative;
z-index: 1;
}
/* 设置推荐区域样式4的列表项1的样式 */
.recommend .list-4 .list-4-item.item-1 {
width: 400px;
height: 400px;
margin-right: 20px;
}
/* 设置推荐区域样式4的列表项2的样式 */
.recommend .list-4 .list-4-item.item-2 {
width: 220px;
height: 190px;
@ -168,6 +202,7 @@
margin-bottom: 20px;
}
/* 设置推荐区域样式4的列表项3的样式 */
.recommend .list-4 .list-4-item.item-3 {
width: 220px;
height: 190px;
@ -175,6 +210,7 @@
margin-bottom: 0;
}
/* 设置推荐区域样式4的列表项4的样式 */
.recommend .list-4 .list-4-item.item-4 {
width: 190px;
height: 190px;
@ -182,6 +218,7 @@
margin-bottom: 20px;
}
/* 设置推荐区域样式4的列表项5的样式 */
.recommend .list-4 .list-4-item.item-5 {
width: 190px;
height: 190px;
@ -189,6 +226,7 @@
margin-bottom: 0;
}
/* 设置推荐区域样式4的列表项图片的样式 */
.recommend .list-4 .list-4-item img {
width: 100%;
height: 100%;
@ -196,6 +234,7 @@
display: block;
}
/* 设置推荐区域样式4的列表项中心区域的样式 */
.recommend .list-4 .list-4-item .list-4-item-center {
position: absolute;
bottom: 0;
@ -207,6 +246,7 @@
background-color: rgba(0, 0, 0, .3);
}
/* 设置推荐区域样式4的列表项标题的样式 */
.recommend .list-4 .list-4-item .list-4-item-center .list-4-item-title {
width: 50%;
text-align: left;
@ -216,6 +256,7 @@
padding: 0 6px;
}
/* 设置推荐区域样式4的列表项价格的样式 */
.recommend .list-4 .list-4-item .list-4-item-center .list-4-item-price {
width: 50%;
text-align: right;
@ -227,40 +268,49 @@
/* 商品推荐-样式4-结束 */
/* 商品推荐-样式5-开始 */
/* 设置推荐区域样式5的 swiper 分页器的样式 */
.recommend #recommend-five-swiper.swiper-container-horizontal > .swiper-pagination-bullets {
line-height: 1;
}
/* 设置推荐区域样式5的 swiper 上一个幻灯片的样式 */
.recommend #recommend-five-swiper .swiper-slide.swiper-slide-prev {
z-index: 5;
}
/* 设置推荐区域样式5的 swiper 下一个幻灯片的样式 */
.recommend #recommend-five-swiper .swiper-slide.swiper-slide-next {
z-index: 5;
}
/* 设置推荐区域样式5的 swiper 当前激活幻灯片的样式 */
.recommend #recommend-five-swiper .swiper-slide.swiper-slide-active {
z-index: 9;
}
/* 设置推荐区域样式5的另一个 swiper 分页器的样式 */
.recommend #lists-five-swiper.swiper-container-horizontal > .swiper-pagination-bullets {
line-height: 1;
}
/* 设置推荐区域样式5的另一个 swiper 上一个幻灯片的样式 */
.recommend #lists-five-swiper .swiper-slide.swiper-slide-prev {
z-index: 5;
}
/* 设置推荐区域样式5的另一个 swiper 下一个幻灯片的样式 */
.recommend #lists-five-swiper .swiper-slide.swiper-slide-next {
z-index: 5;
}
/* 设置推荐区域样式5的另一个 swiper 当前激活幻灯片的样式 */
.recommend #lists-five-swiper .swiper-slide.swiper-slide-active {
z-index: 9;
}
/* 商品推荐-样式5-结束 */
/* 设置新闻区域的样式 */
.news {
padding: 10px 0;
display: flex;
@ -271,10 +321,12 @@
width: 100%;
}
/* 设置新闻区域内容盒子的样式 */
.news .box {
width: 1014px;
}
/* 设置新闻区域标题的样式 */
.news .box .title {
padding: 10px 5px;
display: flex;
@ -283,22 +335,26 @@
flex-direction: column;
}
/* 设置新闻区域标题文字的样式 */
.news .box .title span {
padding: 0 10px;
line-height: 1.4;
}
/* 设置新闻区域列表的样式 */
.news .box .list {
display: flex;
flex-wrap: wrap;
}
/* 设置新闻区域列表项的样式 */
.index-pv2 .box .list .list-item {
flex: 0 0 25%;
padding: 0 10px;
box-sizing: border-box;
}
/* 设置新闻区域列表项主体的样式 */
.news .box .list .list-item .list-item-body {
border: 1px solid rgba(0, 0, 0, 3);
padding: 10px;
@ -307,6 +363,7 @@
cursor: pointer;
}
/* 设置新闻区域列表项图片的样式 */
.news .box .list .list-item .list-item-body img {
width: 120px;
height: 100%;
@ -316,6 +373,7 @@
max-width: 100%;
}
/* 设置新闻区域列表项信息区域的样式 */
.news .box .list .list-item .list-item-body .item-info {
flex: 1;
display: flex;
@ -325,6 +383,7 @@
box-sizing: border-box;
}
/* 设置新闻区域列表项名称的样式 */
.news .box .list .list-item .list-item-body .item-info .name {
padding-top: 5px;
color: red;
@ -337,6 +396,7 @@
-webkit-box-orient: vertical;
}
/* 设置新闻区域列表项时间的样式 */
.news .box .list .list-item .list-item-body .item-info .time {
padding-top: 5px;
color: red;
@ -348,6 +408,7 @@
-webkit-box-orient: vertical;
}
/* 设置新闻区域列表项不同布局的宽度 */
.news .box .list .list-item1 {
flex: 0 0 100%;
}
@ -360,6 +421,7 @@
flex: 0 0 25%;
}
/* 设置列表区域的样式 */
.lists {
padding: 10px 0;
display: flex;
@ -369,11 +431,13 @@
background-size: cover;
}
/* 设置列表区域内容盒子的样式 */
.lists .box {
width: 1014px;
overflow: hidden;
}
/* 设置列表区域标题的样式 */
.lists .box .title {
padding: 10px 5px;
display: flex;
@ -382,21 +446,25 @@
flex-direction: column;
}
/* 设置列表区域标题文字的样式 */
.lists .box .title span {
padding: 0 10px;
line-height: 1.4;
}
/* 设置列表区域 swiper 幻灯片的样式 */
.lists .box .swiper-slide {
box-sizing: border-box;
cursor: pointer;
}
/* 设置列表区域 swiper 幻灯片图片盒子的样式 */
.lists .box .swiper-slide .img-box {
width: 100%;
overflow: hidden;
}
/* 设置列表区域 swiper 幻灯片图片的样式 */
.lists .box .swiper-slide .img-box img {
width: 100%;
height: 100%;
@ -404,6 +472,7 @@
max-width: 100%;
}
/* 设置不同布局下动画盒子的悬停样式 */
.index-pv1 .animation-box:hover {
transform: perspective(10px) translate3d(-10px, -10px, 0px) scale(1) rotate(0deg) skew(0deg, 0deg);
transition: all 0.3s;
@ -423,6 +492,7 @@
position: relative;
}
/* 设置新列表6的 swiper 滑动过渡效果为线性 */
#new-list-6 .swiper-wrapper {
-webkit-transition-timing-function: linear;
-moz-transition-timing-function: linear;
@ -432,11 +502,14 @@
}
</style>
<body>
<!-- Vue 实例挂载的根元素 -->
<div id="app">
<!-- 轮播图区域 -->
<div class="banner">
<div class="layui-carousel" id="test1"
:style='{"boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 auto","borderColor":"rgba(0,0,0,.3)","borderRadius":"0px","borderWidth":"0","width":"100%","borderStyle":"solid"}'>
<div carousel-item>
<!-- 循环渲染轮播图列表 -->
<div v-for="(item,index) in swiperList" :key="index">
<img style="width: 100%;height: 100%;object-fit:cover;" :src="item.img"/>
</div>
@ -444,22 +517,29 @@
</div>
</div>
<!-- 内容区域 -->
<div id="content">
<!-- 新闻区域 -->
<div class="news index-pv2" style="display: flex;justify-content: center;width:100%"
:style='{"padding":"10px 0 10px 0","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"10px 0 0 0","borderColor":"rgba(0,0,0,.3)","backgroundColor":"rgba(255, 0, 0, 0)","borderRadius":"0","borderWidth":"0","borderStyle":"solid"}'>
<div class="box" style='width:80%'>
<div class="title main_backgroundColor sub_borderColor"
<!-- 新闻区域标题 -->
<div class="title main_backgroundColor sub_borderColor"
:style='{"padding":"10px 0 10px 0","boxShadow":"0 0 3px ","margin":"10px 0 10px 0","color":"rgba(23, 22, 23, 1)","borderRadius":"0px","alignItems":"flex-start","borderWidth":"0 10px","fontSize":"17px","borderStyle":"solid"}'>
<span>NEWS</span>
<span>公告信息展示</span>
</div>
</div>
<!-- 新闻列表 -->
<div class="list">
<!-- 循环渲染新闻列表项 -->
<div v-for="(item,index) in newsList" :key="index" class="list-item list-item5" @click="jump('../news/detail.html?id='+item.id)">
<div class="list-item-body animation-box sub_borderColor" :style='{"padding":"0","margin":"10px 6px 20px 6px","borderColor":"rgba(0,0,0,.3)","backgroundColor":"#fff","borderRadius":"6px","borderWidth":"0","borderStyle":"solid"}'>
<img :style='{"boxShadow":"","borderColor":"rgba(0,0,0,.3)","borderRadius":"0","borderWidth":"0","width":"60%","borderStyle":"solid","height":"220px"}' :src="item.newsPhoto" alt="" />
<div class="item-info">
<!-- 新闻名称 -->
<div v-if='true' :style='{"isshow":true,"padding":"2px","margin":"8px 0 0 0","backgroundColor":"rgba(0,0,0,0)","color":"rgba(51, 51, 51, 1)","borderRadius":"0","textAlign":"center","fontSize":"16px"}' class="name">{{item.newsName}}</div>
<!-- 新闻发布时间 -->
<div :style='{"padding":"0","margin":"0","backgroundColor":"rgba(0,0,0,0)","color":"#999","borderRadius":"0","textAlign":"left","fontSize":"12px"}' class="time">{{item.insertTime}}</div>
</div>
</div>
@ -467,6 +547,7 @@
</div>
<div class="clear"></div>
<div style="text-align: center;">
<!-- 查看更多新闻按钮 -->
<button @click="jump('../news/list.html')" style="display: block;cursor: pointer;" type="button"
:style='{"padding":"0 15px","boxShadow":"0 0 6px rgba(255,0,0,0)","margin":"4px auto","borderColor":"#ccc","backgroundColor":"#fff","color":"rgba(160, 67, 26, 1)","borderRadius":"6px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"34px"}'>
查看更多
@ -475,22 +556,28 @@
</div>
</div>
</div>
<!-- 医生展示区域 -->
<div class="recommend index-pv3"
:style='{"padding":"10px 0 10px 0","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"10px 0 0 0","borderColor":"rgba(0,0,0,.3)","backgroundColor":"rgba(255, 0, 0, 0)","borderRadius":"4px","borderWidth":"0","borderStyle":"solid"}'>
<div class="box" style='width:80%'>
<div class="title main_backgroundColor sub_borderColor"
<!-- 医生展示区域标题 -->
<div class="title main_backgroundColor sub_borderColor"
:style='{"padding":"10px 0 10px 0","boxShadow":"0 0 3px ","margin":"10px 0 10px 0","color":"rgba(23, 22, 23, 1)","borderRadius":"0px","alignItems":"flex-start","borderWidth":"0 10px","fontSize":"17px","borderStyle":"solid"}'>
<span>DATA SHOW</span>
<span>医生展示</span>
</div>
</div>
<!-- 医生展示列表 -->
<div class="show-reel row">
<!-- 循环渲染医生列表项 -->
<div v-for="(item,index) in yishengList" v-bind:key="index" class="col-md-3 agile-gallery-grid">
<div class="agile-gallery">
<a @click="jumpCheck('../yisheng/detail.html?id='+item.id , item.aaaaaaaaaa == null?'':item.aaaaaaaaaa , item.shangxiaTypes == null?'':item.shangxiaTypes)" class="lsb-preview" data-lsb-group="header">
<img :src="item.yishengPhoto?item.yishengPhoto.split(',')[0]:''" style="height: 350px;width:100%;" />
<div class="agileits-caption">
<!-- 医生姓名 -->
<h4>{{item.yishengName}}</h4>
<!-- 医生价格 -->
<p v-if="item.yishengNewMoney != null" >¥{{item.yishengNewMoney}}</p>
</div>
</a>
@ -500,6 +587,7 @@
<div class="clear"></div>
<div style="text-align: center;">
<!-- 查看更多医生按钮 -->
<button @click="jump('../yisheng/list.html')" style="display: block;cursor: pointer;" type="button"
:style='{"padding":"0 15px","boxShadow":"0 0 6px rgba(255,0,0,0)","margin":"4px auto","borderColor":"#ccc","backgroundColor":"#fff","color":"rgba(160, 67, 26, 1)","borderRadius":"6px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"34px"}'>
查看更多<i v-if="true"
@ -508,21 +596,27 @@
</div>
</div>
</div>
<!-- 健康教育展示区域 -->
<div class="news index-pv2" style="display: flex;justify-content: center;width:100%"
:style='{"padding":"10px 0 10px 0","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"10px 0 0 0","borderColor":"rgba(0,0,0,.3)","backgroundColor":"rgba(255, 0, 0, 0)","borderRadius":"0","borderWidth":"0","borderStyle":"solid"}'>
<div class="box" style='width:80%'>
<div class="title main_backgroundColor sub_borderColor"
<!-- 健康教育展示区域标题 -->
<div class="title main_backgroundColor sub_borderColor"
:style='{"padding":"10px 0 10px 0","boxShadow":"0 0 3px ","margin":"10px 0 10px 0","color":"rgba(23, 22, 23, 1)","borderRadius":"0px","alignItems":"flex-start","borderWidth":"0 10px","fontSize":"17px","borderStyle":"solid"}'>
<span>DATA SHOW</span>
<span>健康教育展示</span>
</div>
</div>
<!-- 健康教育列表 -->
<div class="list">
<!-- 循环渲染健康教育列表项 -->
<div v-for="(item,index) in jiankangjiaoyuList" :key="index" class="list-item list-item5" @click="jump('../jiankangjiaoyu/detail.html?id='+item.id)">
<div class="list-item-body animation-box sub_borderColor" :style='{"padding":"0","margin":"10px 6px 20px 6px","borderColor":"rgba(0,0,0,.3)","backgroundColor":"#fff","borderRadius":"6px","borderWidth":"0","borderStyle":"solid"}'>
<img :style='{"boxShadow":"","borderColor":"rgba(0,0,0,.3)","borderRadius":"0","borderWidth":"0","width":"60%","borderStyle":"solid","height":"220px"}' :src="item.jiankangjiaoyuPhoto" alt="" />
<div class="item-info">
<!-- 健康教育名称 -->
<div v-if='true' :style='{"isshow":true,"padding":"2px","margin":"8px 0 0 0","backgroundColor":"rgba(0,0,0,0)","color":"rgba(51, 51, 51, 1)","borderRadius":"0","textAlign":"center","fontSize":"16px"}' class="name">{{item.jiankangjiaoyuName}}</div>
<!-- 健康教育发布时间 -->
<div :style='{"padding":"0","margin":"0","backgroundColor":"rgba(0,0,0,0)","color":"#999","borderRadius":"0","textAlign":"left","fontSize":"12px"}' class="time">{{item.insertTime}}</div>
</div>
</div>
@ -530,6 +624,7 @@
</div>
<div class="clear"></div>
<div style="text-align: center;">
<!-- 查看更多健康教育按钮 -->
<button @click="jump('../jiankangjiaoyu/list.html')" style="display: block;cursor: pointer;" type="button"
:style='{"padding":"0 15px","boxShadow":"0 0 6px rgba(255,0,0,0)","margin":"4px auto","borderColor":"#ccc","backgroundColor":"#fff","color":"rgba(160, 67, 26, 1)","borderRadius":"6px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"34px"}'>
查看更多
@ -542,32 +637,45 @@
</div>
</div>
<!-- 引入 Bootstrap 框架的 JavaScript 文件 -->
<script src="../../xznstatic/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<!-- 引入 layui 框架的 JavaScript 文件 -->
<script src="../../layui/layui.js"></script>
<!-- 引入 Vue.js 库 -->
<script src="../../js/vue.js"></script>
<!-- 引入element组件库 -->
<!-- 引入 Element 组件库 -->
<script src="../../xznstatic/js/element.min.js"></script>
<!-- 引入element样式 -->
<!-- 引入 Element 组件库的样式文件 -->
<link rel="stylesheet" href="../../xznstatic/css/element.min.css">
<!-- 引入 swiper 插件的 JavaScript 文件 -->
<script src="../../xznstatic/js/swiper.min.js"></script>
<!-- 引入自定义的配置 JavaScript 文件 -->
<script src="../../js/config.js"></script>
<!-- 引入自定义的模块配置 JavaScript 文件 -->
<script src="../../modules/config.js"></script>
<!-- 引入自定义的工具 JavaScript 文件 -->
<script src="../../js/utils.js"></script>
<script type="text/javascript">
// 创建 Vue 实例
var vue = new Vue({
// 挂载点
el: '#app',
// 数据对象
data: {
swiperList: [],
swiperList: [], // 轮播图列表
// dianyingRecommend: [],
newsList: [],
yishengList: [],
jiankangjiaoyuList: [],
newsList: [], // 新闻列表
yishengList: [], // 医生列表
jiankangjiaoyuList: [], // 健康教育列表
},
// 过滤器
filters: {
newsDesc: function (val) {
if (val) {
// 去除 HTML 标签和 undefined 字符串
val = val.replace(/<[^<>]+>/g, '').replace(/undefined/g, '');
if (val.length > 60) {
// 截取前 60 个字符
val = val.substring(0, 60);
}
@ -576,31 +684,41 @@
return '';
}
},
// 方法
methods: {
// 页面跳转方法
jump(url) {
jump(url)
}
,jumpCheck(url,check1,check2) {
if(check1 == "2" || check1 == 2){//级联表的逻辑删除字段[1:未删除 2:已删除]
},
// 带检查的页面跳转方法
jumpCheck(url, check1, check2) {
if (check1 == "2" || check1 == 2) {//级联表的逻辑删除字段[1:未删除 2:已删除]
// 弹出提示框
layui.layer.msg("已经被删除", {
time: 2000,
icon: 2
});
return false;
}
if(check2 == "2" || check2 == 2){//是否下架[1:上架 2:下架]
if (check2 == "2" || check2 == 2) {//是否下架[1:上架 2:下架]
// 弹出提示框
layui.layer.msg("已经下架", {
time: 2000,
icon: 2
});
return false;
}
// 调用 jump 方法进行页面跳转
this.jump(url);
}
}
});
layui.use(['layer', 'form', 'element', 'carousel', 'http', 'jquery'], function () {
// 使用 layui 加载所需的模块
layui.use(['layer', 'form', 'element', 'carousel', 'http', 'jquery'
], function () {
// 从 layui 中获取所需的模块实例
var layer = layui.layer;
var element = layui.element;
var form = layui.form;
@ -608,27 +726,32 @@
var http = layui.http;
var jquery = layui.jquery;
// 获取轮播图 数据
// 发送 HTTP 请求获取轮播图数据
http.request('config/list', 'get', {
page: 1,
limit: 5
}, function (res) {
// 检查响应数据中列表是否有内容
if (res.data.list.length > 0) {
// 用于存储轮播图数据的数组
let swiperList = [];
// 遍历响应数据中的列表项
res.data.list.forEach(element => {
if(element.value != null
)
{
// 检查当前项的 value 属性是否不为 null
if (element.value != null) {
// 将符合条件的项添加到 swiperList 数组中
swiperList.push({
img: element.value
});
}
})
;
});
// 将处理后的轮播图数据赋值给 Vue 实例的 swiperList
vue.swiperList = swiperList;
// 等待 Vue 实例更新 DOM 后执行回调函数
vue.$nextTick(() => {
// 渲染轮播图组件
carousel.render({
elem: '#test1',
width: '100%',
@ -638,45 +761,51 @@
autoplay: 'true',
interval: '3000',
indicator: 'inside'
});
});
})
// vue.$nextTick(()=>{
// 注释掉的代码,原本用于调用自定义的幻灯片函数
// vue.$nextTick(() => {
// window.xznSlide();
// });
}
});
// 发送 HTTP 请求获取新闻列表数据
http.request('news/list', 'get', {
page: 1,
limit: 8,
}, function (res) {
// 将响应数据中的列表赋值给 Vue 实例的 newsList
vue.newsList = res.data.list;
});
// 发送 HTTP 请求获取医生列表数据
http.request('yisheng/list', 'get', {
page: 1,
limit: 8,
}, function (res) {
// 将响应数据中的列表赋值给 Vue 实例的 yishengList
vue.yishengList = res.data.list;
});
// 发送 HTTP 请求获取健康教育列表数据
http.request('jiankangjiaoyu/list', 'get', {
page: 1,
limit: 8,
jiankangjiaoyuDelete: 1,
}, function (res) {
// 将响应数据中的列表赋值给 Vue 实例的 jiankangjiaoyuList
vue.jiankangjiaoyuList = res.data.list;
});
});
})
;
// 定义自定义的幻灯片函数
window.xznSlide = function () {
// 注释掉的代码,原本用于初始化 .banner 元素的幻灯片效果
// jQuery(".banner").slide({mainCell:".bd ul",autoPlay:true,interTime:5000});
// 初始化 #ifocus 元素的图片幻灯片效果
jQuery("#ifocus").slide({
titCell: "#ifocus_btn li",
mainCell: "#ifocus_piclist ul",
@ -685,7 +814,9 @@
autoPlay: true,
triggerTime: 0
});
// 初始化 #ifocus 元素的文本幻灯片效果
jQuery("#ifocus").slide({titCell: "#ifocus_btn li", mainCell: "#ifocus_tx ul", delayTime: 0, autoPlay: true});
// 初始化 .product_list 元素的幻灯片效果
jQuery(".product_list").slide({
mainCell: ".bd ul",
autoPage: true,

Loading…
Cancel
Save