最新版宁夏武警公众号项目后端
This commit is contained in:
32
src/main/java/com/guahao/GuahaoApplication.java
Normal file
32
src/main/java/com/guahao/GuahaoApplication.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.guahao;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import tk.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
@EnableAspectJAutoProxy(proxyTargetClass = true)
|
||||
@SpringBootApplication(scanBasePackages = "com")
|
||||
@MapperScan(basePackages = {"com.guahao.*.mapper"})
|
||||
@ServletComponentScan(basePackages = {"com.guahao.common.filter"})
|
||||
@ComponentScan(basePackages = {"com.guahao"})
|
||||
@EnableScheduling
|
||||
public class GuahaoApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(GuahaoApplication.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GuahaoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
30
src/main/java/com/guahao/UploadConfig.java
Normal file
30
src/main/java/com/guahao/UploadConfig.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.guahao;
|
||||
|
||||
/**
|
||||
* @ClassName: UploadConfig
|
||||
* @Description:
|
||||
* @Author T.W
|
||||
* @Date 2021/10/12
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 设置虚拟路径,访问绝对路径下资源
|
||||
*/
|
||||
@Configuration
|
||||
public class UploadConfig implements WebMvcConfigurer {
|
||||
@Value("${file.staticAccessPath}")
|
||||
private String staticAccessPath;
|
||||
|
||||
@Value("${file.uploadFolder}")
|
||||
private String uploadFolder;
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler(staticAccessPath).addResourceLocations("file:" + uploadFolder);
|
||||
}
|
||||
}
|
||||
29
src/main/java/com/guahao/WebLog.java
Normal file
29
src/main/java/com/guahao/WebLog.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.guahao;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author T.W
|
||||
* @site xxx
|
||||
* @date 2021/9/8
|
||||
* @time 下午9:19
|
||||
* @discription
|
||||
**/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
@Documented
|
||||
public @interface WebLog {
|
||||
/**
|
||||
* 日志描述信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String description() default "";
|
||||
/**
|
||||
* 是否记录响应参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean logResponse() default true;
|
||||
|
||||
}
|
||||
178
src/main/java/com/guahao/WebLogAspect.java
Normal file
178
src/main/java/com/guahao/WebLogAspect.java
Normal file
@@ -0,0 +1,178 @@
|
||||
package com.guahao;
|
||||
|
||||
//import com.google.gson.Gson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author T.W
|
||||
* @site xxx
|
||||
* @date 2021/9/8
|
||||
* @time 下午9:19
|
||||
* @discription
|
||||
**/
|
||||
@Aspect
|
||||
@Component
|
||||
//@Profile({"dev", "test"})
|
||||
public class WebLogAspect {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
|
||||
/** 换行符 */
|
||||
private static final String LINE_SEPARATOR = System.lineSeparator();
|
||||
|
||||
/** 以自定义 @WebLog 注解为切点 */
|
||||
@Pointcut("@annotation(com.guahao.WebLog)")
|
||||
public void webLog() {}
|
||||
|
||||
/**
|
||||
* 在切点之前织入
|
||||
* @param joinPoint
|
||||
* @throws Throwable
|
||||
*/
|
||||
@Before("webLog()")
|
||||
public void doBefore(JoinPoint joinPoint) throws Throwable {
|
||||
// 开始打印请求日志
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
|
||||
// 获取 @WebLog 注解的描述信息
|
||||
String methodDescription = getAspectLogDescription(joinPoint);
|
||||
|
||||
// 打印请求相关参数
|
||||
logger.info("========================================== Start ==========================================");
|
||||
// 打印请求 url
|
||||
logger.info("URL : {}", request.getRequestURL().toString());
|
||||
// 打印描述信息
|
||||
logger.info("Description : {}", methodDescription);
|
||||
// 打印 Http method
|
||||
logger.info("HTTP Method : {}", request.getMethod());
|
||||
// 打印调用 controller 的全路径以及执行方法
|
||||
logger.info("Class Method : {}.{}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
|
||||
// 打印请求的 IP
|
||||
logger.info("IP : {}", request.getRemoteAddr());
|
||||
// 打印请求入参
|
||||
// if(methodDescription.equals("loginUserInfo") || methodDescription.equals("quitUserInfo")){
|
||||
//
|
||||
// }else{
|
||||
// logger.info("Request Args : {}", JSON.toJSON(joinPoint.getArgs()));
|
||||
// }
|
||||
// ✅ 安全地处理请求参数:只序列化非 Servlet 类型的参数
|
||||
Object[] args = joinPoint.getArgs();
|
||||
List<Object> safeArgs = new ArrayList<>();
|
||||
for (Object arg : args) {
|
||||
if (arg == null ||
|
||||
!(arg instanceof ServletRequest ||
|
||||
arg instanceof ServletResponse ||
|
||||
arg instanceof InputStream ||
|
||||
arg instanceof Reader)) {
|
||||
safeArgs.add(arg);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Request Args : {}", JSON.toJSONString(safeArgs)); // 使用 toJSONString 更安全
|
||||
}
|
||||
|
||||
/**
|
||||
* 在切点之后织入
|
||||
* @throws Throwable
|
||||
*/
|
||||
@After("webLog()")
|
||||
public void doAfter() throws Throwable {
|
||||
// 接口结束后换行,方便分割查看
|
||||
logger.info("=========================================== End ===========================================" + LINE_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 环绕
|
||||
* @param proceedingJoinPoint
|
||||
* @return
|
||||
* @throws Throwable
|
||||
*/
|
||||
@Around("webLog()")
|
||||
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||
long startTime = System.currentTimeMillis();
|
||||
Object result = proceedingJoinPoint.proceed();
|
||||
|
||||
// 检查是否需要记录响应参数
|
||||
boolean logResponse = true;
|
||||
try {
|
||||
// 获取方法上的@WebLog注解
|
||||
String targetName = proceedingJoinPoint.getTarget().getClass().getName();
|
||||
String methodName = proceedingJoinPoint.getSignature().getName();
|
||||
Object[] arguments = proceedingJoinPoint.getArgs();
|
||||
Class targetClass = Class.forName(targetName);
|
||||
Method[] methods = targetClass.getMethods();
|
||||
for (Method method : methods) {
|
||||
if (method.getName().equals(methodName)) {
|
||||
Class[] clazzs = method.getParameterTypes();
|
||||
if (clazzs.length == arguments.length) {
|
||||
WebLog webLog = method.getAnnotation(WebLog.class);
|
||||
if (webLog != null) {
|
||||
logResponse = webLog.logResponse();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果获取注解信息失败,默认记录响应参数
|
||||
logger.warn("获取WebLog注解信息失败: {}", e.getMessage());
|
||||
}
|
||||
|
||||
// 根据配置决定是否打印出参
|
||||
if (logResponse) {
|
||||
logger.info("Response Args : {}", JSON.toJSON(result));
|
||||
}
|
||||
// 执行耗时
|
||||
logger.info("Time-Consuming : {} ms", System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取切面注解的描述
|
||||
*
|
||||
* @param joinPoint 切点
|
||||
* @return 描述信息
|
||||
* @throws Exception
|
||||
*/
|
||||
public String getAspectLogDescription(JoinPoint joinPoint)
|
||||
throws Exception {
|
||||
String targetName = joinPoint.getTarget().getClass().getName();
|
||||
String methodName = joinPoint.getSignature().getName();
|
||||
Object[] arguments = joinPoint.getArgs();
|
||||
Class targetClass = Class.forName(targetName);
|
||||
Method[] methods = targetClass.getMethods();
|
||||
StringBuilder description = new StringBuilder("");
|
||||
for (Method method : methods) {
|
||||
if (method.getName().equals(methodName)) {
|
||||
Class[] clazzs = method.getParameterTypes();
|
||||
if (clazzs.length == arguments.length) {
|
||||
description.append(method.getAnnotation(WebLog.class).description());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return description.toString();
|
||||
}
|
||||
|
||||
}
|
||||
57
src/main/java/com/guahao/api/IndexController.java
Normal file
57
src/main/java/com/guahao/api/IndexController.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.guahao.api;
|
||||
|
||||
import com.guahao.api.admin.service.AdminService;
|
||||
import com.guahao.api.admin.service.MenuService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class IndexController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(IndexController.class);
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
|
||||
/**
|
||||
* 后台登录
|
||||
*
|
||||
* @param nickname
|
||||
* @param pwd
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/login",method = RequestMethod.POST)
|
||||
public Object login(@RequestParam("nickname") String nickname, @RequestParam("pwd") String pwd, HttpServletRequest request){
|
||||
try{
|
||||
Map<String,Object> admin = adminService.login(nickname,pwd);
|
||||
|
||||
request.getSession().setAttribute("admin", admin);
|
||||
|
||||
List<Map<String,Object>> list = menuService.getMenuAll(Integer.valueOf(admin.get("rid").toString()));
|
||||
|
||||
request.getSession().setAttribute("menu", list);
|
||||
|
||||
return "index.jsp";
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
request.getSession().setAttribute("msg",e.getLocalizedMessage());
|
||||
return "cms/login.jsp";
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/")
|
||||
public String index(){
|
||||
return "cms/login.jsp";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.guahao.api.Inventory.controller;
|
||||
|
||||
import com.guahao.WebLog;
|
||||
import com.guahao.api.Inventory.model.Inventory;
|
||||
import com.guahao.api.Inventory.service.InventoryService;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/9
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/Inventory")
|
||||
public class InventoryController {
|
||||
|
||||
@Autowired
|
||||
private InventoryService inventoryService;
|
||||
|
||||
|
||||
// @RequestMapping(value = "testDb2GetData", method = RequestMethod.GET)
|
||||
// @WebLog(description = "testDb2GetData")
|
||||
// public Object testDb2GetData() {
|
||||
// log.info("开始请求多数据源视图数据库");
|
||||
// inventoryService.InHosFeeDetailQuery();
|
||||
// return ResponseResult.success();
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.guahao.api.Inventory.mapper;
|
||||
|
||||
import com.guahao.api.Inventory.model.Inventory;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/9
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface InventoryMapper extends BaseMapper<Inventory> {
|
||||
|
||||
|
||||
List<Inventory> getAllData();
|
||||
|
||||
}
|
||||
38
src/main/java/com/guahao/api/Inventory/model/Inventory.java
Normal file
38
src/main/java/com/guahao/api/Inventory/model/Inventory.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.guahao.api.Inventory.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/9
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Inventory {
|
||||
private String item_type;
|
||||
private String item_name;
|
||||
private String item_code;
|
||||
private String item_unit;
|
||||
private String item_price;
|
||||
private String item_count;
|
||||
private String item_amount;
|
||||
private String proportion;
|
||||
private String auto_amount;
|
||||
private String acc_amount;
|
||||
private String acc_type;
|
||||
private String prices_code;
|
||||
private String depart_name;
|
||||
private String specifications;
|
||||
private String tr_date_time;
|
||||
private String do_depart_code;
|
||||
private String do_depart_name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.guahao.api.Inventory.service;
|
||||
|
||||
//import com.guahao.api.Inventory.mapper.InventoryMapper;
|
||||
import com.guahao.api.Inventory.mapper.InventoryMapper;
|
||||
import com.guahao.api.Inventory.model.Inventory;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import com.guahao.common.util.SoapUtil;
|
||||
import com.guahao.common.util.XmlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/9
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class InventoryService extends BaseService<Inventory> {
|
||||
|
||||
@Autowired
|
||||
private InventoryMapper inventoryMapper;
|
||||
|
||||
public Object InHosFeeDetailQuery(String queryNum, String queryType, String searchType, String startTime,String endTime) {
|
||||
try{
|
||||
String queryXML = XmlUtil.InHosFeeDetailQuery(queryNum, queryType, searchType, startTime,endTime);
|
||||
log.info("查询住院患者详情resxml:"+queryXML);
|
||||
String respJfXml = SoapUtil.soapMethod2(queryXML);
|
||||
log.info("查询住院患者详情reqxml:"+respJfXml);
|
||||
return respJfXml;
|
||||
}catch (Exception e){
|
||||
log.error("查询失败");
|
||||
throw new RuntimeException("查询失败");
|
||||
}
|
||||
}
|
||||
// public List<Map<String, Object>> InHosFeeDetailQuery(String hosNum, String startTime) {
|
||||
// String URL = "jdbc:oracle:thin:@//192.168.0.114:1521/ORCL";
|
||||
// String USER = "zhyy";
|
||||
// String PASSWORD = "zhyy";
|
||||
// List<Map<String, Object>> list = new ArrayList<>();
|
||||
// // 1.加载驱动程序
|
||||
// try {
|
||||
// Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||
// // 2.获得数据库链接
|
||||
// Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
|
||||
// // 3.通过数据库的连接操作数据库,实现增删改查(使用Statement类)
|
||||
// // String inHosnum = "811134";
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// Calendar c = Calendar.getInstance();
|
||||
// // c.add(Calendar.DATE, 0);
|
||||
// // String tTime = sdf.format(c.getTime());
|
||||
// String todayTime = startTime + " 00:00:00";
|
||||
// c.add(Calendar.DATE, 1);
|
||||
// String tomTime = sdf.format(c.getTime());
|
||||
// String tommTime = tomTime + " 00:00:00";
|
||||
// //预编译 '" + QueryNum + "'
|
||||
// String sql = "select * from view_MOP_InHosFeeDetailQuery where INHOSNUM ='" + hosNum + "' and TrDateTime between '" + todayTime + "' " +
|
||||
// "and '" + tommTime + "'";
|
||||
// log.info("打印sql" + sql);
|
||||
// Statement statement = conn.createStatement();
|
||||
// ResultSet rs = statement.executeQuery(sql);
|
||||
// log.info("返回结果是:" + rs);
|
||||
// // ResultSetMetaData metaData = rs.getMetaData();
|
||||
// // int columnCount = metaData.getColumnCount();
|
||||
// // for (int i = 1; i <= columnCount; i++) {
|
||||
// // String cols_name = metaData.getColumnName(i);
|
||||
// // log.info("cols_name is :" + cols_name);
|
||||
// // String columnLabel = metaData.getColumnLabel(i);
|
||||
// // log.info("columnLabel is :" + columnLabel);
|
||||
// // }
|
||||
// // 4.处理数据库的返回结果(使用ResultSet类)
|
||||
// while (rs.next()) {
|
||||
// log.info("开始处理数据");
|
||||
// Map<String, Object> map = new HashMap<String, Object>();
|
||||
// // log.info("打印itemType" + rs.getString("ItemType"));
|
||||
// map.put("INHOSNUM", rs.getString("INHOSNUM"));
|
||||
// map.put("INHOSTIMES", rs.getString("INHOSTIMES"));
|
||||
// map.put("PATIENTID", rs.getString("PATIENTID"));
|
||||
// map.put("ItemType", rs.getString("ItemType"));
|
||||
// map.put("ItemName", rs.getString("ItemName"));
|
||||
// map.put("ItemCode", rs.getString("ItemCode"));
|
||||
// map.put("ItemUnit", rs.getString("ItemUnit"));
|
||||
// map.put("ItemPrice", rs.getString("ItemPrice"));
|
||||
// map.put("ItemCount", rs.getString("ItemCount"));
|
||||
// map.put("ItemAmount", rs.getString("ItemAmount"));
|
||||
// map.put("Proportion", rs.getString("Proportion"));
|
||||
// map.put("AutoAmount", rs.getString("AutoAmount"));
|
||||
// map.put("AccAmount", rs.getString("AccAmount"));
|
||||
// map.put("AccType", rs.getString("AccType"));
|
||||
// map.put("PricesCode", rs.getString("PricesCode"));
|
||||
// map.put("DepartName", rs.getString("DepartName"));
|
||||
// map.put("Specifications", rs.getString("Specifications"));
|
||||
// map.put("TrDateTime", rs.getString("TrDateTime"));
|
||||
// map.put("DoDepartCode", rs.getString("DoDepartCode"));
|
||||
// map.put("DoDepartName", rs.getString("DoDepartName"));
|
||||
// map.put("RCPTNO", rs.getString("RCPTNO"));
|
||||
// // map.put("PrintTime", rs.getString("PrintTime"));
|
||||
// // map.put("PrintName", rs.getString("PrintName"));
|
||||
// list.add(map);
|
||||
// // break;
|
||||
// }
|
||||
// log.info("list is " + list);
|
||||
// // 关闭资源【多谢指正】
|
||||
// rs.close();
|
||||
// statement.close();
|
||||
// conn.close();
|
||||
// } catch (ClassNotFoundException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
|
||||
public List<Inventory> getAllData() {
|
||||
return inventoryMapper.getAllData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.guahao.api.admin.controller;
|
||||
|
||||
import com.guahao.api.admin.model.AdminUser;
|
||||
import com.guahao.api.admin.model.Role;
|
||||
import com.guahao.api.admin.service.AdminService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin")
|
||||
public class AdminController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(AdminController.class);
|
||||
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加管理员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addAdmin(AdminUser admin,String pwd){
|
||||
try{
|
||||
int insertId = adminService.add(admin,pwd);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改管理员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(AdminUser admin,String pwd){
|
||||
try{
|
||||
int insertId = adminService.update(admin,pwd);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除管理员
|
||||
* @param id 权限id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = adminService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员详情
|
||||
* @param id 管理id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getinfo",method = RequestMethod.POST)
|
||||
public Object getinfo(@RequestParam("id") int id){
|
||||
try{
|
||||
Map<String,Object> admin = adminService.getinfo(id);
|
||||
return ResponseResult.success(admin);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询管理员
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getadminlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getAdminList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam("name")String name){
|
||||
try{
|
||||
List<Map<String,Object>> list = adminService.getAdminList(page,pagesize,name);
|
||||
return new PageBean<Map<String,Object>>(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/updatepwd",method = RequestMethod.POST)
|
||||
public Object updatePwd(@RequestParam("id") Integer id,
|
||||
@RequestParam("oldpwd") String oldpwd,
|
||||
@RequestParam("newpwd") String newpwd,
|
||||
@RequestParam("newpwd2") String newpwd2){
|
||||
try{
|
||||
int admin = adminService.updatePwd(id,oldpwd,newpwd,newpwd2);
|
||||
return ResponseResult.success(admin);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.guahao.api.admin.controller;
|
||||
|
||||
import com.guahao.api.admin.model.Menu;
|
||||
import com.guahao.api.admin.service.MenuService;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(value = "菜单管理", tags = {"菜单管理"})
|
||||
@RestController
|
||||
@RequestMapping(value = "/menu")
|
||||
public class MenuController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(MenuController.class);
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@ApiOperation(value = "添加菜单", notes = "添加菜单")
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addMenu(@RequestBody Menu menu){
|
||||
try{
|
||||
int insertId = menuService.add(menu);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改菜单", notes = "修改菜单")
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestBody Menu menu){
|
||||
try{
|
||||
int insertId = menuService.update(menu);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除菜单", notes = "删除菜单")
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = menuService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询所有子菜单", notes = "查询所有菜单")
|
||||
@RequestMapping(value="/get_menu_bypid",method = RequestMethod.POST)
|
||||
public Object getMenuByPid(@RequestParam(name="id",required = false) Integer id){
|
||||
try{
|
||||
id=id==null?0:id;
|
||||
List<Menu> list = menuService.getMenuByPid(id);
|
||||
return ResponseResult.success(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询权限下所有菜单", notes = "查询所有菜单")
|
||||
@RequestMapping(value="/get_menu_all",method = RequestMethod.POST)
|
||||
public Object getMenuAll(@RequestParam(name="id",required = false) Integer id){
|
||||
try{
|
||||
id=id==null?0:id;
|
||||
List<Map<String,Object>> list = menuService.getMenuAll(id);
|
||||
return ResponseResult.success(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "菜单排序排序", notes = "菜单排序排序")
|
||||
@RequestMapping(value="/paixu",method = RequestMethod.POST)
|
||||
public Object paixu(@RequestParam("qid") int qid,@RequestParam("hid")int hid){
|
||||
try{
|
||||
int insertId = menuService.paixu(qid,hid);
|
||||
|
||||
return ResponseResult.success("修改成功");
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.guahao.api.admin.controller;
|
||||
|
||||
|
||||
import com.guahao.api.admin.model.Menu;
|
||||
import com.guahao.api.admin.model.Role;
|
||||
import com.guahao.api.admin.service.MenuService;
|
||||
import com.guahao.api.admin.service.RoleService;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(value = "权限管理", tags = {"权限管理"})
|
||||
@RestController
|
||||
@RequestMapping(value = "/role")
|
||||
public class RoleController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(MenuController.class);
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加权限
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addRole(@RequestParam("name")String name,
|
||||
@RequestParam("menu")String menu){
|
||||
try{
|
||||
int insertId = roleService.add(name,menu);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改权限
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestParam("id")int id,
|
||||
@RequestParam("name")String name,
|
||||
@RequestParam("menu")String menu){
|
||||
try{
|
||||
int insertId = roleService.update(id,name,menu);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除权限
|
||||
* @param id 权限id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = roleService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限详情
|
||||
* @param id 权限id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getinfo",method = RequestMethod.POST)
|
||||
public Object getinfo(@RequestParam("id") int id){
|
||||
try{
|
||||
Map<String,Object> map = roleService.getinfo(id);
|
||||
return ResponseResult.success(map);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有权限
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getall",method = RequestMethod.POST)
|
||||
public Object getAll(){
|
||||
try{
|
||||
List<Role> map = roleService.getAll();
|
||||
return ResponseResult.success(map);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/main/java/com/guahao/api/admin/mapper/AdminMapper.java
Normal file
16
src/main/java/com/guahao/api/admin/mapper/AdminMapper.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.guahao.api.admin.mapper;
|
||||
|
||||
import com.guahao.api.admin.model.AdminUser;
|
||||
import com.guahao.api.admin.model.param.AdminUserParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface AdminMapper extends BaseMapper<AdminUser> {
|
||||
|
||||
List<Map<String,Object>> queryAll(AdminUserParam aup);
|
||||
|
||||
}
|
||||
16
src/main/java/com/guahao/api/admin/mapper/MenuMapper.java
Normal file
16
src/main/java/com/guahao/api/admin/mapper/MenuMapper.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.guahao.api.admin.mapper;
|
||||
|
||||
import com.guahao.api.admin.model.Menu;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface MenuMapper extends BaseMapper<Menu> {
|
||||
|
||||
List<Map<String,Object>> selAllByRole(@Param("id")int id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.guahao.api.admin.mapper;
|
||||
|
||||
import com.guahao.api.admin.model.RoleAndMenu;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RoleAndMenuMapper extends BaseMapper<RoleAndMenu> {
|
||||
}
|
||||
12
src/main/java/com/guahao/api/admin/mapper/RoleMapper.java
Normal file
12
src/main/java/com/guahao/api/admin/mapper/RoleMapper.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.guahao.api.admin.mapper;
|
||||
|
||||
import com.guahao.api.admin.model.Role;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface RoleMapper extends BaseMapper<Role> {
|
||||
|
||||
|
||||
}
|
||||
124
src/main/java/com/guahao/api/admin/model/AdminUser.java
Normal file
124
src/main/java/com/guahao/api/admin/model/AdminUser.java
Normal file
@@ -0,0 +1,124 @@
|
||||
package com.guahao.api.admin.model;
|
||||
|
||||
//import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="admin_user")
|
||||
public class AdminUser implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Column(name="tel")
|
||||
public String tel;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Column(name="nickname")
|
||||
public String nickname;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Column(name="password")
|
||||
public String password;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@Column(name="rid")
|
||||
public int rid;
|
||||
|
||||
/**
|
||||
* 状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTel() {
|
||||
return tel;
|
||||
}
|
||||
|
||||
public void setTel(String tel) {
|
||||
this.tel = tel;
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
|
||||
public int getRid() {
|
||||
return rid;
|
||||
}
|
||||
|
||||
public void setRid(int rid) {
|
||||
this.rid = rid;
|
||||
}
|
||||
}
|
||||
117
src/main/java/com/guahao/api/admin/model/Menu.java
Normal file
117
src/main/java/com/guahao/api/admin/model/Menu.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package com.guahao.api.admin.model;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="menu")
|
||||
public class Menu implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@ApiModelProperty(value = "菜单id")
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
@Column(name="name")
|
||||
@ApiModelProperty(value = "菜单名称")
|
||||
public String name;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
@Column(name="icon")
|
||||
@ApiModelProperty(value = "菜单图标")
|
||||
public String icon;
|
||||
|
||||
/**
|
||||
* 跳转url
|
||||
*/
|
||||
@Column(name="url")
|
||||
@ApiModelProperty(value = "跳转url")
|
||||
public String url;
|
||||
|
||||
/**
|
||||
* 上级id
|
||||
*/
|
||||
@Column(name="pid")
|
||||
@ApiModelProperty(value = "上级id")
|
||||
public int pid;
|
||||
|
||||
/**
|
||||
* 状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
@ApiModelProperty(value = "状态(1、删除)")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
public String ctime;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public int getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(int pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
69
src/main/java/com/guahao/api/admin/model/Role.java
Normal file
69
src/main/java/com/guahao/api/admin/model/Role.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.guahao.api.admin.model;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="role")
|
||||
public class Role implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@ApiModelProperty(value = "菜单id")
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name;
|
||||
|
||||
/**
|
||||
* 状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCddtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
56
src/main/java/com/guahao/api/admin/model/RoleAndMenu.java
Normal file
56
src/main/java/com/guahao/api/admin/model/RoleAndMenu.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.guahao.api.admin.model;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="role_and_menu")
|
||||
public class RoleAndMenu implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@ApiModelProperty(value = "id")
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 权限id
|
||||
*/
|
||||
@Column(name="rid")
|
||||
public int rid;
|
||||
|
||||
/**
|
||||
* 菜单id
|
||||
*/
|
||||
@Column(name="mid")
|
||||
public int mid;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getRid() {
|
||||
return rid;
|
||||
}
|
||||
|
||||
public void setRid(int rid) {
|
||||
this.rid = rid;
|
||||
}
|
||||
|
||||
public int getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
public void setMid(int mid) {
|
||||
this.mid = mid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.guahao.api.admin.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class AdminUserParam extends PageParams {
|
||||
|
||||
private String name;
|
||||
|
||||
private String deptName;
|
||||
|
||||
private String DoctorName;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getDoctorName() {
|
||||
return DoctorName;
|
||||
}
|
||||
|
||||
public void setDoctorName(String doctorName) {
|
||||
DoctorName = doctorName;
|
||||
}
|
||||
}
|
||||
282
src/main/java/com/guahao/api/admin/service/AdminService.java
Normal file
282
src/main/java/com/guahao/api/admin/service/AdminService.java
Normal file
@@ -0,0 +1,282 @@
|
||||
package com.guahao.api.admin.service;
|
||||
|
||||
import com.guahao.api.admin.mapper.AdminMapper;
|
||||
import com.guahao.api.admin.mapper.RoleMapper;
|
||||
import com.guahao.api.admin.model.AdminUser;
|
||||
import com.guahao.api.admin.model.Menu;
|
||||
import com.guahao.api.admin.model.Role;
|
||||
import com.guahao.api.admin.model.param.AdminUserParam;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import com.guahao.common.util.MD5Util;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class AdminService extends BaseService<AdminUser> {
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AdminMapper adminMapper;
|
||||
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
@Transactional
|
||||
public int add(AdminUser adminUser,String pwd){
|
||||
|
||||
if(adminUser.name==null||adminUser.name.trim().equals("")){
|
||||
throw new LogicException("请填写姓名");
|
||||
}
|
||||
|
||||
if(adminUser.tel==null||adminUser.tel.trim().equals("")){
|
||||
throw new LogicException("请填写联系方式");
|
||||
}
|
||||
|
||||
if(adminUser.nickname==null||adminUser.nickname.trim().equals("")){
|
||||
throw new LogicException("请填写用户名");
|
||||
}
|
||||
|
||||
if(adminUser.password==null||adminUser.password.trim().equals("")){
|
||||
throw new LogicException("请填写密码");
|
||||
}
|
||||
|
||||
if(adminUser.password.trim().length()<6||adminUser.password.trim().length()>30){
|
||||
throw new LogicException("密码长度为6-30");
|
||||
}
|
||||
|
||||
if(pwd==null||pwd.trim().equals("")){
|
||||
throw new LogicException("请输入确认密码");
|
||||
}
|
||||
|
||||
if(!pwd.equals(adminUser.password)){
|
||||
throw new LogicException("两次密码有误,请重新输入");
|
||||
}
|
||||
|
||||
if(adminUser.rid<=0){
|
||||
throw new LogicException("请选择正确权限");
|
||||
}
|
||||
|
||||
Example example=new Example(Menu.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",adminUser.nickname);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<AdminUser> list=adminMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该用户名已存在");
|
||||
}
|
||||
|
||||
adminUser.password=MD5Util.MD5Encode(adminUser.password.trim(),"UTF-8");
|
||||
adminUser.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
adminUser.id=0;
|
||||
|
||||
return adminMapper.insert(adminUser);
|
||||
}
|
||||
|
||||
|
||||
public int update(AdminUser adminUser,String pwd){
|
||||
|
||||
if(adminUser.id<0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(adminUser.name==null||adminUser.name.trim().equals("")){
|
||||
throw new LogicException("请填写姓名");
|
||||
}
|
||||
|
||||
if(adminUser.tel==null||adminUser.tel.trim().equals("")){
|
||||
throw new LogicException("请填写联系方式");
|
||||
}
|
||||
|
||||
if(adminUser.nickname==null||adminUser.nickname.trim().equals("")){
|
||||
throw new LogicException("请填写用户名");
|
||||
}
|
||||
|
||||
if(adminUser.password==null||adminUser.password.trim().equals("")){
|
||||
throw new LogicException("请填写密码");
|
||||
}
|
||||
|
||||
if(adminUser.password.trim().length()<6||adminUser.password.trim().length()>30){
|
||||
throw new LogicException("密码长度为6-30");
|
||||
}
|
||||
|
||||
if(pwd==null||pwd.trim().equals("")){
|
||||
throw new LogicException("请输入确认密码");
|
||||
}
|
||||
|
||||
if(!pwd.equals(adminUser.password)){
|
||||
throw new LogicException("两次密码有误,请重新输入");
|
||||
}
|
||||
|
||||
if(adminUser.rid<=0){
|
||||
throw new LogicException("请选择正确权限");
|
||||
}
|
||||
|
||||
AdminUser user=adminMapper.selectByPrimaryKey(adminUser.id);
|
||||
if(user==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Example example=new Example(Menu.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",adminUser.nickname);
|
||||
criteria.andNotEqualTo("id",adminUser.id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<AdminUser> list=adminMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该用户名已存在");
|
||||
}
|
||||
|
||||
adminUser.password= MD5Util.MD5Encode(adminUser.password.trim(),"UTF-8");
|
||||
|
||||
adminUser.flag=0;
|
||||
adminUser.ctime=user.ctime;
|
||||
|
||||
return adminMapper.updateByPrimaryKey(adminUser);
|
||||
}
|
||||
|
||||
public int del(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
AdminUser admin=adminMapper.selectByPrimaryKey(id);
|
||||
if(admin==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
admin.flag=1;
|
||||
return adminMapper.updateByPrimaryKey(admin);
|
||||
}
|
||||
|
||||
public Map<String,Object> getinfo(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
AdminUser admin=adminMapper.selectByPrimaryKey(id);
|
||||
if(admin==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
map.put("id",admin.id);
|
||||
map.put("tel",admin.tel);
|
||||
map.put("nickname",admin.nickname);
|
||||
map.put("name",admin.name);
|
||||
map.put("rid",admin.rid);
|
||||
Role role=roleMapper.selectByPrimaryKey(admin.rid);
|
||||
map.put("rname",role.name);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> getAdminList(int page,int pagesize,String name){
|
||||
|
||||
AdminUserParam aup=new AdminUserParam();
|
||||
aup.setName(name);
|
||||
aup.setPageSize(pagesize);
|
||||
aup.setCurrentPage(page);
|
||||
aup.startPage();
|
||||
aup.orderBy(" a.ctime desc");
|
||||
|
||||
List<Map<String,Object>> list=adminMapper.queryAll(aup);
|
||||
return list;
|
||||
}
|
||||
|
||||
public Map<String,Object> login(String nickname,String pwd){
|
||||
if(nickname==null||nickname.trim().equals("")){
|
||||
throw new LogicException("请输入用户名");
|
||||
}
|
||||
if(pwd==null||pwd.trim().equals("")){
|
||||
throw new LogicException("请输入密码");
|
||||
}
|
||||
|
||||
AdminUser adminUser;
|
||||
|
||||
Example example=new Example(AdminUser.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("nickname",nickname);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
List<AdminUser> list=adminMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
adminUser=list.get(0);
|
||||
}else{
|
||||
throw new LogicException("用户名不存在");
|
||||
}
|
||||
pwd=MD5Util.MD5Encode(pwd,"UTF-8");
|
||||
|
||||
if(!pwd.equals(adminUser.password)){
|
||||
throw new LogicException("密码错误");
|
||||
}
|
||||
adminUser.password="";
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
map.put("id",adminUser.id);
|
||||
map.put("tel",adminUser.tel);
|
||||
map.put("nickname",adminUser.nickname);
|
||||
map.put("name",adminUser.name);
|
||||
map.put("rid",adminUser.rid);
|
||||
Role role=roleMapper.selectByPrimaryKey(adminUser.rid);
|
||||
map.put("rname",role.name);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public int updatePwd(int id,String oldpwd,String newpwd,String newpwd2){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
AdminUser admin=adminMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(admin==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(oldpwd==null||oldpwd.trim().equals("")){
|
||||
throw new LogicException("请输入旧密码");
|
||||
}
|
||||
|
||||
oldpwd=MD5Util.MD5Encode(oldpwd,"UTF-8");
|
||||
|
||||
if(!oldpwd.equals(admin.password)){
|
||||
throw new LogicException("旧密码错误");
|
||||
}
|
||||
|
||||
if(newpwd==null||newpwd.trim().equals("")){
|
||||
throw new LogicException("请输入新密码");
|
||||
}
|
||||
|
||||
if(newpwd.trim().length()<6||newpwd.trim().length()>30){
|
||||
throw new LogicException("密码长度为6-30");
|
||||
}
|
||||
|
||||
if(newpwd2==null||newpwd2.trim().equals("")){
|
||||
throw new LogicException("请输入确认密码");
|
||||
}
|
||||
|
||||
if(!newpwd.trim().equals(newpwd2.trim())){
|
||||
throw new LogicException("两次密码不一致,请重新输入");
|
||||
}
|
||||
|
||||
admin.password=MD5Util.MD5Encode(newpwd.trim(),"UTF-8");
|
||||
|
||||
return adminMapper.updateByPrimaryKey(admin);
|
||||
}
|
||||
}
|
||||
190
src/main/java/com/guahao/api/admin/service/MenuService.java
Normal file
190
src/main/java/com/guahao/api/admin/service/MenuService.java
Normal file
@@ -0,0 +1,190 @@
|
||||
package com.guahao.api.admin.service;
|
||||
|
||||
import com.guahao.api.admin.mapper.MenuMapper;
|
||||
import com.guahao.api.admin.model.Menu;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class MenuService extends BaseService<Menu> {
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
public int add(Menu menu){
|
||||
|
||||
if(menu.name==null||menu.name.trim().equals("")){
|
||||
throw new LogicException("请填写菜单名称");
|
||||
}
|
||||
|
||||
if(menu.url==null||menu.url.trim().equals("")){
|
||||
throw new LogicException("请填写跳转地址");
|
||||
}
|
||||
|
||||
Example example=new Example(Menu.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",menu.getName());
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<Menu> list=menuMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该菜单已存在");
|
||||
}
|
||||
|
||||
if(menu.pid<0){
|
||||
menu.pid=0;
|
||||
}
|
||||
|
||||
menu.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
return menuMapper.insert(menu);
|
||||
}
|
||||
|
||||
|
||||
public int update(Menu menu){
|
||||
|
||||
if(menu.id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(menu.name==null||menu.name.trim().equals("")){
|
||||
throw new LogicException("请填写菜单名称");
|
||||
}
|
||||
|
||||
if(menu.url==null||menu.url.trim().equals("")){
|
||||
throw new LogicException("请填写跳转地址");
|
||||
}
|
||||
|
||||
Menu m=menuMapper.selectByPrimaryKey(menu.getId());
|
||||
if(m==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Example e=new Example(Menu.class);
|
||||
Example.Criteria c=e.createCriteria();
|
||||
c.andEqualTo("name",menu.getName());
|
||||
c.andNotEqualTo("id",menu.id);
|
||||
c.andNotEqualTo("flag",1);
|
||||
|
||||
List<Menu> l=menuMapper.selectByExample(e);
|
||||
if(l!=null&&l.size()>0){
|
||||
throw new LogicException("该菜单已存在");
|
||||
}
|
||||
|
||||
if(!m.url.equals(menu.url)&&!menu.equals("#")){
|
||||
|
||||
Example example=new Example(Menu.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("pid",m.id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<Menu> list=menuMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("请删除该菜单下的二级菜单");
|
||||
}
|
||||
}
|
||||
menu.flag=0;
|
||||
menu.ctime=m.ctime;
|
||||
|
||||
return menuMapper.updateByPrimaryKey(menu);
|
||||
}
|
||||
|
||||
public int del(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Menu m=menuMapper.selectByPrimaryKey(id);
|
||||
if(m==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
m.flag=1;
|
||||
return menuMapper.updateByPrimaryKey(m);
|
||||
}
|
||||
|
||||
|
||||
public List<Menu> getMenuByPid(int id){
|
||||
|
||||
if(id<0){
|
||||
id=0;
|
||||
}
|
||||
Example example=new Example(Menu.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("pid",id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
example.orderBy(" id ");
|
||||
|
||||
List<Menu> list=menuMapper.selectByExample(example);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getMenuAll(int id){
|
||||
|
||||
if(id<0){
|
||||
id=0;
|
||||
}
|
||||
List<Map<String,Object>> list=menuMapper.selAllByRole(id);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public int paixu(int qid,int hid){
|
||||
|
||||
if(qid<=0||hid<=0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Menu qMenu=menuMapper.selectByPrimaryKey(qid);
|
||||
if(qMenu==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
Menu hMenu=menuMapper.selectByPrimaryKey(hid);
|
||||
if(hMenu==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
menuMapper.delete(qMenu);
|
||||
menuMapper.delete(hMenu);
|
||||
|
||||
int id=hMenu.id;
|
||||
hMenu.id=qMenu.id;
|
||||
qMenu.id=id;
|
||||
menuMapper.insert(hMenu);
|
||||
menuMapper.insert(qMenu);
|
||||
|
||||
Example example=new Example(Menu.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("pid",hMenu.id);
|
||||
criteria.orEqualTo("pid",qMenu.id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
List<Menu> list=menuMapper.selectByExample(example);
|
||||
|
||||
for(Menu m:list){
|
||||
if(m.pid==hMenu.id){
|
||||
m.pid=qMenu.id;
|
||||
}else{
|
||||
m.pid=hMenu.id;
|
||||
}
|
||||
menuMapper.updateByPrimaryKey(m);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
200
src/main/java/com/guahao/api/admin/service/RoleService.java
Normal file
200
src/main/java/com/guahao/api/admin/service/RoleService.java
Normal file
@@ -0,0 +1,200 @@
|
||||
package com.guahao.api.admin.service;
|
||||
|
||||
import com.guahao.api.admin.mapper.RoleAndMenuMapper;
|
||||
import com.guahao.api.admin.mapper.RoleMapper;
|
||||
import com.guahao.api.admin.model.Menu;
|
||||
import com.guahao.api.admin.model.Role;
|
||||
import com.guahao.api.admin.model.RoleAndMenu;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class RoleService extends BaseService<Role> {
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
private RoleAndMenuMapper roleAndMenuMapper;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Transactional
|
||||
public int add(String name,String menu){
|
||||
|
||||
if(name==null||name.trim().equals("")){
|
||||
throw new LogicException("请填写权限名称");
|
||||
}
|
||||
|
||||
Example example=new Example(Role.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",name);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<Role> list=roleMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该权限已存在");
|
||||
}
|
||||
|
||||
Role role=new Role();
|
||||
role.name=name;
|
||||
role.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
roleMapper.insert(role);
|
||||
|
||||
role=roleMapper.selectByExample(example).get(0);
|
||||
|
||||
String[] ms=menu.split(",");
|
||||
|
||||
for(String id:ms){
|
||||
RoleAndMenu ram=new RoleAndMenu();
|
||||
ram.rid=role.id;
|
||||
ram.mid=Integer.valueOf(id);
|
||||
roleAndMenuMapper.insert(ram);
|
||||
}
|
||||
|
||||
return role.id;
|
||||
}
|
||||
|
||||
|
||||
public int update(int id,String name,String menu){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(name==null||name.trim().equals("")){
|
||||
throw new LogicException("请填写权限名称");
|
||||
}
|
||||
|
||||
Role role=roleMapper.selectByPrimaryKey(id);
|
||||
if(role==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Example e=new Example(Role.class);
|
||||
Example.Criteria c=e.createCriteria();
|
||||
c.andEqualTo("name",name);
|
||||
c.andNotEqualTo("id",role.id);
|
||||
c.andNotEqualTo("flag",1);
|
||||
|
||||
List<Role> l=roleMapper.selectByExample(e);
|
||||
if(l!=null&&l.size()>0){
|
||||
throw new LogicException("该权限已存在");
|
||||
}
|
||||
|
||||
role.name=name;
|
||||
roleMapper.updateByPrimaryKey(role);
|
||||
|
||||
Example example=new Example(RoleAndMenu.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("rid",id);
|
||||
|
||||
List<RoleAndMenu> list=roleAndMenuMapper.selectByExample(example);
|
||||
|
||||
for(RoleAndMenu ram:list){
|
||||
roleAndMenuMapper.delete(ram);
|
||||
}
|
||||
|
||||
String[] ms=menu.split(",");
|
||||
|
||||
for(String mid:ms){
|
||||
RoleAndMenu ram=new RoleAndMenu();
|
||||
ram.rid=role.id;
|
||||
ram.mid=Integer.valueOf(mid);
|
||||
roleAndMenuMapper.insert(ram);
|
||||
}
|
||||
|
||||
return role.id;
|
||||
}
|
||||
|
||||
public int del(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Role role=roleMapper.selectByPrimaryKey(id);
|
||||
if(role==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
role.flag=1;
|
||||
return roleMapper.updateByPrimaryKey(role);
|
||||
}
|
||||
|
||||
public Map<String,Object> getinfo(int id)throws Exception {
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Role role=roleMapper.selectByPrimaryKey(id);
|
||||
if(role==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
Map<String,Object> m=new HashMap<>();
|
||||
m.put("id",role.id);
|
||||
m.put("name",role.name);
|
||||
|
||||
List<Map<String,Object>> rmenu = menuService.getMenuAll(role.id);
|
||||
|
||||
List<Map<String,Object>> list=menuService.getMenuAll(0);
|
||||
for(int i=0;i<list.size();i++){
|
||||
for(int x=0;x<rmenu.size();x++){
|
||||
if(list.get(i).get("id").equals(rmenu.get(x).get("id"))){
|
||||
list.get(i).put("select",1);
|
||||
|
||||
List<Map<String,Object>> ac= (List<Map<String, Object>>) list.get(i).get("childrens");
|
||||
List<Map<String,Object>> rc= (List<Map<String, Object>>) rmenu.get(x).get("childrens");
|
||||
|
||||
if(ac!=null&&ac.size()>0&&Integer.valueOf(ac.get(0).get("id").toString())!=0&&
|
||||
rc!=null&&rc.size()>0&&Integer.valueOf(rc.get(0).get("id").toString())!=0){
|
||||
|
||||
for(int j=0;j<ac.size();j++){
|
||||
for(int s=0;s<rc.size();s++){
|
||||
rc.get(s);
|
||||
if(ac.get(j).get("id").equals(rc.get(s).get("id"))){
|
||||
ac.get(j).put("select",1);
|
||||
rc.remove(rc.get(s));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
rmenu.remove(rmenu.get(x));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
m.put("menu",list);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
public List<Role> getAll(){
|
||||
|
||||
Example example=new Example(Role.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
example.orderBy(" id ");
|
||||
List<Role> list=roleMapper.selectByExample(example);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
143
src/main/java/com/guahao/api/app/controller/AppController.java
Normal file
143
src/main/java/com/guahao/api/app/controller/AppController.java
Normal file
@@ -0,0 +1,143 @@
|
||||
package com.guahao.api.app.controller;
|
||||
|
||||
|
||||
import com.guahao.api.app.service.AppService;
|
||||
import com.guahao.api.app.vo.CardInfo;
|
||||
import com.guahao.api.app.vo.ReserveInfo;
|
||||
import com.guahao.api.app.vo.UserInfo;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
public class AppController {
|
||||
private Logger log = LoggerFactory.getLogger(AppController.class);
|
||||
|
||||
@Autowired
|
||||
private AppService appService;
|
||||
|
||||
/**
|
||||
* 用户分页查询
|
||||
*/
|
||||
@RequestMapping(value = "/getUserList", method = RequestMethod.POST)
|
||||
public Object getUserList(@RequestParam("page") int page, @RequestParam("pagesize") int pagesize, @RequestParam("name") String name) {
|
||||
try {
|
||||
List<UserInfo> list = appService.getUserList(page, pagesize, name);
|
||||
return new PageBean<UserInfo>(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户详情
|
||||
*/
|
||||
@RequestMapping(value = "/queryUserInfoDetails", method = RequestMethod.POST)
|
||||
public Object queryUserInfoDetails(Integer userId) {
|
||||
try {
|
||||
UserInfo resultUserInfo = appService.queryUserInfoDetails(userId);
|
||||
return ResponseResult.success(resultUserInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户
|
||||
*/
|
||||
@RequestMapping(value = "/addAndUpdateUserInfo", method = RequestMethod.POST)
|
||||
public Object addAndUpdateUserInfo(UserInfo info) {
|
||||
try {
|
||||
int resultInt = appService.addAndUpdateUserInfo(info);
|
||||
return ResponseResult.success(resultInt);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@RequestMapping(value = "/deleteUserInfo", method = RequestMethod.POST)
|
||||
public Object deleteUserInfo(Integer userId) {
|
||||
try {
|
||||
int resultInt = appService.deleteUserInfo(userId);
|
||||
return ResponseResult.success(resultInt);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 就诊卡分页查询
|
||||
*/
|
||||
@RequestMapping(value = "/getUserCardList", method = RequestMethod.POST)
|
||||
public Object getUserCardList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam("name") String name) {
|
||||
try {
|
||||
List<Map<String, Object>> list = appService.getUserCardList(page, pagesize, name);
|
||||
return new PageBean<Map<String, Object>>(list);
|
||||
} catch (Exception e) {
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 就诊卡详情
|
||||
*/
|
||||
@RequestMapping(value = "/getCardDetails", method = RequestMethod.POST)
|
||||
public Object getCardDetails(Integer id) {
|
||||
try {
|
||||
CardInfo cardInfo = appService.getCardDetails(id);
|
||||
return ResponseResult.success(cardInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约分页查询
|
||||
*/
|
||||
@RequestMapping(value = "/getUserReserveInfoList", method = RequestMethod.POST)
|
||||
public Object getUserReserveInfoList(@RequestParam("page") int page, @RequestParam("pagesize") int pagesize,
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("deptName") String deptName,
|
||||
@RequestParam("doctorName") String doctorName) {
|
||||
try {
|
||||
List<ReserveInfo> list = appService.getUserReserveInfoList(page,pagesize,name,deptName,doctorName);
|
||||
return new PageBean<ReserveInfo>(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
/** 预约挂号详情 */
|
||||
@RequestMapping(value = "/getUserReserveInfoDetails", method = RequestMethod.POST)
|
||||
public Object getUserReserveInfoDetails(Integer id) {
|
||||
try {
|
||||
ReserveInfo reserveInfo = appService.getUserReserveInfoDetails(id);
|
||||
return ResponseResult.success(reserveInfo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.guahao.api.app.controller;
|
||||
|
||||
import com.guahao.api.app.service.AppReserveService;
|
||||
import com.guahao.api.app.vo.ReservePresentInfo;
|
||||
import com.guahao.api.app.vo.UserInfo;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/appReserve")
|
||||
public class AppReserveController {
|
||||
private Logger log = LoggerFactory.getLogger(AppController.class);
|
||||
|
||||
@Autowired
|
||||
private AppReserveService appReserveService;
|
||||
|
||||
@RequestMapping(value = "/getReservePresent", method = RequestMethod.POST)
|
||||
public Object getReservePresent(Integer id) {
|
||||
try {
|
||||
ReservePresentInfo list = appReserveService.getReservePresent(id);
|
||||
return ResponseResult.success(list);
|
||||
} catch (Exception e) {
|
||||
log.error("getReservePresent:"+e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/updateReservePresent", method = RequestMethod.POST)
|
||||
public Object updateReservePresent(ReservePresentInfo info) {
|
||||
try {
|
||||
int list = appReserveService.updateReservePresent(info);
|
||||
return ResponseResult.success(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
51
src/main/java/com/guahao/api/app/mapper/AppMapper.java
Normal file
51
src/main/java/com/guahao/api/app/mapper/AppMapper.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.guahao.api.app.mapper;
|
||||
|
||||
import com.guahao.api.admin.model.param.AdminUserParam;
|
||||
import com.guahao.api.app.vo.CardInfo;
|
||||
import com.guahao.api.app.vo.ReserveInfo;
|
||||
import com.guahao.api.app.vo.UserInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface AppMapper {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
List<UserInfo> getUserList(AdminUserParam aup);
|
||||
|
||||
/**
|
||||
* 用户详情
|
||||
*/
|
||||
UserInfo queryUserInfoDetails(Integer uid);
|
||||
|
||||
int addUserInfo(UserInfo userInfo);
|
||||
|
||||
/**
|
||||
* 编辑用户
|
||||
*/
|
||||
int updateUserInfo(UserInfo userInfo);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
int deleteUserInfo(Integer id);
|
||||
|
||||
/**
|
||||
* 就诊卡分页查询
|
||||
*/
|
||||
List<Map<String, Object>> getUserCardList(AdminUserParam aup);
|
||||
|
||||
/** 就诊卡详情 */
|
||||
CardInfo getCardDetails(Integer id);
|
||||
|
||||
/** 预约挂号分页 */
|
||||
List<ReserveInfo> getUserReserveInfoList(AdminUserParam aug);
|
||||
|
||||
/** 预约详情 */
|
||||
ReserveInfo getUserReserveInfoDetails(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.guahao.api.app.mapper;
|
||||
|
||||
import com.guahao.api.app.vo.ReserveInfo;
|
||||
import com.guahao.api.app.vo.ReservePresentInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AppReserveMapper {
|
||||
|
||||
/**
|
||||
* 预约介绍查询
|
||||
*/
|
||||
ReservePresentInfo getReservePresent(Integer id);
|
||||
|
||||
/**
|
||||
* 预约介绍编辑
|
||||
*/
|
||||
int updateReservePresent(ReservePresentInfo info);
|
||||
|
||||
/**
|
||||
* 获取就诊卡总数量
|
||||
* */
|
||||
int getCardCount();
|
||||
|
||||
/**
|
||||
* 分页查询一次获取5位病人id
|
||||
*/
|
||||
List<String> getCardPatientId(Integer pageInt, Integer pageCount);
|
||||
|
||||
|
||||
/**
|
||||
* 根据流水好 编辑 挂号状态
|
||||
*/
|
||||
int updateReserveAppStatus(ReserveInfo vo);
|
||||
|
||||
/**
|
||||
* 根据流水好 编辑 挂号状态
|
||||
*/
|
||||
int insertReservePresent(ReservePresentInfo vo);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.guahao.api.app.service;
|
||||
|
||||
import com.guahao.api.app.mapper.AppReserveMapper;
|
||||
import com.guahao.api.app.vo.ReserveInfo;
|
||||
import com.guahao.api.app.vo.ReservePresentInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AppReserveService {
|
||||
@Autowired
|
||||
private AppReserveMapper appReserveMapper;
|
||||
|
||||
/**
|
||||
* 获取预约介绍
|
||||
*/
|
||||
public ReservePresentInfo getReservePresent(Integer id) throws Exception {
|
||||
ReservePresentInfo info = appReserveMapper.getReservePresent(id);
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改预约介绍
|
||||
*/
|
||||
public int updateReservePresent(ReservePresentInfo info) throws Exception {
|
||||
int i = appReserveMapper.updateReservePresent(info);
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getCardCount() {
|
||||
return appReserveMapper.getCardCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有就诊卡对应病人id
|
||||
*/
|
||||
public List<String> getCardPatientId(Integer pageInt, Integer pageCount) throws Exception {
|
||||
List<String> list = appReserveMapper.getCardPatientId(pageInt,pageCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据his交易流水号 修改 挂号状态
|
||||
*/
|
||||
public int updateReserveAppStatus(ReserveInfo vo) throws Exception {
|
||||
int resultInt = appReserveMapper.updateReserveAppStatus(vo);
|
||||
return resultInt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务失败原因
|
||||
* */
|
||||
public int insertReservePresent(ReservePresentInfo vo) throws Exception {
|
||||
int result = appReserveMapper.insertReservePresent(vo);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
112
src/main/java/com/guahao/api/app/service/AppService.java
Normal file
112
src/main/java/com/guahao/api/app/service/AppService.java
Normal file
@@ -0,0 +1,112 @@
|
||||
package com.guahao.api.app.service;
|
||||
|
||||
import com.guahao.api.admin.model.param.AdminUserParam;
|
||||
import com.guahao.api.app.mapper.AppMapper;
|
||||
import com.guahao.api.app.vo.CardInfo;
|
||||
import com.guahao.api.app.vo.ReserveInfo;
|
||||
import com.guahao.api.app.vo.UserInfo;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.util.MD5Util;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class AppService {
|
||||
|
||||
@Autowired
|
||||
private AppMapper appMapper;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public List<UserInfo> getUserList(int page, int pagesize, String name) throws Exception {
|
||||
|
||||
AdminUserParam aup = new AdminUserParam();
|
||||
aup.setName(name);
|
||||
aup.setPageSize(pagesize);
|
||||
aup.setCurrentPage(page);
|
||||
aup.startPage();
|
||||
aup.orderBy("ctime desc");
|
||||
|
||||
List<UserInfo> list = appMapper.getUserList(aup);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取用户详情
|
||||
*/
|
||||
public UserInfo queryUserInfoDetails(Integer id) throws Exception {
|
||||
if (id == 0) {
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
UserInfo resultUserInfo = appMapper.queryUserInfoDetails(id);
|
||||
if (resultUserInfo == null) {
|
||||
throw new LogicException("此用户不存在!!!");
|
||||
}
|
||||
return resultUserInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑或新增 用户
|
||||
*/
|
||||
public int addAndUpdateUserInfo(UserInfo userInfo) throws Exception {
|
||||
int i = 0;
|
||||
if (userInfo.getUserId() == null) {
|
||||
userInfo.setPassword(MD5Util.MD5Encode(userInfo.getPassword(), "UTF-8"));
|
||||
i = appMapper.addUserInfo(userInfo);
|
||||
} else {
|
||||
i = appMapper.updateUserInfo(userInfo);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
public int deleteUserInfo(Integer id) throws Exception {
|
||||
return appMapper.deleteUserInfo(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 就诊卡分页查询
|
||||
*/
|
||||
public List<Map<String, Object>> getUserCardList(int page, int pagesize, String name) throws Exception {
|
||||
AdminUserParam aup = new AdminUserParam();
|
||||
aup.setName(name);
|
||||
aup.setPageSize(pagesize);
|
||||
aup.setCurrentPage(page);
|
||||
aup.startPage();
|
||||
List<Map<String, Object>> list = appMapper.getUserCardList(aup);
|
||||
return list;
|
||||
}
|
||||
|
||||
/** 就诊卡详情 */
|
||||
public CardInfo getCardDetails(Integer id) {
|
||||
CardInfo cardInfo = appMapper.getCardDetails(id);
|
||||
return cardInfo;
|
||||
}
|
||||
|
||||
/** 预约分页查询 */
|
||||
public List<ReserveInfo> getUserReserveInfoList(int page, int pagesize, String name,String deptName,String doctorName) {
|
||||
AdminUserParam aup = new AdminUserParam();
|
||||
aup.setName(name);
|
||||
aup.setDeptName(deptName);
|
||||
aup.setDoctorName(doctorName);
|
||||
aup.setPageSize(pagesize);
|
||||
aup.setCurrentPage(page);
|
||||
aup.startPage();
|
||||
List<ReserveInfo> list = appMapper.getUserReserveInfoList(aup);
|
||||
return list;
|
||||
}
|
||||
|
||||
/* 预约挂号详情 */
|
||||
public ReserveInfo getUserReserveInfoDetails(Integer id) {
|
||||
ReserveInfo info = appMapper.getUserReserveInfoDetails(id);
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
||||
141
src/main/java/com/guahao/api/app/vo/CardInfo.java
Normal file
141
src/main/java/com/guahao/api/app/vo/CardInfo.java
Normal file
@@ -0,0 +1,141 @@
|
||||
package com.guahao.api.app.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CardInfo implements Serializable {
|
||||
private Integer id;
|
||||
private Integer userId; // 用户id
|
||||
private String name; // 用户姓名
|
||||
private String phone; // 电话
|
||||
private String cardNo; // 卡号
|
||||
private String cardType; // 卡类型
|
||||
private String status; // 卡状态
|
||||
private String totalFee; // 卡余额
|
||||
private String isYes; //是否默认卡
|
||||
private String patientId; // 病人id
|
||||
private String ctime; // 创建时间
|
||||
private String utime; // 修改时间
|
||||
private String token;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getIsYes() {
|
||||
return isYes;
|
||||
}
|
||||
|
||||
public void setIsYes(String isYes) {
|
||||
this.isYes = isYes;
|
||||
}
|
||||
|
||||
public String getCardNo() {
|
||||
return cardNo;
|
||||
}
|
||||
|
||||
public void setCardNo(String cardNo) {
|
||||
this.cardNo = cardNo;
|
||||
}
|
||||
|
||||
public String getCardType() {
|
||||
return cardType;
|
||||
}
|
||||
|
||||
public void setCardType(String cardType) {
|
||||
this.cardType = cardType;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getTotalFee() {
|
||||
return totalFee;
|
||||
}
|
||||
|
||||
public void setTotalFee(String totalFee) {
|
||||
this.totalFee = totalFee;
|
||||
}
|
||||
|
||||
public String getPatientId() {
|
||||
return patientId;
|
||||
}
|
||||
|
||||
public void setPatientId(String patientId) {
|
||||
this.patientId = patientId;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
|
||||
public String getUtime() {
|
||||
return utime;
|
||||
}
|
||||
|
||||
public void setUtime(String utime) {
|
||||
this.utime = utime;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserCardVo{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", name='" + name + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", cardNo='" + cardNo + '\'' +
|
||||
", cardType='" + cardType + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
", totalFee='" + totalFee + '\'' +
|
||||
", isYes=" + isYes +
|
||||
", patientId='" + patientId + '\'' +
|
||||
", ctime='" + ctime + '\'' +
|
||||
", utime='" + utime + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
98
src/main/java/com/guahao/api/app/vo/MessageInfo.java
Normal file
98
src/main/java/com/guahao/api/app/vo/MessageInfo.java
Normal file
@@ -0,0 +1,98 @@
|
||||
package com.guahao.api.app.vo;
|
||||
|
||||
public class MessageInfo {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer type;
|
||||
private String title;
|
||||
private String body;
|
||||
private String isYes;
|
||||
private String ctime;
|
||||
private String token;
|
||||
|
||||
public MessageInfo() {}
|
||||
|
||||
public MessageInfo(Integer userId, Integer type, String title, String body, String isYes) {
|
||||
this.userId = userId;
|
||||
this.type = type;
|
||||
this.title = title;
|
||||
this.isYes = isYes;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getIsYes() {
|
||||
return isYes;
|
||||
}
|
||||
|
||||
public void setIsYes(String isYes) {
|
||||
this.isYes = isYes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MessageCenterVo{" +
|
||||
"id=" + id +
|
||||
", user_id=" + userId +
|
||||
", type=" + type +
|
||||
", title='" + title + '\'' +
|
||||
", body='" + body + '\'' +
|
||||
", ctime='" + ctime + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
315
src/main/java/com/guahao/api/app/vo/ReserveInfo.java
Normal file
315
src/main/java/com/guahao/api/app/vo/ReserveInfo.java
Normal file
@@ -0,0 +1,315 @@
|
||||
package com.guahao.api.app.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 预约挂号
|
||||
*/
|
||||
public class ReserveInfo implements Serializable {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private String appHid; // 号源id
|
||||
private String appIdNo; // 身份证号
|
||||
private String appPatientName; // 就诊人姓名
|
||||
private String appPatientId; // 病人ID
|
||||
private String appDeptCode; // 科室编号
|
||||
private String appDeptName; // 科室名称
|
||||
private String appDoctorCode; // 医生编号
|
||||
private String appDoctorName; // 医生姓名
|
||||
private String appDegDate; // 预约号源日期
|
||||
private String appHbTime; // 号源时段
|
||||
private String appClinicDuration; // 号源午别
|
||||
private String appTradeOrderNo; // 建融智医订单号
|
||||
private String appDiagFee; // 诊疗费
|
||||
private String appPharmacyFee; // 药事费
|
||||
private String appFreeTreatFlag; // 预约费别/挂号费别
|
||||
private String appPayType; // 支付方式
|
||||
private String appSerNo; //发票号
|
||||
private String appVisitNo; // 就诊序号
|
||||
private String appClinicNo; // 门诊号
|
||||
private String appVerifyCode; // 取号验证码
|
||||
private String appHisOrderNo; // HIS交易流水号
|
||||
private String appHisOpeFrator; // HIS操作员
|
||||
private String appFlag; // 允许退号标志 N 不允许 Y 允许
|
||||
private Integer appStatus; // 单据状态 1 已退费 0 正常
|
||||
private Integer appType; // 预约挂号/今日挂号
|
||||
private String ctime; // 提交时间
|
||||
private String utime;
|
||||
private String token;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getAppHid() {
|
||||
return appHid;
|
||||
}
|
||||
|
||||
public void setAppHid(String appHid) {
|
||||
this.appHid = appHid;
|
||||
}
|
||||
|
||||
public String getAppIdNo() {
|
||||
return appIdNo;
|
||||
}
|
||||
|
||||
public void setAppIdNo(String appIdNo) {
|
||||
this.appIdNo = appIdNo;
|
||||
}
|
||||
|
||||
public String getAppPatientName() {
|
||||
return appPatientName;
|
||||
}
|
||||
|
||||
public void setAppPatientName(String appPatientName) {
|
||||
this.appPatientName = appPatientName;
|
||||
}
|
||||
|
||||
public String getAppPatientId() {
|
||||
return appPatientId;
|
||||
}
|
||||
|
||||
public void setAppPatientId(String appPatientId) {
|
||||
this.appPatientId = appPatientId;
|
||||
}
|
||||
|
||||
public String getAppDeptCode() {
|
||||
return appDeptCode;
|
||||
}
|
||||
|
||||
public void setAppDeptCode(String appDeptCode) {
|
||||
this.appDeptCode = appDeptCode;
|
||||
}
|
||||
|
||||
public String getAppDeptName() {
|
||||
return appDeptName;
|
||||
}
|
||||
|
||||
public void setAppDeptName(String appDeptName) {
|
||||
this.appDeptName = appDeptName;
|
||||
}
|
||||
|
||||
public String getAppDoctorCode() {
|
||||
return appDoctorCode;
|
||||
}
|
||||
|
||||
public void setAppDoctorCode(String appDoctorCode) {
|
||||
this.appDoctorCode = appDoctorCode;
|
||||
}
|
||||
|
||||
public String getAppDoctorName() {
|
||||
return appDoctorName;
|
||||
}
|
||||
|
||||
public void setAppDoctorName(String appDoctorName) {
|
||||
this.appDoctorName = appDoctorName;
|
||||
}
|
||||
|
||||
public String getAppDegDate() {
|
||||
return appDegDate;
|
||||
}
|
||||
|
||||
public void setAppDegDate(String appDegDate) {
|
||||
this.appDegDate = appDegDate;
|
||||
}
|
||||
|
||||
public String getAppHbTime() {
|
||||
return appHbTime;
|
||||
}
|
||||
|
||||
public void setAppHbTime(String appHbTime) {
|
||||
this.appHbTime = appHbTime;
|
||||
}
|
||||
|
||||
public String getAppClinicDuration() {
|
||||
return appClinicDuration;
|
||||
}
|
||||
|
||||
public void setAppClinicDuration(String appClinicDuration) {
|
||||
this.appClinicDuration = appClinicDuration;
|
||||
}
|
||||
|
||||
public String getAppTradeOrderNo() {
|
||||
return appTradeOrderNo;
|
||||
}
|
||||
|
||||
public void setAppTradeOrderNo(String appTradeOrderNo) {
|
||||
this.appTradeOrderNo = appTradeOrderNo;
|
||||
}
|
||||
|
||||
public String getAppDiagFee() {
|
||||
return appDiagFee;
|
||||
}
|
||||
|
||||
public void setAppDiagFee(String appDiagFee) {
|
||||
this.appDiagFee = appDiagFee;
|
||||
}
|
||||
|
||||
public String getAppPharmacyFee() {
|
||||
return appPharmacyFee;
|
||||
}
|
||||
|
||||
public void setAppPharmacyFee(String appPharmacyFee) {
|
||||
this.appPharmacyFee = appPharmacyFee;
|
||||
}
|
||||
|
||||
public String getAppFreeTreatFlag() {
|
||||
return appFreeTreatFlag;
|
||||
}
|
||||
|
||||
public void setAppFreeTreatFlag(String appFreeTreatFlag) {
|
||||
this.appFreeTreatFlag = appFreeTreatFlag;
|
||||
}
|
||||
|
||||
public String getAppPayType() {
|
||||
return appPayType;
|
||||
}
|
||||
|
||||
public void setAppPayType(String appPayType) {
|
||||
this.appPayType = appPayType;
|
||||
}
|
||||
|
||||
public String getAppSerNo() {
|
||||
return appSerNo;
|
||||
}
|
||||
|
||||
public void setAppSerNo(String appSerNo) {
|
||||
this.appSerNo = appSerNo;
|
||||
}
|
||||
|
||||
public String getAppVisitNo() {
|
||||
return appVisitNo;
|
||||
}
|
||||
|
||||
public void setAppVisitNo(String appVisitNo) {
|
||||
this.appVisitNo = appVisitNo;
|
||||
}
|
||||
|
||||
public String getAppClinicNo() {
|
||||
return appClinicNo;
|
||||
}
|
||||
|
||||
public void setAppClinicNo(String appClinicNo) {
|
||||
this.appClinicNo = appClinicNo;
|
||||
}
|
||||
|
||||
public String getAppVerifyCode() {
|
||||
return appVerifyCode;
|
||||
}
|
||||
|
||||
public void setAppVerifyCode(String appVerifyCode) {
|
||||
this.appVerifyCode = appVerifyCode;
|
||||
}
|
||||
|
||||
public String getAppHisOrderNo() {
|
||||
return appHisOrderNo;
|
||||
}
|
||||
|
||||
public void setAppHisOrderNo(String appHisOrderNo) {
|
||||
this.appHisOrderNo = appHisOrderNo;
|
||||
}
|
||||
|
||||
public String getAppHisOpeFrator() {
|
||||
return appHisOpeFrator;
|
||||
}
|
||||
|
||||
public void setAppHisOpeFrator(String appHisOpeFrator) {
|
||||
this.appHisOpeFrator = appHisOpeFrator;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
|
||||
public Integer getAppStatus() {
|
||||
return appStatus;
|
||||
}
|
||||
|
||||
public void setAppStatus(Integer appStatus) {
|
||||
this.appStatus = appStatus;
|
||||
}
|
||||
|
||||
public Integer getAppType() {
|
||||
return appType;
|
||||
}
|
||||
|
||||
public void setAppType(Integer appType) {
|
||||
this.appType = appType;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getUtime() {
|
||||
return utime;
|
||||
}
|
||||
|
||||
public void setUtime(String utime) {
|
||||
this.utime = utime;
|
||||
}
|
||||
|
||||
public String getAppFlag() {
|
||||
return appFlag;
|
||||
}
|
||||
|
||||
public void setAppFlag(String appFlag) {
|
||||
this.appFlag = appFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ReserveInfo{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", appHid='" + appHid + '\'' +
|
||||
", appIdNo='" + appIdNo + '\'' +
|
||||
", appPatientName='" + appPatientName + '\'' +
|
||||
", appPatientId='" + appPatientId + '\'' +
|
||||
", appDeptCode='" + appDeptCode + '\'' +
|
||||
", appDeptName='" + appDeptName + '\'' +
|
||||
", appDoctorCode='" + appDoctorCode + '\'' +
|
||||
", appDoctorName='" + appDoctorName + '\'' +
|
||||
", appDegDate='" + appDegDate + '\'' +
|
||||
", appHbTime='" + appHbTime + '\'' +
|
||||
", appClinicDuration='" + appClinicDuration + '\'' +
|
||||
", appTradeOrderNo='" + appTradeOrderNo + '\'' +
|
||||
", appDiagFee='" + appDiagFee + '\'' +
|
||||
", appPharmacyFee='" + appPharmacyFee + '\'' +
|
||||
", appFreeTreatFlag='" + appFreeTreatFlag + '\'' +
|
||||
", appPayType='" + appPayType + '\'' +
|
||||
", appSerNo='" + appSerNo + '\'' +
|
||||
", appVisitNo='" + appVisitNo + '\'' +
|
||||
", appClinicNo='" + appClinicNo + '\'' +
|
||||
", appVerifyCode='" + appVerifyCode + '\'' +
|
||||
", appHisOrderNo='" + appHisOrderNo + '\'' +
|
||||
", appHisOpeFrator='" + appHisOpeFrator + '\'' +
|
||||
", appFlag='" + appFlag + '\'' +
|
||||
", appStatus=" + appStatus +
|
||||
", appType=" + appType +
|
||||
", ctime='" + ctime + '\'' +
|
||||
", utime='" + utime + '\'' +
|
||||
", token='" + token + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
42
src/main/java/com/guahao/api/app/vo/ReservePresentInfo.java
Normal file
42
src/main/java/com/guahao/api/app/vo/ReservePresentInfo.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.guahao.api.app.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ReservePresentInfo implements Serializable {
|
||||
private Integer id;
|
||||
private String title;
|
||||
private String body;
|
||||
private String ctime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
161
src/main/java/com/guahao/api/app/vo/UserInfo.java
Normal file
161
src/main/java/com/guahao/api/app/vo/UserInfo.java
Normal file
@@ -0,0 +1,161 @@
|
||||
package com.guahao.api.app.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class UserInfo implements Serializable {
|
||||
|
||||
private Integer userId;
|
||||
private String name;
|
||||
private String user;
|
||||
private String password;
|
||||
private String phone;
|
||||
private String idNo;
|
||||
private String email;
|
||||
private String remark;
|
||||
private String headUrl;
|
||||
private String birthDate;
|
||||
private String nativePlace;
|
||||
private String ctime;
|
||||
private String utime;
|
||||
private String token;
|
||||
private Integer role;
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getHeadUrl() {
|
||||
return headUrl;
|
||||
}
|
||||
|
||||
public void setHeadUrl(String headUrl) {
|
||||
this.headUrl = headUrl;
|
||||
}
|
||||
|
||||
public String getBirthDate() {
|
||||
return birthDate;
|
||||
}
|
||||
|
||||
public void setBirthDate(String birthDate) {
|
||||
this.birthDate = birthDate;
|
||||
}
|
||||
|
||||
public String getNativePlace() {
|
||||
return nativePlace;
|
||||
}
|
||||
|
||||
public void setNativePlace(String nativePlace) {
|
||||
this.nativePlace = nativePlace;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
|
||||
public String getUtime() {
|
||||
return utime;
|
||||
}
|
||||
|
||||
public void setUtime(String utime) {
|
||||
this.utime = utime;
|
||||
}
|
||||
|
||||
public String getIdNo() {
|
||||
return idNo;
|
||||
}
|
||||
|
||||
public void setIdNo(String idNo) {
|
||||
this.idNo = idNo;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserVo{" +
|
||||
"userId=" + userId +
|
||||
", name='" + name + '\'' +
|
||||
", user='" + user + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", id_no='" + idNo + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", remark='" + remark + '\'' +
|
||||
", headUrl='" + headUrl + '\'' +
|
||||
", birthDate='" + birthDate + '\'' +
|
||||
", nativePlace='" + nativePlace + '\'' +
|
||||
", ctime='" + ctime + '\'' +
|
||||
", utime='" + utime + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.guahao.api.carousel.controller;
|
||||
|
||||
import com.guahao.api.admin.model.AdminUser;
|
||||
import com.guahao.api.carousel.model.Carousel;
|
||||
import com.guahao.api.carousel.service.CarouselService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/carousel")
|
||||
public class CarouselController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(CarouselController.class);
|
||||
|
||||
@Autowired
|
||||
private CarouselService carouselService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加轮播图
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addCarousel(@RequestBody Carousel carousel){
|
||||
try{
|
||||
int insertId = carouselService.add(carousel);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改轮播图
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestBody Carousel carousel){
|
||||
try{
|
||||
int insertId = carouselService.update(carousel);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除轮播图
|
||||
* @param id 轮播图id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = carouselService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮播图详情
|
||||
* @param id 轮播图id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getinfo",method = RequestMethod.POST)
|
||||
public Object getinfo(@RequestParam("id") int id){
|
||||
try{
|
||||
Carousel carousel = carouselService.getinfo(id);
|
||||
return ResponseResult.success(carousel);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询轮播图
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize){
|
||||
try{
|
||||
List<Map<String,Object>> list = carouselService.getList(page,pagesize,0);
|
||||
return new PageBean<Map<String,Object>>(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.guahao.api.carousel.mapper;
|
||||
|
||||
import com.guahao.api.carousel.model.Carousel;
|
||||
import com.guahao.api.carousel.model.param.CarouselParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface CarouselMapper extends BaseMapper<Carousel> {
|
||||
|
||||
|
||||
List<Map<String,Object>> getAll(CarouselParam carouselParam);
|
||||
}
|
||||
97
src/main/java/com/guahao/api/carousel/model/Carousel.java
Normal file
97
src/main/java/com/guahao/api/carousel/model/Carousel.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package com.guahao.api.carousel.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="hnwj_carousel")
|
||||
@Data
|
||||
public class Carousel implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 轮播图标题
|
||||
*/
|
||||
@Column(name="title")
|
||||
public String title="";
|
||||
|
||||
/**
|
||||
* 轮播图
|
||||
*/
|
||||
@Column(name="img")
|
||||
public String img="";
|
||||
|
||||
/**
|
||||
* 分类(1、首页 2、体检)
|
||||
*/
|
||||
@Column(name="type")
|
||||
public int type=0;
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="deleted")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="create_time")
|
||||
public String ctime="";
|
||||
|
||||
// public int getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(int id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public String getTitle() {
|
||||
// return title;
|
||||
// }
|
||||
//
|
||||
// public void setTitle(String title) {
|
||||
// this.title = title;
|
||||
// }
|
||||
//
|
||||
// public String getImg() {
|
||||
// return img;
|
||||
// }
|
||||
//
|
||||
// public void setImg(String img) {
|
||||
// this.img = img;
|
||||
// }
|
||||
//
|
||||
// public int getFlag() {
|
||||
// return flag;
|
||||
// }
|
||||
//
|
||||
// public void setFlag(int flag) {
|
||||
// this.flag = flag;
|
||||
// }
|
||||
//
|
||||
// public String getCtime() {
|
||||
// return ctime;
|
||||
// }
|
||||
//
|
||||
// public void setCtime(String ctime) {
|
||||
// this.ctime = ctime;
|
||||
// }
|
||||
//
|
||||
// public int getType() {
|
||||
// return type;
|
||||
// }
|
||||
//
|
||||
// public void setType(int type) {
|
||||
// this.type = type;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.guahao.api.carousel.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class CarouselParam extends PageParams {
|
||||
|
||||
private int type=0;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.guahao.api.carousel.service;
|
||||
|
||||
import com.guahao.api.carousel.mapper.CarouselMapper;
|
||||
import com.guahao.api.carousel.model.Carousel;
|
||||
import com.guahao.api.carousel.model.param.CarouselParam;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import com.guahao.common.base.PageParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class CarouselService extends BaseService<Carousel> {
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private CarouselMapper carouselMapper;
|
||||
|
||||
public int add(Carousel carousel){
|
||||
|
||||
if(carousel.title==null||carousel.title.trim().equals("")){
|
||||
throw new LogicException("请填写轮播图标题");
|
||||
}
|
||||
|
||||
if(carousel.img==null||carousel.img.trim().equals("")){
|
||||
throw new LogicException("请填加轮播图");
|
||||
}
|
||||
|
||||
carousel.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
return carouselMapper.insert(carousel);
|
||||
}
|
||||
|
||||
|
||||
public int update(Carousel carousel){
|
||||
|
||||
if(carousel.id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(carousel.title==null||carousel.title.trim().equals("")){
|
||||
throw new LogicException("请填写轮播图标题");
|
||||
}
|
||||
|
||||
if(carousel.img==null||carousel.img.trim().equals("")){
|
||||
throw new LogicException("请填加轮播图");
|
||||
}
|
||||
|
||||
Carousel c=carouselMapper.selectByPrimaryKey(carousel.id);
|
||||
if(c==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
carousel.flag=0;
|
||||
carousel.ctime=c.ctime;
|
||||
|
||||
return carouselMapper.updateByPrimaryKey(carousel);
|
||||
}
|
||||
|
||||
public int del(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Carousel c=carouselMapper.selectByPrimaryKey(id);
|
||||
if(c==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
c.flag=1;
|
||||
return carouselMapper.updateByPrimaryKey(c);
|
||||
}
|
||||
|
||||
public Carousel getinfo(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Carousel c=carouselMapper.selectByPrimaryKey(id);
|
||||
if(c==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> getList(int page,int pagesize,int type){
|
||||
|
||||
|
||||
if(page<=0){
|
||||
page=1;
|
||||
}
|
||||
if(pagesize<=0){
|
||||
pagesize=10;
|
||||
}
|
||||
CarouselParam param=new CarouselParam();
|
||||
param.setCurrentPage(page);
|
||||
param.setPageSize(pagesize);
|
||||
param.setType(type);
|
||||
|
||||
param.startPage();
|
||||
param.orderBy(" create_time desc ");
|
||||
|
||||
List<Map<String,Object>> list=carouselMapper.getAll(param);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.guahao.api.charge.controller;
|
||||
|
||||
|
||||
import com.guahao.api.charge.model.Charge;
|
||||
import com.guahao.api.charge.service.ChargeService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/charge")
|
||||
public class ChargeController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(ChargeController.class);
|
||||
|
||||
@Autowired
|
||||
private ChargeService chargeService;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加收费项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addMedicine(@RequestBody Charge charge){
|
||||
try{
|
||||
int insertId = chargeService.add(charge);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收费项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestBody Charge charge){
|
||||
try{
|
||||
int insertId = chargeService.update(charge);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收费项目
|
||||
* @param id 项目id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = chargeService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询收费项目详情
|
||||
* @param id 项目id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getinfo",method = RequestMethod.POST)
|
||||
public Object getinfo(@RequestParam("id") int id){
|
||||
try{
|
||||
Map<String,Object> medicine = chargeService.getinfo(id);
|
||||
return ResponseResult.success(medicine);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询收费项目
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam(value="type",required = false)Integer type,
|
||||
@RequestParam(value="name",required = false)String name){
|
||||
try{
|
||||
type=type==null?0:type;
|
||||
List<Map<String,Object>> list = chargeService.getList(page,pagesize,type,name);
|
||||
return new PageBean<Map<String,Object>>(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.guahao.api.charge.controller;
|
||||
|
||||
import com.guahao.api.charge.service.ChargeTypeService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/charge/type")
|
||||
public class ChargeTypeController {
|
||||
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(ChargeTypeController.class);
|
||||
|
||||
@Autowired
|
||||
private ChargeTypeService chargeTypeService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加科室分类
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addType(@RequestParam("name")String name){
|
||||
try{
|
||||
int insertId = chargeTypeService.add(name);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestParam("id")int id,@RequestParam("name")String name){
|
||||
try{
|
||||
int insertId = chargeTypeService.update(id,name);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分类
|
||||
* @param id 分类id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = chargeTypeService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询分类
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam(value="name",required = false)String name){
|
||||
try{
|
||||
List<Map<String,Object>> list = chargeTypeService.getList(page,pagesize,name);
|
||||
return new PageBean<Map<String,Object>>(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
15
src/main/java/com/guahao/api/charge/mapper/ChargeMapper.java
Normal file
15
src/main/java/com/guahao/api/charge/mapper/ChargeMapper.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.guahao.api.charge.mapper;
|
||||
|
||||
import com.guahao.api.charge.model.Charge;
|
||||
import com.guahao.api.charge.model.param.ChargeParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface ChargeMapper extends BaseMapper<Charge> {
|
||||
|
||||
List<Map<String,Object>> getAll(ChargeParam param);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.guahao.api.charge.mapper;
|
||||
|
||||
import com.guahao.api.charge.model.ChargeType;
|
||||
import com.guahao.api.charge.model.param.ChargeTypeParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface ChargeTypeMapper extends BaseMapper<ChargeType> {
|
||||
|
||||
|
||||
List<Map<String,Object>> getAll(ChargeTypeParam param);
|
||||
}
|
||||
136
src/main/java/com/guahao/api/charge/model/Charge.java
Normal file
136
src/main/java/com/guahao/api/charge/model/Charge.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.guahao.api.charge.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="charge")
|
||||
public class Charge implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 项目价格
|
||||
*/
|
||||
@Column(name="price")
|
||||
public Double price=0.0;
|
||||
|
||||
/**
|
||||
* 注意事项
|
||||
*/
|
||||
@Column(name="matter")
|
||||
public String matter="";
|
||||
|
||||
/**
|
||||
* 项目说明
|
||||
*/
|
||||
@Column(name="`explain`")
|
||||
public String explain="";
|
||||
|
||||
/**
|
||||
* 费用明细
|
||||
*/
|
||||
@Column(name="detail")
|
||||
public String detail="";
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Column(name="tid")
|
||||
public int tid;
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime="";
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getMatter() {
|
||||
return matter;
|
||||
}
|
||||
|
||||
public void setMatter(String matter) {
|
||||
this.matter = matter;
|
||||
}
|
||||
|
||||
public String getExplain() {
|
||||
return explain;
|
||||
}
|
||||
|
||||
public void setExplain(String explain) {
|
||||
this.explain = explain;
|
||||
}
|
||||
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
|
||||
public void setDetail(String detail) {
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
|
||||
public int getTid() {
|
||||
return tid;
|
||||
}
|
||||
|
||||
public void setTid(int tid) {
|
||||
this.tid = tid;
|
||||
}
|
||||
}
|
||||
66
src/main/java/com/guahao/api/charge/model/ChargeType.java
Normal file
66
src/main/java/com/guahao/api/charge/model/ChargeType.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.guahao.api.charge.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="charge_type")
|
||||
public class ChargeType implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime="";
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.guahao.api.charge.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class ChargeParam extends PageParams {
|
||||
|
||||
public ChargeParam(){}
|
||||
public ChargeParam(int page,int pagesize,int type,String name){
|
||||
this.currentPage=page;
|
||||
this.pageSize=pagesize;
|
||||
this.type=type;
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
|
||||
private int type;
|
||||
|
||||
private String name;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.guahao.api.charge.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class ChargeTypeParam extends PageParams {
|
||||
|
||||
public ChargeTypeParam(){}
|
||||
|
||||
public ChargeTypeParam(int page,int pagesize,String name){
|
||||
this.currentPage=page;
|
||||
this.pageSize=pagesize;
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
173
src/main/java/com/guahao/api/charge/service/ChargeService.java
Normal file
173
src/main/java/com/guahao/api/charge/service/ChargeService.java
Normal file
@@ -0,0 +1,173 @@
|
||||
package com.guahao.api.charge.service;
|
||||
|
||||
import com.guahao.api.charge.mapper.ChargeMapper;
|
||||
import com.guahao.api.charge.mapper.ChargeTypeMapper;
|
||||
import com.guahao.api.charge.model.Charge;
|
||||
import com.guahao.api.charge.model.ChargeType;
|
||||
import com.guahao.api.charge.model.param.ChargeParam;
|
||||
import com.guahao.api.medicine.model.param.MedicineParam;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ChargeService extends BaseService<Charge> {
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ChargeMapper chargeMapper;
|
||||
|
||||
@Autowired
|
||||
private ChargeTypeMapper chargeTypeMapper;
|
||||
|
||||
|
||||
public int add(Charge charge){
|
||||
|
||||
if(charge.name==null||charge.name.trim().equals("")){
|
||||
throw new LogicException("请填写名称");
|
||||
}
|
||||
|
||||
if(charge.price==null||charge.price==0){
|
||||
throw new LogicException("请填写项目价格");
|
||||
}
|
||||
|
||||
if(charge.tid<=0){
|
||||
throw new LogicException("请选择分类");
|
||||
}
|
||||
|
||||
Example example=new Example(Charge.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",charge.name);
|
||||
criteria.andEqualTo("tid",charge.tid);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<Charge> list=chargeMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该项目已存在");
|
||||
}
|
||||
|
||||
charge.explain=charge.explain==null?"":charge.explain;
|
||||
charge.detail=charge.detail==null?"":charge.detail;
|
||||
charge.matter=charge.matter==null?"":charge.matter;
|
||||
|
||||
charge.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
return chargeMapper.insert(charge);
|
||||
}
|
||||
|
||||
public int update(Charge charge){
|
||||
|
||||
if(charge.id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Charge c=chargeMapper.selectByPrimaryKey(charge.id);
|
||||
|
||||
if(c==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(charge.price==null||charge.price==0){
|
||||
throw new LogicException("请填写项目价格");
|
||||
}
|
||||
|
||||
if(charge.tid<=0){
|
||||
throw new LogicException("请选择分类");
|
||||
}
|
||||
|
||||
Example example=new Example(Charge.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",charge.name);
|
||||
criteria.andEqualTo("tid",charge.tid);
|
||||
criteria.andNotEqualTo("id",charge.id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<Charge> list=chargeMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该项目已存在");
|
||||
}
|
||||
|
||||
charge.explain=charge.explain==null?"":charge.explain;
|
||||
charge.detail=charge.detail==null?"":charge.detail;
|
||||
charge.matter=charge.matter==null?"":charge.matter;
|
||||
charge.ctime=c.ctime;
|
||||
|
||||
return chargeMapper.updateByPrimaryKey(charge);
|
||||
}
|
||||
|
||||
|
||||
public int del(int id){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Charge c=chargeMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(c==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(c.flag==1){
|
||||
return 1;
|
||||
}
|
||||
|
||||
c.flag=1;
|
||||
|
||||
return chargeMapper.updateByPrimaryKey(c);
|
||||
}
|
||||
|
||||
|
||||
public Map<String,Object> getinfo(int id){
|
||||
|
||||
if(id<=0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Charge c=chargeMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(c==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
map.put("id",c.id);
|
||||
map.put("name",c.name);
|
||||
map.put("matter",c.matter);
|
||||
map.put("detail",c.detail);
|
||||
map.put("explain",c.explain);
|
||||
map.put("price",c.price);
|
||||
map.put("ctime",c.ctime);
|
||||
map.put("tid",c.tid);
|
||||
|
||||
ChargeType ct=chargeTypeMapper.selectByPrimaryKey(c.tid);
|
||||
map.put("tname",ct.name);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getList(int page, int pagesize,int type, String name){
|
||||
|
||||
ChargeParam param=new ChargeParam(page,pagesize,type,name);
|
||||
|
||||
param.startPage();
|
||||
param.orderBy(" c.ctime desc ");
|
||||
|
||||
List<Map<String,Object>> list=chargeMapper.getAll(param);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.guahao.api.charge.service;
|
||||
|
||||
import com.guahao.api.charge.mapper.ChargeTypeMapper;
|
||||
import com.guahao.api.charge.model.ChargeType;
|
||||
import com.guahao.api.charge.model.param.ChargeTypeParam;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ChargeTypeService extends BaseService<ChargeType> {
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ChargeTypeMapper chargeTypeMapper;
|
||||
|
||||
public int add(String name){
|
||||
|
||||
if(name==null||name.trim().equals("")){
|
||||
throw new LogicException("请填写名称");
|
||||
}
|
||||
|
||||
Example example=new Example(ChargeType.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",name);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<ChargeType> list=chargeTypeMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该分类已存在");
|
||||
}
|
||||
|
||||
ChargeType ct=new ChargeType();
|
||||
ct.name=name;
|
||||
ct.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
return chargeTypeMapper.insert(ct);
|
||||
}
|
||||
|
||||
public int update(int id,String name){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(name==null||name.trim().equals("")){
|
||||
throw new LogicException("请填写名称");
|
||||
}
|
||||
|
||||
ChargeType ct=chargeTypeMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(ct==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Example example=new Example(ChargeType.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",name);
|
||||
criteria.andNotEqualTo("id",id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<ChargeType> list=chargeTypeMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该分类已存在");
|
||||
}
|
||||
if(ct.name.equals(name.trim())){
|
||||
return 1;
|
||||
}
|
||||
ct.name=name;
|
||||
|
||||
return chargeTypeMapper.updateByPrimaryKey(ct);
|
||||
}
|
||||
|
||||
|
||||
public int del(int id){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
ChargeType ct=chargeTypeMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(ct==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(ct.flag==1){
|
||||
return 1;
|
||||
}
|
||||
|
||||
ct.flag=1;
|
||||
|
||||
return chargeTypeMapper.updateByPrimaryKey(ct);
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getList(int page, int pagesize, String name){
|
||||
|
||||
ChargeTypeParam param=new ChargeTypeParam(page,pagesize,name);
|
||||
|
||||
param.startPage();
|
||||
param.orderBy(" ct.ctime desc ");
|
||||
|
||||
List<Map<String,Object>> list=chargeTypeMapper.getAll(param);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.guahao.api.concern.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.guahao.WebLog;
|
||||
import com.guahao.api.concern.model.Concern;
|
||||
import com.guahao.api.concern.service.ConcernService;
|
||||
import com.guahao.api.medicine.service.MedicineDoctorService;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import com.guahao.h5.reserve.vo.Reserve8Vo;
|
||||
import com.guahao.h5.token.service.TokenService;
|
||||
import com.guahao.h5.token.vo.TokenVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/5
|
||||
* @description:我的关注
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/concern")
|
||||
public class ConcernController {
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private ConcernService concernService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private MedicineDoctorService doctorService;
|
||||
|
||||
// 添加关注
|
||||
@RequestMapping(value = "/addConcern", method = RequestMethod.POST)
|
||||
@WebLog(description = "addConcern")
|
||||
public Object addConcern(Integer userId, String token, String patientId) {
|
||||
log.info("打印获取的数据" + patientId);
|
||||
try {
|
||||
int retToken = 0;
|
||||
try {
|
||||
retToken = getUserToken(userId, token);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (retToken != 0) {
|
||||
HashMap<Object, Object> insMap = new HashMap<>();
|
||||
insMap.put("user_id", userId);
|
||||
insMap.put("patient_id", patientId);
|
||||
int i = concernService.addConcern(insMap);
|
||||
log.info("i is :" + i);
|
||||
if (i > 0) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.failure(ErrorCode.FAILED_SUBSCRIPTION_ADD);
|
||||
}
|
||||
} else {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("打印错误信息" + e.getMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 取消关注
|
||||
@RequestMapping(value = "/cancelConcern", method = RequestMethod.POST)
|
||||
@WebLog(description = "cancelConcern")
|
||||
public Object cancelConcern(Integer userId, String token, String patientId) {
|
||||
|
||||
|
||||
try {
|
||||
int retToken = getUserToken(userId, token);
|
||||
if (retToken != 0) {
|
||||
String user_id = Integer.toString(userId);
|
||||
Concern concern = new Concern();
|
||||
concern.setPatient_id(patientId);
|
||||
concern.setUser_id(user_id);
|
||||
int i = concernService.cancelConcern(concern);
|
||||
if (i > 0) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.failure(ErrorCode.FAILED_SUBSCRIPTION_ADD);
|
||||
}
|
||||
} else {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 查询关注
|
||||
@RequestMapping(value = "/queryConcern", method = RequestMethod.POST)
|
||||
@WebLog(description = "queryConcern")
|
||||
public Object queryConcern(Integer userId, String token) {
|
||||
|
||||
try {
|
||||
int retToken = getUserToken(userId, token);
|
||||
if (retToken != 0) {
|
||||
String user_id = Integer.toString(userId);
|
||||
List<String> patientIds = concernService.queryAllByParam(user_id);
|
||||
// List<String> collect = concernList.stream().map(Concern::getPatient_id).collect(Collectors.toList());
|
||||
return ResponseResult.success(patientIds);
|
||||
} else {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 查询关注详情
|
||||
@RequestMapping(value = "/queryConcernPatient", method = RequestMethod.POST)
|
||||
@WebLog(description = "queryConcernPatient")
|
||||
public Object queryConcernPatient(Integer userId, String token) {
|
||||
|
||||
try {
|
||||
int retToken = getUserToken(userId, token);
|
||||
if (retToken != 0) {
|
||||
String user_id = Integer.toString(userId);
|
||||
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
result = concernService.queryAllDataByParam(user_id);
|
||||
return ResponseResult.success(result);
|
||||
} else {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private int getUserToken(Integer userId, String token) throws Exception {
|
||||
TokenVo tokenVo = new TokenVo(userId, token);
|
||||
int result = tokenService.getUserToken(tokenVo);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// @RequestMapping(value = "testDb2GetData", method = RequestMethod.GET)
|
||||
// public Object testDb2GetData() {
|
||||
//
|
||||
//
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.guahao.api.concern.mapper;
|
||||
|
||||
import com.guahao.api.concern.model.Concern;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/5
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface ConcernMapper extends BaseMapper<Concern> {
|
||||
int updateActive(Concern concern);
|
||||
|
||||
List<String> selectAllByParam(@Param("userId") String userId);
|
||||
List<Map<String, Object>> selectAllDataByParam(@Param("userId") String userId);
|
||||
|
||||
int addConcern(HashMap<Object, Object> insMap);
|
||||
|
||||
// int addConcern(Concern concern);
|
||||
}
|
||||
30
src/main/java/com/guahao/api/concern/model/Concern.java
Normal file
30
src/main/java/com/guahao/api/concern/model/Concern.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.guahao.api.concern.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/5
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Concern {
|
||||
|
||||
|
||||
private String id;
|
||||
private String user_id;
|
||||
private String patient_id;
|
||||
|
||||
private String ctime;
|
||||
|
||||
private String utime;
|
||||
private String isdelete;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.guahao.api.concern.service;
|
||||
|
||||
import com.guahao.api.concern.mapper.ConcernMapper;
|
||||
import com.guahao.api.concern.model.Concern;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/5
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ConcernService extends BaseService<Concern> {
|
||||
|
||||
@Autowired
|
||||
private ConcernMapper concernMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// public int addConcern(Concern concern) {
|
||||
//
|
||||
// return concernMapper.addConcern(concern);
|
||||
// }
|
||||
|
||||
public int cancelConcern(Concern concern) {
|
||||
|
||||
return concernMapper.updateActive(concern);
|
||||
}
|
||||
|
||||
public List<String> queryAllByParam(String userId) {
|
||||
|
||||
return concernMapper.selectAllByParam(userId);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> queryAllDataByParam(String userId) {
|
||||
|
||||
return concernMapper.selectAllDataByParam(userId);
|
||||
}
|
||||
|
||||
public int addConcern(HashMap<Object, Object> insMap) {
|
||||
|
||||
log.info("打印传参insMap:" + insMap);
|
||||
return concernMapper.addConcern(insMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.guahao.api.counts.mapper;
|
||||
|
||||
import com.guahao.api.counts.model.InterfaceCount;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/7/24
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface InterfaceCountMapper extends BaseMapper<InterfaceCount> {
|
||||
InterfaceCount selectByUserId(String userId);
|
||||
|
||||
void insertOne(InterfaceCount interfaceCount);
|
||||
|
||||
void updateByUserId(InterfaceCount interfaceCount);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.guahao.api.counts.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/7/24
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InterfaceCount {
|
||||
|
||||
private String userId;
|
||||
//接口标识
|
||||
private String interfaceIdentification;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.guahao.api.counts.service;
|
||||
|
||||
import com.guahao.api.counts.mapper.InterfaceCountMapper;
|
||||
import com.guahao.api.counts.model.InterfaceCount;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/7/24
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class InterfaceCountService extends BaseService<InterfaceCount> {
|
||||
@Autowired
|
||||
private InterfaceCountMapper interfaceCountMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void updateInterfaceConut(InterfaceCount interfaceCount) {
|
||||
|
||||
//开始插入数据
|
||||
interfaceCountMapper.insertOne(interfaceCount);
|
||||
}
|
||||
}
|
||||
45
src/main/java/com/guahao/api/file/FileController.java
Normal file
45
src/main/java/com/guahao/api/file/FileController.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.guahao.api.file;
|
||||
|
||||
import com.guahao.common.util.FileUtil;
|
||||
import com.guahao.common.util.VeDate;
|
||||
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 javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
public class FileController {
|
||||
|
||||
@RequestMapping("/upload")
|
||||
public Object upload(@RequestParam("file") MultipartFile file, HttpServletRequest request){
|
||||
String fileName = VeDate.getNo(4);
|
||||
String wenjianjia="/fileupload/";
|
||||
//设置文件上传路径
|
||||
String filePath = request.getSession().getServletContext().getRealPath(wenjianjia);
|
||||
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
try {
|
||||
FileUtil.uploadFile(file.getBytes(), filePath, fileName);
|
||||
map.put("code",0);
|
||||
map.put("message","成功");
|
||||
Map<String,Object> m=new HashMap<String,Object>();
|
||||
String strBackUrl = "http://" + request.getServerName() //服务器地址
|
||||
+ ":"
|
||||
+ request.getServerPort() //端口号
|
||||
+ request.getContextPath(); //项目名称/
|
||||
m.put("src",strBackUrl+wenjianjia+fileName);
|
||||
map.put("data",m);
|
||||
return map;
|
||||
} catch (Exception e) {
|
||||
map.put("code",400);
|
||||
map.put("message","服务器错误");
|
||||
map.put("data",null);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.guahao.api.guide.controller;
|
||||
|
||||
import com.guahao.api.guide.service.GuideBuildingService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/guide/building")
|
||||
public class GuideBuildingController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(GuideBuildingController.class);
|
||||
|
||||
@Autowired
|
||||
private GuideBuildingService buildingService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加楼号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addType(@RequestParam("name")String name){
|
||||
try{
|
||||
int insertId = buildingService.add(name);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改楼号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestParam("id")int id,@RequestParam("name")String name){
|
||||
try{
|
||||
int insertId = buildingService.update(id,name);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除楼号
|
||||
* @param id 分类id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = buildingService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询楼号
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam(value="name",required = false)String name){
|
||||
try{
|
||||
List<Map<String,Object>> list = buildingService.getList(page,pagesize,name);
|
||||
return new PageBean<Map<String,Object>>(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.guahao.api.guide.controller;
|
||||
|
||||
import com.guahao.api.guide.service.GuideFloorService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/guide/floor")
|
||||
public class GuideFloorController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(GuideFloorController.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private GuideFloorService floorService;
|
||||
/**
|
||||
*
|
||||
* 添加楼层
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addType(@RequestParam("name")String name,@RequestParam("bid")int bid){
|
||||
try{
|
||||
int insertId = floorService.add(name,bid);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改楼层
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestParam("id")int id,@RequestParam("name")String name,@RequestParam("bid")int bid){
|
||||
try{
|
||||
int insertId = floorService.update(id,name,bid);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除楼层
|
||||
* @param id 分类id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = floorService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询楼层
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam("bid") Integer bid,
|
||||
@RequestParam(value="name",required = false)String name){
|
||||
try{
|
||||
if (bid==null){
|
||||
bid=0;
|
||||
}
|
||||
List<Map<String,Object>> list = floorService.getList(page,pagesize,bid,name);
|
||||
return new PageBean<Map<String,Object>>(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.guahao.api.guide.controller;
|
||||
|
||||
|
||||
import com.guahao.api.guide.model.GuideLabel;
|
||||
import com.guahao.api.guide.service.GuideLabelService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/guide/label")
|
||||
public class GuideLabelController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(GuideLabelController.class);
|
||||
|
||||
@Autowired
|
||||
private GuideLabelService labelService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addType(@RequestBody GuideLabel guideLabel){
|
||||
try{
|
||||
int insertId = labelService.add(guideLabel);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestBody GuideLabel guideLabel){
|
||||
try{
|
||||
int insertId = labelService.update(guideLabel);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除标签
|
||||
* @param id 分类id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = labelService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 标签详情
|
||||
* @param id 标签id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getinfo",method = RequestMethod.POST)
|
||||
public Object getinfo(@RequestParam("id") int id){
|
||||
try{
|
||||
Map<String,Object> map = labelService.getinfo(id);
|
||||
return ResponseResult.success(map);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询标签
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam("fid") int fid,
|
||||
@RequestParam(value="name",required = false)String name){
|
||||
try{
|
||||
List<Map<String,Object>> list = labelService.getList(page,pagesize,fid,name);
|
||||
return new PageBean<Map<String,Object>>(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.guahao.api.guide.mapper;
|
||||
|
||||
import com.guahao.api.guide.model.GuideBuilding;
|
||||
import com.guahao.api.guide.model.param.GuideBuildingParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GuideBuildingMapper extends BaseMapper<GuideBuilding> {
|
||||
|
||||
List<Map<String,Object>> getAll(GuideBuildingParam param);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.guahao.api.guide.mapper;
|
||||
|
||||
import com.guahao.api.guide.model.GuideFloor;
|
||||
import com.guahao.api.guide.model.param.GuideFloorParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GuideFloorMapper extends BaseMapper<GuideFloor> {
|
||||
List<Map<String,Object>> getAll(GuideFloorParam param);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.guahao.api.guide.mapper;
|
||||
|
||||
import com.guahao.api.guide.model.GuideLabel;
|
||||
import com.guahao.api.guide.model.param.GuideLabelParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GuideLabelMapper extends BaseMapper<GuideLabel> {
|
||||
List<Map<String,Object>> getAll(GuideLabelParam param);
|
||||
List<Map<String,Object>> getGuide();
|
||||
}
|
||||
66
src/main/java/com/guahao/api/guide/model/GuideBuilding.java
Normal file
66
src/main/java/com/guahao/api/guide/model/GuideBuilding.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.guahao.api.guide.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="guide_building")
|
||||
public class GuideBuilding implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 楼号
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime="";
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
80
src/main/java/com/guahao/api/guide/model/GuideFloor.java
Normal file
80
src/main/java/com/guahao/api/guide/model/GuideFloor.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.guahao.api.guide.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="guide_floor")
|
||||
public class GuideFloor implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 楼id
|
||||
*/
|
||||
@Column(name="bid")
|
||||
public int bid;
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime="";
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getBid() {
|
||||
return bid;
|
||||
}
|
||||
|
||||
public void setBid(int bid) {
|
||||
this.bid = bid;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
94
src/main/java/com/guahao/api/guide/model/GuideLabel.java
Normal file
94
src/main/java/com/guahao/api/guide/model/GuideLabel.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package com.guahao.api.guide.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="guide_label")
|
||||
public class GuideLabel implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 标签详情
|
||||
*/
|
||||
@Column(name="info")
|
||||
public String info="";
|
||||
|
||||
/**
|
||||
* 楼层id
|
||||
*/
|
||||
@Column(name="fid")
|
||||
public int fid;
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime="";
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(String info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public int getFid() {
|
||||
return fid;
|
||||
}
|
||||
|
||||
public void setFid(int fid) {
|
||||
this.fid = fid;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.guahao.api.guide.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class GuideBuildingParam extends PageParams {
|
||||
|
||||
public GuideBuildingParam(){}
|
||||
public GuideBuildingParam(int page,int pagesize,String name){
|
||||
this.currentPage=page;
|
||||
this.pageSize=pagesize;
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.guahao.api.guide.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class GuideFloorParam extends PageParams {
|
||||
|
||||
public GuideFloorParam(){}
|
||||
public GuideFloorParam(int page, int pagesize,int bid, String name){
|
||||
this.currentPage=page;
|
||||
this.pageSize=pagesize;
|
||||
this.name=name;
|
||||
this.bid=bid;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
private int bid;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getBid() {
|
||||
return bid;
|
||||
}
|
||||
|
||||
public void setBid(int bid) {
|
||||
this.bid = bid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.guahao.api.guide.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class GuideLabelParam extends PageParams {
|
||||
|
||||
public GuideLabelParam(){}
|
||||
public GuideLabelParam(int page, int pagesize, int fid, String name){
|
||||
this.currentPage=page;
|
||||
this.pageSize=pagesize;
|
||||
this.name=name;
|
||||
this.fid=fid;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
private int fid;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getFid() {
|
||||
return fid;
|
||||
}
|
||||
|
||||
public void setFid(int fid) {
|
||||
this.fid = fid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.guahao.api.guide.service;
|
||||
|
||||
import com.guahao.api.guide.mapper.GuideBuildingMapper;
|
||||
import com.guahao.api.guide.model.GuideBuilding;
|
||||
import com.guahao.api.guide.model.param.GuideBuildingParam;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class GuideBuildingService extends BaseService<GuideBuilding> {
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private GuideBuildingMapper buildingMapper;
|
||||
|
||||
public int add(String name){
|
||||
|
||||
if(name==null||name.trim().equals("")){
|
||||
throw new LogicException("请填写楼号");
|
||||
}
|
||||
|
||||
Example example=new Example(GuideBuilding.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",name);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<GuideBuilding> list=buildingMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该楼号已存在");
|
||||
}
|
||||
|
||||
GuideBuilding gb=new GuideBuilding();
|
||||
gb.name=name;
|
||||
gb.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
return buildingMapper.insert(gb);
|
||||
}
|
||||
|
||||
public int update(int id,String name){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(name==null||name.trim().equals("")){
|
||||
throw new LogicException("请填写楼号");
|
||||
}
|
||||
|
||||
GuideBuilding gb=buildingMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(gb==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Example example=new Example(GuideBuilding.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",name);
|
||||
criteria.andNotEqualTo("id",id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<GuideBuilding> list=buildingMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该楼号已存在");
|
||||
}
|
||||
if(gb.name.equals(name.trim())){
|
||||
return 1;
|
||||
}
|
||||
gb.name=name;
|
||||
|
||||
return buildingMapper.updateByPrimaryKey(gb);
|
||||
}
|
||||
|
||||
|
||||
public int del(int id){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
GuideBuilding gb=buildingMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(gb==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(gb.flag==1){
|
||||
return 1;
|
||||
}
|
||||
|
||||
gb.flag=1;
|
||||
|
||||
return buildingMapper.updateByPrimaryKey(gb);
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getList(int page, int pagesize, String name){
|
||||
|
||||
GuideBuildingParam param=new GuideBuildingParam(page,pagesize,name);
|
||||
|
||||
param.startPage();
|
||||
param.orderBy(" gb.ctime desc ");
|
||||
|
||||
List<Map<String,Object>> list=buildingMapper.getAll(param);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.guahao.api.guide.service;
|
||||
|
||||
import com.guahao.api.guide.mapper.GuideFloorMapper;
|
||||
import com.guahao.api.guide.model.GuideFloor;
|
||||
import com.guahao.api.guide.model.param.GuideFloorParam;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class GuideFloorService extends BaseService<GuideFloor> {
|
||||
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private GuideFloorMapper floorMapper;
|
||||
|
||||
public int add(String name,int bid){
|
||||
|
||||
if(name==null||name.trim().equals("")){
|
||||
throw new LogicException("请填写楼层名称");
|
||||
}
|
||||
|
||||
Example example=new Example(GuideFloor.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",name);
|
||||
criteria.andEqualTo("bid",bid);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<GuideFloor> list=floorMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该楼层已存在");
|
||||
}
|
||||
|
||||
GuideFloor gf=new GuideFloor();
|
||||
gf.name=name;
|
||||
gf.bid=bid;
|
||||
gf.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
return floorMapper.insert(gf);
|
||||
}
|
||||
|
||||
public int update(int id,String name,int bid){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(name==null||name.trim().equals("")){
|
||||
throw new LogicException("请填写楼层名称");
|
||||
}
|
||||
|
||||
GuideFloor gb=floorMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(gb==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Example example=new Example(GuideFloor.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",name);
|
||||
criteria.andEqualTo("bid",bid);
|
||||
criteria.andNotEqualTo("id",id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<GuideFloor> list=floorMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该楼层已存在");
|
||||
}
|
||||
if(gb.name.equals(name.trim())){
|
||||
return 1;
|
||||
}
|
||||
gb.name=name;
|
||||
|
||||
return floorMapper.updateByPrimaryKey(gb);
|
||||
}
|
||||
|
||||
|
||||
public int del(int id){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
GuideFloor gf=floorMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(gf==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(gf.flag==1){
|
||||
return 1;
|
||||
}
|
||||
|
||||
gf.flag=1;
|
||||
|
||||
return floorMapper.updateByPrimaryKey(gf);
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getList(int page, int pagesize,int bid, String name){
|
||||
|
||||
GuideFloorParam param=new GuideFloorParam(page,pagesize,bid,name);
|
||||
|
||||
param.startPage();
|
||||
param.orderBy(" gf.ctime desc ");
|
||||
|
||||
List<Map<String,Object>> list=floorMapper.getAll(param);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.guahao.api.guide.service;
|
||||
|
||||
import com.guahao.api.guide.mapper.GuideFloorMapper;
|
||||
import com.guahao.api.guide.mapper.GuideLabelMapper;
|
||||
import com.guahao.api.guide.model.GuideFloor;
|
||||
import com.guahao.api.guide.model.GuideLabel;
|
||||
import com.guahao.api.guide.model.param.GuideFloorParam;
|
||||
import com.guahao.api.guide.model.param.GuideLabelParam;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class GuideLabelService extends BaseService<GuideLabel> {
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private GuideLabelMapper labelMapper;
|
||||
|
||||
@Autowired
|
||||
private GuideFloorMapper floorMapper;
|
||||
|
||||
|
||||
public int add(GuideLabel guideLabel){
|
||||
|
||||
if(guideLabel.name==null||guideLabel.name.trim().equals("")){
|
||||
throw new LogicException("请填写标签名称");
|
||||
}
|
||||
|
||||
Example example=new Example(GuideLabel.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",guideLabel.name);
|
||||
criteria.andEqualTo("fid",guideLabel.fid);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<GuideLabel> list=labelMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该标签已存在");
|
||||
}
|
||||
|
||||
guideLabel.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
return labelMapper.insert(guideLabel);
|
||||
}
|
||||
|
||||
public int update(GuideLabel guideLabel){
|
||||
|
||||
if(guideLabel.id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(guideLabel.name==null||guideLabel.name.trim().equals("")){
|
||||
throw new LogicException("请填写标签名称");
|
||||
}
|
||||
|
||||
GuideLabel gl=labelMapper.selectByPrimaryKey(guideLabel.id);
|
||||
|
||||
if(gl==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Example example=new Example(GuideLabel.class);
|
||||
Example.Criteria criteria=example.createCriteria();
|
||||
criteria.andEqualTo("name",guideLabel.name);
|
||||
criteria.andEqualTo("fid",guideLabel.fid);
|
||||
criteria.andNotEqualTo("id",guideLabel.id);
|
||||
criteria.andNotEqualTo("flag",1);
|
||||
|
||||
List<GuideLabel> list=labelMapper.selectByExample(example);
|
||||
if(list!=null&&list.size()>0){
|
||||
throw new LogicException("该标签已存在");
|
||||
}
|
||||
gl.name=guideLabel.name;
|
||||
gl.info=guideLabel.info;
|
||||
|
||||
return labelMapper.updateByPrimaryKey(gl);
|
||||
}
|
||||
|
||||
|
||||
public int del(int id){
|
||||
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
GuideLabel gl=labelMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(gl==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(gl.flag==1){
|
||||
return 1;
|
||||
}
|
||||
|
||||
gl.flag=1;
|
||||
|
||||
return labelMapper.updateByPrimaryKey(gl);
|
||||
}
|
||||
|
||||
public Map<String,Object> getinfo(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
GuideLabel gl=labelMapper.selectByPrimaryKey(id);
|
||||
|
||||
if(gl==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
map.put("id",gl.id);
|
||||
map.put("name",gl.name);
|
||||
map.put("info",gl.info);
|
||||
map.put("ctime",gl.ctime);
|
||||
map.put("fid",gl.fid);
|
||||
|
||||
GuideFloor gf=floorMapper.selectByPrimaryKey(gl.fid);
|
||||
|
||||
map.put("fname","");
|
||||
if(gf!=null){
|
||||
map.put("fname",gf.name);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getList(int page, int pagesize, int fid, String name){
|
||||
|
||||
GuideLabelParam param=new GuideLabelParam(page,pagesize,fid,name);
|
||||
|
||||
param.startPage();
|
||||
param.orderBy(" gl.ctime desc ");
|
||||
|
||||
List<Map<String,Object>> list=labelMapper.getAll(param);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getGuide(){
|
||||
return labelMapper.getGuide();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.guahao.api.guided.controller;
|
||||
|
||||
import com.guahao.WebLog;
|
||||
import com.guahao.api.guided.model.Guided;
|
||||
import com.guahao.api.guided.model.QuestionType;
|
||||
import com.guahao.api.guided.service.GuidedService;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/17
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/guided")
|
||||
// @Slf4j
|
||||
public class GuidedController {
|
||||
|
||||
@Autowired
|
||||
private GuidedService guidedService;
|
||||
|
||||
@RequestMapping(value = "/getQuestionsType")
|
||||
@WebLog(description = "getQuestionsType")
|
||||
public Object getQuestionsType(String place) {
|
||||
// log.info("getQuestionsType is :" + place);
|
||||
List<QuestionType> questionTypes = guidedService.queryQuestionsType(place);
|
||||
|
||||
return ResponseResult.success(questionTypes);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/getQuestions")
|
||||
@WebLog(description = "getQuestions")
|
||||
public Object getQuestions(String area, String type) {
|
||||
|
||||
List<Guided> guideds = guidedService.queryGuidedByArea(area, type);
|
||||
return ResponseResult.success(guideds);
|
||||
}
|
||||
|
||||
}
|
||||
25
src/main/java/com/guahao/api/guided/mapper/GuidedMapper.java
Normal file
25
src/main/java/com/guahao/api/guided/mapper/GuidedMapper.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.guahao.api.guided.mapper;
|
||||
|
||||
import com.guahao.api.guided.model.Guided;
|
||||
import com.guahao.api.guided.model.QuestionType;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/17
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface GuidedMapper extends BaseMapper<Guided> {
|
||||
|
||||
List<Guided> queryGuidedByArea(String area, String type);
|
||||
|
||||
List<QuestionType> queryQuestionsType(String place);
|
||||
}
|
||||
30
src/main/java/com/guahao/api/guided/model/Guided.java
Normal file
30
src/main/java/com/guahao/api/guided/model/Guided.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.guahao.api.guided.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/17
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Guided {
|
||||
|
||||
|
||||
private String id;
|
||||
private String question;
|
||||
private String departmentName;
|
||||
private String departmentNo;
|
||||
private String bodyAreaType;
|
||||
private String bodyArerName;
|
||||
private String questionType;
|
||||
private String questionTypeName;
|
||||
}
|
||||
25
src/main/java/com/guahao/api/guided/model/QuestionType.java
Normal file
25
src/main/java/com/guahao/api/guided/model/QuestionType.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.guahao.api.guided.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/19
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class QuestionType {
|
||||
|
||||
private String bodyAreaType; // 原 body_area_type
|
||||
private String bodyAreaName; // 原 body_area_name
|
||||
private String questionType; // 原 question_type
|
||||
private String questionTypeName; // 原 question_type_name
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.guahao.api.guided.service;
|
||||
|
||||
import com.guahao.api.guided.mapper.GuidedMapper;
|
||||
import com.guahao.api.guided.model.Guided;
|
||||
import com.guahao.api.guided.model.QuestionType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/5/17
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class GuidedService {
|
||||
|
||||
@Autowired
|
||||
GuidedMapper guidedMapper;
|
||||
|
||||
public List<Guided> queryGuidedByArea(String area, String type) {
|
||||
|
||||
return guidedMapper.queryGuidedByArea(area, type);
|
||||
}
|
||||
|
||||
public List<QuestionType> queryQuestionsType(String place) {
|
||||
|
||||
|
||||
return guidedMapper.queryQuestionsType(place);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.guahao.api.info.controller;
|
||||
|
||||
|
||||
import com.guahao.api.info.model.HospitalInfo;
|
||||
import com.guahao.api.info.service.HospitalInfoService;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hospital/info")
|
||||
public class HospitalInfoController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(HospitalInfoController.class);
|
||||
|
||||
@Autowired
|
||||
private HospitalInfoService hospitalInfoService;
|
||||
|
||||
/**
|
||||
* 修改医院介绍
|
||||
* @param hospitalInfo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestBody HospitalInfo hospitalInfo){
|
||||
try{
|
||||
HospitalInfo hi = hospitalInfoService.add(hospitalInfo);
|
||||
return ResponseResult.success(hi);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询医院介绍
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getinfo",method = RequestMethod.POST)
|
||||
public Object getinfo(){
|
||||
try{
|
||||
HospitalInfo hi = hospitalInfoService.getinfo();
|
||||
return ResponseResult.success(hi);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.guahao.api.info.mapper;
|
||||
|
||||
|
||||
import com.guahao.api.info.model.HospitalInfo;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HospitalInfoMapper extends BaseMapper<HospitalInfo> {
|
||||
}
|
||||
126
src/main/java/com/guahao/api/info/model/HospitalInfo.java
Normal file
126
src/main/java/com/guahao/api/info/model/HospitalInfo.java
Normal file
@@ -0,0 +1,126 @@
|
||||
package com.guahao.api.info.model;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Table(name="hnwj_hospital")
|
||||
@Data
|
||||
public class HospitalInfo {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 医院名称
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
@Column(name="tel")
|
||||
public String tel="";
|
||||
|
||||
/**
|
||||
* 封面图
|
||||
*/
|
||||
@Column(name="img")
|
||||
public String img="";
|
||||
|
||||
/**
|
||||
* logo
|
||||
*/
|
||||
@Column(name="logo")
|
||||
public String logo="";
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
@Column(name="label")
|
||||
public String label="";
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@Column(name="address")
|
||||
public String address="";
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name="content")
|
||||
public String content="";
|
||||
|
||||
// public int getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(int id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public String getName() {
|
||||
// return name;
|
||||
// }
|
||||
//
|
||||
// public void setName(String name) {
|
||||
// this.name = name;
|
||||
// }
|
||||
//
|
||||
// public String getTel() {
|
||||
// return tel;
|
||||
// }
|
||||
//
|
||||
// public void setTel(String tel) {
|
||||
// this.tel = tel;
|
||||
// }
|
||||
//
|
||||
// public String getImg() {
|
||||
// return img;
|
||||
// }
|
||||
//
|
||||
// public void setImg(String img) {
|
||||
// this.img = img;
|
||||
// }
|
||||
//
|
||||
// public String getLabel() {
|
||||
// return label;
|
||||
// }
|
||||
//
|
||||
// public void setLabel(String label) {
|
||||
// this.label = label;
|
||||
// }
|
||||
//
|
||||
// public String getAddress() {
|
||||
// return address;
|
||||
// }
|
||||
//
|
||||
// public void setAddress(String address) {
|
||||
// this.address = address;
|
||||
// }
|
||||
//
|
||||
// public String getContent() {
|
||||
// return content;
|
||||
// }
|
||||
//
|
||||
// public void setContent(String content) {
|
||||
// this.content = content;
|
||||
// }
|
||||
//
|
||||
// public String getLogo() {
|
||||
// return logo;
|
||||
// }
|
||||
//
|
||||
// public void setLogo(String logo) {
|
||||
// this.logo = logo;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.guahao.api.info.service;
|
||||
|
||||
import com.guahao.api.info.mapper.HospitalInfoMapper;
|
||||
import com.guahao.api.info.model.HospitalInfo;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class HospitalInfoService extends BaseService<HospitalInfo> {
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private HospitalInfoMapper hospitalInfoMapper;
|
||||
|
||||
|
||||
public HospitalInfo add(HospitalInfo hospitalInfo){
|
||||
|
||||
if(hospitalInfo.name==null||hospitalInfo.name.trim().equals("")){
|
||||
throw new LogicException("请填写医院名称");
|
||||
}
|
||||
if(hospitalInfo.tel==null||hospitalInfo.tel.trim().equals("")){
|
||||
throw new LogicException("请填写医院联系电话");
|
||||
}
|
||||
if(hospitalInfo.address==null||hospitalInfo.address.trim().equals("")){
|
||||
throw new LogicException("请填写医院地址");
|
||||
}
|
||||
if(hospitalInfo.img==null||hospitalInfo.img.trim().equals("")){
|
||||
throw new LogicException("请填加封面图");
|
||||
}
|
||||
if(hospitalInfo.label==null||hospitalInfo.label.trim().equals("")){
|
||||
hospitalInfo.label="";
|
||||
}
|
||||
if(hospitalInfo.content==null||hospitalInfo.content.trim().equals("")){
|
||||
hospitalInfo.content="";
|
||||
}
|
||||
|
||||
HospitalInfo hi;
|
||||
List<HospitalInfo> info=hospitalInfoMapper.selectAll();
|
||||
|
||||
if(info!=null&&info.size()>0){
|
||||
hi=info.get(0);
|
||||
hi.address=hospitalInfo.address;
|
||||
hi.name=hospitalInfo.name;
|
||||
hi.content=hospitalInfo.content;
|
||||
hi.label=hospitalInfo.label;
|
||||
hi.img=hospitalInfo.img;
|
||||
hi.logo=hospitalInfo.logo;
|
||||
hi.tel=hospitalInfo.tel;
|
||||
hospitalInfoMapper.updateByPrimaryKey(hi);
|
||||
}else{
|
||||
hi=hospitalInfo;
|
||||
hi.id=0;
|
||||
hospitalInfoMapper.insert(hi);
|
||||
}
|
||||
|
||||
return hi;
|
||||
}
|
||||
|
||||
public HospitalInfo getinfo(){
|
||||
|
||||
HospitalInfo hi;
|
||||
List<HospitalInfo> info=hospitalInfoMapper.selectAll();
|
||||
|
||||
if(info!=null&&info.size()>0){
|
||||
hi=info.get(0);
|
||||
}else{
|
||||
hi=new HospitalInfo();
|
||||
}
|
||||
return hi;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.guahao.api.information.controller;
|
||||
|
||||
|
||||
import com.guahao.api.information.model.Information;
|
||||
import com.guahao.api.information.service.InformationService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/information")
|
||||
public class InformationController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(InformationController.class);
|
||||
|
||||
@Autowired
|
||||
private InformationService informationService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加健康咨询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/jiankang/add",method = RequestMethod.POST)
|
||||
public Object addJiankang(@RequestBody Information information){
|
||||
try{
|
||||
information.type=1;
|
||||
int insertId = informationService.add(information);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加就医咨询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/jiuyi/add",method = RequestMethod.POST)
|
||||
public Object addJiuyi(@RequestBody Information information){
|
||||
try{
|
||||
information.type=2;
|
||||
int insertId = informationService.add(information);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 添加医院动态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/dongtai/add",method = RequestMethod.POST)
|
||||
public Object addDongtai(@RequestBody Information information){
|
||||
try{
|
||||
information.type=3;
|
||||
int insertId = informationService.add(information);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改咨询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestBody Information information){
|
||||
try{
|
||||
int insertId = informationService.update(information);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除咨询
|
||||
* @param id 咨询id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = informationService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 咨询详情
|
||||
* @param id 咨询id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getinfo",method = RequestMethod.POST)
|
||||
public Object getinfo(@RequestParam("id") int id){
|
||||
try{
|
||||
Information information = informationService.getinfo(id);
|
||||
return ResponseResult.success(information);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询健康指南
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getjklist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getjiankangList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam(value = "title",required = false)String title){
|
||||
try{
|
||||
PageBean<Map<String,Object>> pageBean= informationService.getList(page,pagesize,title,1);
|
||||
return pageBean;
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询就医指南
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getjylist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getJiuyiList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam(value = "title",required = false)String title){
|
||||
try{
|
||||
PageBean<Map<String,Object>> pageBean= informationService.getList(page,pagesize,title,2);
|
||||
return pageBean;
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询医院动态
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getdtlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getDongtaiList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam(value = "title",required = false)String title){
|
||||
try{
|
||||
|
||||
PageBean<Map<String,Object>> pageBean=informationService.getList(page,pagesize,title,3);
|
||||
return pageBean;
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.guahao.api.information.mapper;
|
||||
|
||||
import com.guahao.api.information.model.Information;
|
||||
import com.guahao.api.information.model.param.InformationParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface InformationMapper extends BaseMapper<Information> {
|
||||
|
||||
List<Map<String,Object>> getAll(InformationParam informationParam);
|
||||
|
||||
}
|
||||
111
src/main/java/com/guahao/api/information/model/Information.java
Normal file
111
src/main/java/com/guahao/api/information/model/Information.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package com.guahao.api.information.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="hnwj_information")
|
||||
@Data
|
||||
public class Information implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Column(name="title")
|
||||
public String title="";
|
||||
|
||||
/**
|
||||
* 封面图
|
||||
*/
|
||||
@Column(name="img")
|
||||
public String img="";
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@Column(name="content")
|
||||
public String content="";
|
||||
|
||||
/**
|
||||
* 类型(1、健康指南 2、就医指南 3、医院动态)
|
||||
*/
|
||||
@Column(name="type")
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="deleted")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="create_time")
|
||||
public String ctime="";
|
||||
|
||||
// public int getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(int id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public String getTitle() {
|
||||
// return title;
|
||||
// }
|
||||
//
|
||||
// public void setTitle(String title) {
|
||||
// this.title = title;
|
||||
// }
|
||||
//
|
||||
// public String getImg() {
|
||||
// return img;
|
||||
// }
|
||||
//
|
||||
// public void setImg(String img) {
|
||||
// this.img = img;
|
||||
// }
|
||||
//
|
||||
// public String getContent() {
|
||||
// return content;
|
||||
// }
|
||||
//
|
||||
// public void setContent(String content) {
|
||||
// this.content = content;
|
||||
// }
|
||||
//
|
||||
// public int getType() {
|
||||
// return type;
|
||||
// }
|
||||
//
|
||||
// public void setType(int type) {
|
||||
// this.type = type;
|
||||
// }
|
||||
//
|
||||
// public int getFlag() {
|
||||
// return flag;
|
||||
// }
|
||||
//
|
||||
// public void setFlag(int flag) {
|
||||
// this.flag = flag;
|
||||
// }
|
||||
//
|
||||
// public String getCtime() {
|
||||
// return ctime;
|
||||
// }
|
||||
//
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.guahao.api.information.model.param;
|
||||
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class InformationParam extends PageParams {
|
||||
|
||||
public InformationParam(){}
|
||||
public InformationParam(int page,int pagesize,int type,String title){
|
||||
this.currentPage=(page-1)*pagesize;
|
||||
this.pageSize=pagesize;
|
||||
this.type=type;
|
||||
this.title=title;
|
||||
}
|
||||
|
||||
private String title;
|
||||
|
||||
private int type;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.guahao.api.information.service;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.guahao.api.information.mapper.InformationMapper;
|
||||
import com.guahao.api.information.model.Information;
|
||||
import com.guahao.api.information.model.param.InformationParam;
|
||||
import com.guahao.common.Exception.LogicException;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.common.base.BaseService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
public class InformationService extends BaseService<Information> {
|
||||
@Override
|
||||
public BaseMapper getMapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private InformationMapper informationMapper;
|
||||
|
||||
public int add(Information information){
|
||||
|
||||
if(information.title==null||information.title.trim().equals("")){
|
||||
throw new LogicException("请填写标题");
|
||||
}
|
||||
|
||||
if(information.img==null||information.img.trim().equals("")){
|
||||
throw new LogicException("请填加封面图");
|
||||
}
|
||||
|
||||
if(information.content==null||information.content.trim().equals("")){
|
||||
throw new LogicException("请填写内容详情");
|
||||
}
|
||||
|
||||
information.ctime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
return informationMapper.insert(information);
|
||||
}
|
||||
|
||||
|
||||
public int update(Information information){
|
||||
|
||||
if(information.id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
if(information.title==null||information.title.trim().equals("")){
|
||||
throw new LogicException("请填写标题");
|
||||
}
|
||||
|
||||
if(information.img==null||information.img.trim().equals("")){
|
||||
throw new LogicException("请填加封面图");
|
||||
}
|
||||
|
||||
if(information.content==null||information.content.trim().equals("")){
|
||||
throw new LogicException("请填写内容详情");
|
||||
}
|
||||
|
||||
Information i=informationMapper.selectByPrimaryKey(information.id);
|
||||
if(i==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
information.flag=0;
|
||||
information.type=i.type;
|
||||
information.ctime=i.ctime;
|
||||
|
||||
return informationMapper.updateByPrimaryKey(information);
|
||||
}
|
||||
|
||||
public int del(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Information i=informationMapper.selectByPrimaryKey(id);
|
||||
if(i==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
i.flag=1;
|
||||
return informationMapper.updateByPrimaryKey(i);
|
||||
}
|
||||
|
||||
public Information getinfo(int id){
|
||||
if(id==0){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
|
||||
Information i=informationMapper.selectByPrimaryKey(id);
|
||||
if(i==null){
|
||||
throw new LogicException("参数错误");
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
public PageBean<Map<String,Object>> getList(int page, int pagesize,String title,int type){
|
||||
|
||||
|
||||
if(page<=0){
|
||||
page=1;
|
||||
}
|
||||
if(pagesize<=0){
|
||||
pagesize=10;
|
||||
}
|
||||
InformationParam param=new InformationParam(page,pagesize,type,title);
|
||||
|
||||
List<Map<String,Object>> list=informationMapper.getAll(param);
|
||||
|
||||
PageBean<Map<String,Object>> pageBean=new PageBean<Map<String,Object>>();
|
||||
pageBean.setCode(ErrorCode.SUCCESS.code);
|
||||
pageBean.setMessage(ErrorCode.SUCCESS.desc);
|
||||
pageBean.setData(list);
|
||||
pageBean.setPageIndex(page);
|
||||
pageBean.setPageSize(pagesize);
|
||||
pageBean.setTotalRecords(informationMapper.getAll(new InformationParam(1,99999,type,title)).size());
|
||||
|
||||
double i=pageBean.getTotalRecords();
|
||||
double j=i/pagesize;
|
||||
double x=Math.ceil(j);
|
||||
|
||||
pageBean.setTotalPages((int) x);
|
||||
|
||||
return pageBean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.guahao.api.inspect.controller;
|
||||
|
||||
import com.guahao.api.inspect.model.Inspect;
|
||||
import com.guahao.api.inspect.service.InspectService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/inspect")
|
||||
public class InspectController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(InspectController.class);
|
||||
|
||||
@Autowired
|
||||
private InspectService inspectService;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加体检套餐
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addMedicine(@RequestBody Inspect inspect){
|
||||
try{
|
||||
int insertId = inspectService.add(inspect);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改体检套餐
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestBody Inspect inspect){
|
||||
try{
|
||||
int insertId = inspectService.update(inspect);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除体检套餐
|
||||
* @param id 项目id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = inspectService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询体检套餐详情
|
||||
* @param id 项目id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getinfo",method = RequestMethod.POST)
|
||||
public Object getinfo(@RequestParam("id") int id){
|
||||
try{
|
||||
Map<String,Object> medicine = inspectService.getinfo(id);
|
||||
return ResponseResult.success(medicine);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询体检套餐
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam(value="type",required = false)Integer type,
|
||||
@RequestParam(value="name",required = false)String name){
|
||||
try{
|
||||
type=type==null?0:type;
|
||||
PageBean<Map<String,Object>> pageBean = inspectService.getList(page,pagesize,type,name);
|
||||
return pageBean;
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.guahao.api.inspect.controller;
|
||||
|
||||
|
||||
import com.guahao.api.inspect.model.InspectSubscribe;
|
||||
import com.guahao.api.inspect.service.InspectSubscribeService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import com.guahao.h5.token.service.TokenService;
|
||||
import com.guahao.h5.token.vo.TokenVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/inspect/subscribe")
|
||||
public class InspectSubscribeController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(InspectSubscribeController.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private InspectSubscribeService inspectSubscribeService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
|
||||
/**
|
||||
* 体检套餐下单接口
|
||||
*
|
||||
* @param cid 就诊卡id
|
||||
* @param id 套餐id
|
||||
* @param time 预约时间
|
||||
* @param isap 午别 上午还是下午
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/pay",method = RequestMethod.POST)
|
||||
public Object subscribe(
|
||||
@RequestParam(value = "userId",required = false)Integer uid,
|
||||
@RequestParam(value = "token",required = false)String token,
|
||||
@RequestParam("cid")Integer cid,
|
||||
@RequestParam("id")Integer id,
|
||||
@RequestParam("time")String time,
|
||||
@RequestParam("isap")String isap){
|
||||
try{
|
||||
int retToken = getUserToken(uid, token);
|
||||
if (retToken == 0) {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
String str=inspectSubscribeService.pay(cid,id,time,isap);
|
||||
return ResponseResult.success(str);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款接口
|
||||
* @param uid
|
||||
* @param token
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/refund",method = RequestMethod.POST)
|
||||
public Object refund(
|
||||
@RequestParam(value = "userId",required = false)Integer uid,
|
||||
@RequestParam(value = "token",required = false)String token,
|
||||
@RequestParam("id")Integer id){
|
||||
try{
|
||||
inspectSubscribeService.refund(id);
|
||||
return ResponseResult.success("");
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 修改体检单号
|
||||
* @param id 预约id
|
||||
* @param ino 体检单号
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateino",method = RequestMethod.POST)
|
||||
public Object updateIno(@RequestParam("id")Integer id,
|
||||
@RequestParam("ino")String ino){
|
||||
try{
|
||||
int str=inspectSubscribeService.updateIno(id,ino);
|
||||
return ResponseResult.success(str);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询预约详情
|
||||
* @param id 预约id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getinfo",method = RequestMethod.POST)
|
||||
public Object getInfo(@RequestParam("id")Integer id){
|
||||
try{
|
||||
InspectSubscribe str=inspectSubscribeService.getInfo(id);
|
||||
return ResponseResult.success(str);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询预约列表
|
||||
* @param page 当前页数
|
||||
* @param pagesize 每页显示条数
|
||||
* @param uid 用户id
|
||||
* @param state 预约状态
|
||||
* @param no 订单号
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public Object getList(@RequestParam("page")int page,
|
||||
@RequestParam("pagesize")int pagesize,
|
||||
@RequestParam(value = "userId",required = false)Integer uid,
|
||||
@RequestParam(value = "token",required = false)String token,
|
||||
@RequestParam(value = "state",required = false)Integer state,
|
||||
@RequestParam(value = "no",required = false)String no){
|
||||
try{
|
||||
if(token!=null){
|
||||
int retToken = getUserToken(uid, token);
|
||||
if (retToken == 0) {
|
||||
return ResponseResult.sysLoginError();
|
||||
}
|
||||
}
|
||||
PageBean<Map<String,Object>> pageBean=inspectSubscribeService.getList(page,pagesize,uid,state,no);
|
||||
return pageBean;
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询体检号源
|
||||
* @param time 时间 yyyy-MM
|
||||
* @param id 套餐id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getresource",method = RequestMethod.POST)
|
||||
public Object getresource(@RequestParam("time") String time,
|
||||
@RequestParam("id") Integer id){
|
||||
try{
|
||||
List<Map<String,Object>> list=inspectSubscribeService.getresource(id,time);
|
||||
return ResponseResult.success(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/callback",method = RequestMethod.POST)
|
||||
public void callback(HttpServletRequest request, HttpServletResponse response){
|
||||
inspectSubscribeService.callback(request,response);
|
||||
}
|
||||
|
||||
/**
|
||||
* token验证
|
||||
*/
|
||||
private int getUserToken(Integer userId, String token) throws Exception {
|
||||
TokenVo tokenVo = new TokenVo(userId, token);
|
||||
int result = tokenService.getUserToken(tokenVo);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.guahao.api.inspect.controller;
|
||||
|
||||
import com.guahao.api.inspect.service.InspectTypeService;
|
||||
import com.guahao.common.base.PageBean;
|
||||
import com.guahao.common.response.ErrorCode;
|
||||
import com.guahao.common.response.ResponseResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/inspect/type")
|
||||
public class InspectTypeController {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(InspectTypeController.class);
|
||||
|
||||
@Autowired
|
||||
private InspectTypeService inspectTypeService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加体检分类
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add",method = RequestMethod.POST)
|
||||
public Object addType(@RequestParam("name")String name){
|
||||
try{
|
||||
int insertId = inspectTypeService.add(name);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/update",method = RequestMethod.POST)
|
||||
public Object update(@RequestParam("id")int id,@RequestParam("name")String name){
|
||||
try{
|
||||
int insertId = inspectTypeService.update(id,name);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分类
|
||||
* @param id 分类id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/del",method = RequestMethod.POST)
|
||||
public Object del(@RequestParam("id") int id){
|
||||
try{
|
||||
int insertId = inspectTypeService.del(id);
|
||||
return ResponseResult.success(insertId);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return ResponseResult.sysError(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询分类
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getlist",method = RequestMethod.POST)
|
||||
public PageBean<Map<String,Object>> getList(@RequestParam("page") int page,
|
||||
@RequestParam("pagesize") int pagesize,
|
||||
@RequestParam(value="name",required = false)String name){
|
||||
try{
|
||||
List<Map<String,Object>> list = inspectTypeService.getList(page,pagesize,name);
|
||||
return new PageBean<Map<String,Object>>(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getLocalizedMessage());
|
||||
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
src/main/java/com/guahao/api/inspect/mapper/CardMapper.java
Normal file
10
src/main/java/com/guahao/api/inspect/mapper/CardMapper.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.guahao.api.inspect.mapper;
|
||||
|
||||
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import com.guahao.h5.user.model.UserCard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CardMapper extends BaseMapper<UserCard> {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.guahao.api.inspect.mapper;
|
||||
|
||||
import com.guahao.api.inspect.model.Inspect;
|
||||
import com.guahao.api.inspect.model.param.InspectParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface InspectMapper extends BaseMapper<Inspect> {
|
||||
|
||||
|
||||
List<Map<String,Object>> getAll(InspectParam param);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.guahao.api.inspect.mapper;
|
||||
|
||||
import com.guahao.api.inspect.model.InspectSubscribe;
|
||||
import com.guahao.api.inspect.model.param.InspectSubscribeParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface InspectSubscribeMapper extends BaseMapper<InspectSubscribe> {
|
||||
|
||||
List<Map<String,Object>> getAll(InspectSubscribeParam param);
|
||||
|
||||
List<Map<String,Object>> getresource(@Param("id") int id,@Param("begin") String begin,@Param("end") String end);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.guahao.api.inspect.mapper;
|
||||
|
||||
import com.guahao.api.inspect.model.InspectType;
|
||||
import com.guahao.api.inspect.model.param.InspectTypeParam;
|
||||
import com.guahao.common.base.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface InspectTypeMapper extends BaseMapper<InspectType> {
|
||||
|
||||
List<Map<String,Object>> getAll(InspectTypeParam param);
|
||||
}
|
||||
137
src/main/java/com/guahao/api/inspect/model/Inspect.java
Normal file
137
src/main/java/com/guahao/api/inspect/model/Inspect.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package com.guahao.api.inspect.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="inspect")
|
||||
public class Inspect implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 套餐名称
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Column(name="tid")
|
||||
public int tid;
|
||||
|
||||
/**
|
||||
* 套餐价格
|
||||
*/
|
||||
@Column(name="price")
|
||||
public Double price;
|
||||
|
||||
/**
|
||||
* 注意事项
|
||||
*/
|
||||
@Column(name="matter")
|
||||
public String matter="";
|
||||
|
||||
/**
|
||||
* 项目说明
|
||||
*/
|
||||
@Column(name="`explain`")
|
||||
public String explain="";
|
||||
|
||||
/**
|
||||
* 项目意义
|
||||
*/
|
||||
@Column(name="meaning")
|
||||
public String meaning="";
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime="";
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getTid() {
|
||||
return tid;
|
||||
}
|
||||
|
||||
public void setTid(int tid) {
|
||||
this.tid = tid;
|
||||
}
|
||||
|
||||
public Double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getMatter() {
|
||||
return matter;
|
||||
}
|
||||
|
||||
public void setMatter(String matter) {
|
||||
this.matter = matter;
|
||||
}
|
||||
|
||||
public String getExplain() {
|
||||
return explain;
|
||||
}
|
||||
|
||||
public void setExplain(String explain) {
|
||||
this.explain = explain;
|
||||
}
|
||||
|
||||
public String getMeaning() {
|
||||
return meaning;
|
||||
}
|
||||
|
||||
public void setMeaning(String meaning) {
|
||||
this.meaning = meaning;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
346
src/main/java/com/guahao/api/inspect/model/InspectSubscribe.java
Normal file
346
src/main/java/com/guahao/api/inspect/model/InspectSubscribe.java
Normal file
@@ -0,0 +1,346 @@
|
||||
package com.guahao.api.inspect.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Table(name="inspect_subscribe")
|
||||
public class InspectSubscribe implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Column(name = "uid")
|
||||
public int uid;
|
||||
|
||||
/**
|
||||
* 体检用户姓名
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 就诊卡卡号
|
||||
*/
|
||||
@Column(name="card")
|
||||
public String card="";
|
||||
|
||||
/**
|
||||
* 就诊卡手机号
|
||||
*/
|
||||
@Column(name="tel")
|
||||
public String tel="";
|
||||
|
||||
/**
|
||||
* 病人id
|
||||
*/
|
||||
@Column(name="patient_id")
|
||||
public String patientId="";
|
||||
|
||||
/**
|
||||
* 套餐id
|
||||
*/
|
||||
@Column(name="iid")
|
||||
public int iid;
|
||||
|
||||
/**
|
||||
* 套餐名称
|
||||
*/
|
||||
@Column(name="iname")
|
||||
public String iname="";
|
||||
|
||||
/**
|
||||
* 套餐价格
|
||||
*/
|
||||
@Column(name="price")
|
||||
public Double price=0.0;
|
||||
|
||||
/**
|
||||
* 实付金额
|
||||
*/
|
||||
@Column(name="money")
|
||||
public Double money=0.0;
|
||||
|
||||
/**
|
||||
* 注意事项
|
||||
*/
|
||||
@Column(name="matter")
|
||||
public String matter="";
|
||||
|
||||
/**
|
||||
* 项目说明
|
||||
*/
|
||||
@Column(name="`explain`")
|
||||
public String explain="";
|
||||
|
||||
/**
|
||||
* 项目意义
|
||||
*/
|
||||
@Column(name="meaning")
|
||||
public String meaning="";
|
||||
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
@Column(name="yytime")
|
||||
public String yytime="";
|
||||
|
||||
/**
|
||||
* 上午还是下午
|
||||
*/
|
||||
@Column(name="isap")
|
||||
public String isap="";
|
||||
|
||||
/**
|
||||
* 支付订单号
|
||||
*/
|
||||
@Column(name="out_trade_no")
|
||||
public String outTradeNo="";
|
||||
|
||||
/**
|
||||
* 订单状态(0、待支付 1、待体检 2、已完成 9、已取消)
|
||||
*/
|
||||
@Column(name="state")
|
||||
public int state=0;
|
||||
|
||||
/**
|
||||
* 体检单号
|
||||
*/
|
||||
@Column(name="ino")
|
||||
public String ino="";
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime="";
|
||||
|
||||
/**
|
||||
* 支付成功时间
|
||||
*/
|
||||
@Column(name="successtime")
|
||||
public String successtime="";
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Column(name="wctime")
|
||||
public String wctime="";
|
||||
|
||||
/**
|
||||
* 取消时间
|
||||
*/
|
||||
@Column(name="qxtime")
|
||||
public String qxtime="";
|
||||
|
||||
/**
|
||||
* 报告生成时间
|
||||
*/
|
||||
@Column(name="bgtime")
|
||||
public String bgtime="";
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCard() {
|
||||
return card;
|
||||
}
|
||||
|
||||
public void setCard(String card) {
|
||||
this.card = card;
|
||||
}
|
||||
|
||||
public String getTel() {
|
||||
return tel;
|
||||
}
|
||||
|
||||
public void setTel(String tel) {
|
||||
this.tel = tel;
|
||||
}
|
||||
|
||||
public String getPatientId() {
|
||||
return patientId;
|
||||
}
|
||||
|
||||
public void setPatientId(String patientId) {
|
||||
this.patientId = patientId;
|
||||
}
|
||||
|
||||
public String getIname() {
|
||||
return iname;
|
||||
}
|
||||
|
||||
public void setIname(String iname) {
|
||||
this.iname = iname;
|
||||
}
|
||||
|
||||
public Double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Double getMoney() {
|
||||
return money;
|
||||
}
|
||||
|
||||
public void setMoney(Double money) {
|
||||
this.money = money;
|
||||
}
|
||||
|
||||
public String getMatter() {
|
||||
return matter;
|
||||
}
|
||||
|
||||
public void setMatter(String matter) {
|
||||
this.matter = matter;
|
||||
}
|
||||
|
||||
public String getExplain() {
|
||||
return explain;
|
||||
}
|
||||
|
||||
public void setExplain(String explain) {
|
||||
this.explain = explain;
|
||||
}
|
||||
|
||||
public String getMeaning() {
|
||||
return meaning;
|
||||
}
|
||||
|
||||
public void setMeaning(String meaning) {
|
||||
this.meaning = meaning;
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getIno() {
|
||||
return ino;
|
||||
}
|
||||
|
||||
public void setIno(String ino) {
|
||||
this.ino = ino;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
|
||||
public String getSuccesstime() {
|
||||
return successtime;
|
||||
}
|
||||
|
||||
public void setSuccesstime(String successtime) {
|
||||
this.successtime = successtime;
|
||||
}
|
||||
|
||||
public String getWctime() {
|
||||
return wctime;
|
||||
}
|
||||
|
||||
public void setWctime(String wctime) {
|
||||
this.wctime = wctime;
|
||||
}
|
||||
|
||||
public String getQxtime() {
|
||||
return qxtime;
|
||||
}
|
||||
|
||||
public void setQxtime(String qxtime) {
|
||||
this.qxtime = qxtime;
|
||||
}
|
||||
|
||||
public String getBgtime() {
|
||||
return bgtime;
|
||||
}
|
||||
|
||||
public void setBgtime(String bgtime) {
|
||||
this.bgtime = bgtime;
|
||||
}
|
||||
|
||||
public String getYytime() {
|
||||
return yytime;
|
||||
}
|
||||
|
||||
public void setYytime(String yytime) {
|
||||
this.yytime = yytime;
|
||||
}
|
||||
|
||||
public String getIsap() {
|
||||
return isap;
|
||||
}
|
||||
|
||||
public void setIsap(String isap) {
|
||||
this.isap = isap;
|
||||
}
|
||||
|
||||
public String getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public int getIid() {
|
||||
return iid;
|
||||
}
|
||||
|
||||
public void setIid(int iid) {
|
||||
this.iid = iid;
|
||||
}
|
||||
}
|
||||
67
src/main/java/com/guahao/api/inspect/model/InspectType.java
Normal file
67
src/main/java/com/guahao/api/inspect/model/InspectType.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.guahao.api.inspect.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Table(name="inspect_type")
|
||||
public class InspectType implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public int id;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
@Column(name="name")
|
||||
public String name="";
|
||||
|
||||
/**
|
||||
* 删除状态(1、删除)
|
||||
*/
|
||||
@Column(name="flag")
|
||||
public int flag=0;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Column(name="ctime")
|
||||
public String ctime="";
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(int flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.guahao.api.inspect.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class InspectParam extends PageParams {
|
||||
|
||||
public InspectParam(){}
|
||||
|
||||
public InspectParam(int page,int pagesize,int type,String name){
|
||||
this.currentPage=(page-1)*pagesize;
|
||||
this.pageSize=pagesize;
|
||||
this.type=type;
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
private int type;
|
||||
|
||||
private String name;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.guahao.api.inspect.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class InspectSubscribeParam extends PageParams {
|
||||
|
||||
public InspectSubscribeParam(){}
|
||||
|
||||
public InspectSubscribeParam(int page,int pagesize,Integer uid,Integer state,String no){
|
||||
this.currentPage=(page-1)*pagesize;
|
||||
this.pageSize=pagesize;
|
||||
this.uid=uid;
|
||||
this.state=state;
|
||||
this.no=no;
|
||||
}
|
||||
|
||||
private Integer uid;
|
||||
|
||||
private String no;
|
||||
|
||||
private Integer state;
|
||||
|
||||
public Integer getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(Integer uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getNo() {
|
||||
return no;
|
||||
}
|
||||
|
||||
public void setNo(String no) {
|
||||
this.no = no;
|
||||
}
|
||||
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.guahao.api.inspect.model.param;
|
||||
|
||||
import com.guahao.common.base.PageParams;
|
||||
|
||||
public class InspectTypeParam extends PageParams {
|
||||
|
||||
public InspectTypeParam(){}
|
||||
|
||||
public InspectTypeParam(int page,int pagesize,String name){
|
||||
this.pageSize=pagesize;
|
||||
this.currentPage=page;
|
||||
this.name=name;
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user