Commit 0f5790e1 by 罗承锋

随身厅登录跳转、订单同步

parent 7b81901a
...@@ -222,7 +222,6 @@ public class DankuanController { ...@@ -222,7 +222,6 @@ public class DankuanController {
try{ try{
String uuid = UUID.randomUUID().toString(); String uuid = UUID.randomUUID().toString();
String id = uuid.split("-")[0] + uuid.split("-")[1]; String id = uuid.split("-")[0] + uuid.split("-")[1];
order.setId(id);
order.setId(id); order.setId(id);
SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd");
......
package com.winsun.bean;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import java.util.Date;
/**
* 第三方应用密匙配置
* @author chengfengluo
* @date 2021-02-20 10:36
*/
@Data
@TableName("sys_app_config")
public class AppConfig {
/**
* 主键
*/
@TableId(value = "id" ,type = IdType.AUTO)
private Integer id;
/**
* 应用名称
*/
@TableField("app_name")
private String appName;
/**
* 应用id
*/
@TableField("app_id")
private String appId;
/**
* 应用密匙
*/
@TableField("app_secret")
private String appSecret;
/**
* 创建人
*/
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@TableField("create_time")
private Date createTime;
/**
* 更新人
*/
@TableField("update_by")
private String updateBy;
/**
* 更新时间
*/
@TableField("update_time")
private Date updateTime;
}
...@@ -209,4 +209,17 @@ public class School implements Serializable { ...@@ -209,4 +209,17 @@ public class School implements Serializable {
*/ */
@TableField("sjktcsj") @TableField("sjktcsj")
private String sjktcsj; private String sjktcsj;
/**
* 终端编码
*/
@TableField("app_id")
private String appId;
/**
* 终端密匙
*/
@TableField("app_key")
private String appKey;
} }
package com.winsun.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.winsun.bean.AppConfig;
import com.winsun.bean.PackageUpgrade;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* @author chengfengluo
* @date 2021-02-20 10:40
*/
@Mapper
@Component
public interface AppConfigMapper extends BaseMapper<AppConfig> {
}
package com.winsun.mapper; package com.winsun.mapper;
import com.winsun.bean.School;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
...@@ -69,4 +70,11 @@ public interface HhrUserMapper extends BaseMapper<HhrUser> { ...@@ -69,4 +70,11 @@ public interface HhrUserMapper extends BaseMapper<HhrUser> {
* @return * @return
*/ */
Map<String, Object> selectHehuorenInfo(@Param("hehuorenId") String hehuorenId); Map<String, Object> selectHehuorenInfo(@Param("hehuorenId") String hehuorenId);
/**
* 查询合伙人学校
* @param userId
* @return
*/
List<Map<String, Object>> selectHehuorenSchool(String userId);
} }
package com.winsun.utils;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
/**
* @author chengfengluo
* @date 2021-02-19 14:58
*/
public class EThreeDES {
private static final String Algorithm = "DESede"; //定义 加密算法,可用 DES,DESede,Blowfish
//keybyte为加密密钥,长度为24字节
//src为被加密的数据缓冲区(源)
//3DES加密
public static byte[] encryptMode(byte[] keybyte, byte[] src) {
try {
//生成密钥
SecretKey deskey = new SecretKeySpec(keybyte, Algorithm);
//加密
Cipher c1 = Cipher.getInstance(Algorithm);
c1.init(Cipher.ENCRYPT_MODE, deskey);
return c1.doFinal(src);
} catch (java.security.NoSuchAlgorithmException e1) {
e1.printStackTrace();
} catch (javax.crypto.NoSuchPaddingException e2) {
e2.printStackTrace();
} catch (Exception e3) {
e3.printStackTrace();
}
return null;
}
//keybyte为加密密钥,长度为24字节
//src为加密后的缓冲区
//3DES解密
public static byte[] decryptMode(byte[] keybyte, byte[] src) {
try {
//生成密钥
SecretKey deskey = new SecretKeySpec(keybyte, Algorithm);
//解密
Cipher c1 = Cipher.getInstance(Algorithm);
c1.init(Cipher.DECRYPT_MODE, deskey);
return c1.doFinal(src);
} catch (java.security.NoSuchAlgorithmException e1) {
e1.printStackTrace();
} catch (javax.crypto.NoSuchPaddingException e2) {
e2.printStackTrace();
} catch (Exception e3) {
e3.printStackTrace();
}
return null;
}
//转换成十六进制字符串
public static String byte2hex(byte[] b) {
String hs="";
String stmp="";
for (int n=0;n<b.length;n++) {
stmp=(Integer.toHexString(b[n] & 0XFF));
if (stmp.length()==1) hs=hs+"0"+stmp;
else hs=hs+stmp;
if (n<b.length-1) hs=hs+":";
}
return hs.toUpperCase();
}
//转为base64
public static String enBase64(byte[] bparm) throws IOException {
BASE64Encoder enc=new BASE64Encoder();
String bdnParm = enc.encodeBuffer(bparm);
return bdnParm;
}
//从BASE64反转回来
public static byte[] deBase64(String parm) throws IOException {
BASE64Decoder dec=new BASE64Decoder();
byte[] dnParm = dec.decodeBuffer(parm);
return dnParm;
}
public static String replace(String source, String oldString,
String newString) {
StringBuffer output = new StringBuffer();
int lengthOfSource = source.length();
int lengthOfOld = oldString.length();
int posStart = 0;
int pos; //
while ( (pos = source.indexOf(oldString, posStart)) >= 0) {
output.append(source.substring(posStart, pos));
output.append(newString);
posStart = pos + lengthOfOld;
}
if (posStart < lengthOfSource) {
output.append(source.substring(posStart));
}
return output.toString();
}
/**
* 3DES解密
* @param toThreeDES
* @return
*/
public static String deThreeDES(String toThreeDES){
String deThreeDes="";
if (toThreeDES==null || toThreeDES.equals(""))
{
deThreeDes="";
}
else
{
try{
EThreeDES edes = new EThreeDES();
String key_VALUE = "A314BA5A3C85E86KK887WSWS";
byte[] keyBytes = key_VALUE.getBytes();
byte[] toBASE64ToStr = edes.deBase64(toThreeDES);
byte[] toWK_DESToStr = EThreeDES.decryptMode(keyBytes, toBASE64ToStr);
deThreeDes = new String(toWK_DESToStr,"utf-8");
}
catch(Exception ex)
{
//System.out.println("3DES解密出错!!!"+ex.getMessage());
}
}
return deThreeDes;
}
public static void main(String[] args) throws IOException
{
EThreeDES eThreeDES = new EThreeDES();
String KEY = "C314BONC3C85E86KK996WSWS"; //密匙
//加密
String original = "{termNo:\"yxsst_ht191106\", orderTime:\"2021-01-27 11:30:00\", prodName:\"套餐名称\", reqCode:\"GZ202101261234567\", subsCode: [\"611234\", \"612345\", \"611226\"], custName:\"张*三\", certNo: \"4401**********1234\", accNbr:\"13888888888\", orderState: \"S0K\", orderStateName:\"已完成/已取卡\", payState: \"1\", crmStateName:\"完工\", crmStateReason:\"000\", recNo:\"0200202101251030423400027500\"}";
byte[] eBy = EThreeDES.encryptMode(KEY.getBytes(),original.getBytes());
String eBase64 = eThreeDES.enBase64(eBy);
System.out.println("3DES加密后的字符串:" + eBase64);
//解密
String dBase64 = eBase64;
byte[] dBy = EThreeDES.deBase64(dBase64);
byte[] srcBytes = EThreeDES.decryptMode(KEY.getBytes(), dBy);
System.out.println("3DES解密后的字符串:" + new String(srcBytes,"utf-8"));
}
}
...@@ -50,4 +50,23 @@ public class RandomUtil { ...@@ -50,4 +50,23 @@ public class RandomUtil {
return sb.toString(); return sb.toString();
} }
/**
* 获取纯数字随机数
* @param length
* @return
*/
public static String ramdomNum(Integer length){
String str="1234567890";
Random random=new Random();
StringBuffer sb=new StringBuffer();
for(int i=0;i<length;i++){
int number =random.nextInt(10);
sb.append(str.charAt(number));
}
return sb.toString();
}
} }
...@@ -99,4 +99,17 @@ ...@@ -99,4 +99,17 @@
WHERE WHERE
su.id = #{hehuorenId} su.id = #{hehuorenId}
</select> </select>
<select id="selectHehuorenSchool" parameterType="String" resultType="HashMap">
select
hs.*
from
hhr_user_school hus
LEFT JOIN
hhr_school hs
ON
hus.school_id = hs.id
WHERE
hus.user_id = #{userId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -4,10 +4,11 @@ import com.alibaba.fastjson.JSON; ...@@ -4,10 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.auth.core.annotion.Permission;
import com.winsun.auth.core.base.controller.BaseController; import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.base.tips.ErrorTip; import com.winsun.auth.core.base.tips.ErrorTip;
import com.winsun.auth.core.common.model.ResponseData; import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.support.HttpKit; import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.auth.core.util.DateUtil; import com.winsun.auth.core.util.DateUtil;
import com.winsun.auth.model.user.User; import com.winsun.auth.model.user.User;
import com.winsun.bean.HhrUser; import com.winsun.bean.HhrUser;
...@@ -15,10 +16,8 @@ import com.winsun.bean.School; ...@@ -15,10 +16,8 @@ import com.winsun.bean.School;
import com.winsun.bean.SysUser; import com.winsun.bean.SysUser;
import com.winsun.item.core.shiro.ShiroKit; import com.winsun.item.core.shiro.ShiroKit;
import com.winsun.item.core.util.AccLoginUtil; import com.winsun.item.core.util.AccLoginUtil;
import com.winsun.item.core.util.IPUtils;
import com.winsun.item.core.util.ResponseEntity; import com.winsun.item.core.util.ResponseEntity;
import com.winsun.item.modular.system.service.IUserService; import com.winsun.item.modular.system.service.IUserService;
import com.winsun.item.modular.system.service.impl.AccServiceImpl;
import com.winsun.item.util.LoginUtils; import com.winsun.item.util.LoginUtils;
import com.winsun.mapper.HhrUserMapper; import com.winsun.mapper.HhrUserMapper;
import com.winsun.mapper.SchoolMapper; import com.winsun.mapper.SchoolMapper;
...@@ -32,15 +31,13 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -32,15 +31,13 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import java.io.IOException;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
...@@ -489,6 +486,141 @@ public class LoginPwdController extends BaseController { ...@@ -489,6 +486,141 @@ public class LoginPwdController extends BaseController {
List<Map<String, Object>> list = schoolMapper.selectMaps(wrapper); List<Map<String, Object>> list = schoolMapper.selectMaps(wrapper);
return ResponseData.success(list); return ResponseData.success(list);
} }
/**
* 打开无人厅
* @return
*/
@PostMapping("openHall")
public ResponseData<String> openHall() {
// 查询当前合伙人学校,合伙人添加appId字段
ShiroUser user = ShiroKit.getUser();
if (user == null || user.getId() == null || user.getId() == 0) {
return ResponseData.error("当前登录用户信息有误,请重新登录。");
}
List<Map<String, Object>> schools = hhrUserMapper.selectHehuorenSchool(user.getId().toString());
if (schools == null || schools.size() == 0) {
return ResponseData.error("当前合伙人未设置学校");
}
if (schools.size() > 1) {
return ResponseData.error("当前合伙人学校配置有误,请重新配置");
}
// 判断接入号终端是否存在
Map<String, Object> school = schools.get(0);
if (school.get("app_id") == null || school.get("app_key") == null
|| StringUtils.isBlank(school.get("app_id").toString())
|| StringUtils.isBlank(school.get("app_key").toString())) {
return ResponseData.error("当前学校未配置校园随身厅。");
}
if (school.get("lzgh") == null || StringUtils.isBlank(school.get("lzgh").toString())) {
return ResponseData.error("当前学校未配置揽装工号。");
}
String appId = school.get("app_id").toString();
String appKey = school.get("app_key").toString();
Map params = new HashMap();
params.put("r", RandomUtil.ramdomNum(10));
params.put("20210114_1", appId);
// 组装请求信息
String key2 = appKey.substring(0,24);
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("apph5", "1"); //APPH5标识 固定:1
paramsMap.put("appid", appId); // 终端编码
paramsMap.put("apph5Type", "1"); // 入口类型 网迅固定:1
paramsMap.put("lzstaffcity", ""); // 揽装人县分
paramsMap.put("lzstaffmsc", ""); // 揽装人营服
paramsMap.put("lzstaffname", ""); // 揽装人姓名
paramsMap.put("lzstaffno", school.get("lzgh")); // 揽装工号
paramsMap.put("lzstaffphone", ""); // 揽装人手机
paramsMap.put("meid", ""); // 终端meid
paramsMap.put("sgstaffno", ""); // 施工工号
paramsMap.put("timestamp", new Date().getTime()); // 时间戳
paramsMap.put("username", appId + user.getAccount()); // 登录标识
paramsMap.put("xxstaffno1", ""); // 协销工号1
paramsMap.put("xxstaffno2", ""); // 协销工号2
List<Map.Entry<String, Object>> list = new ArrayList<>(paramsMap.entrySet());
// 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序)
Collections.sort(list, new Comparator<Map.Entry<String, Object>>() {
public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) {
return (o1.getKey()).toString().compareTo(o2.getKey());
}
});
log.info("获取的参数名和参数值:" + JSONObject.toJSONString(list));
// 获取map已有值
StringBuilder values = new StringBuilder();
for(Map.Entry<String, Object> map : list ) {
values.append(map.getValue());
}
// 拼接key2
values.append(appKey);
log.info("升序拼接参数值字符串:" + values.toString());
// md5加密
paramsMap.put("sign", MD5Utils.md5(values.toString())); // 签名
log.info("接口入参明文对象:" + JSONObject.toJSONString(paramsMap));
// 组装参数字符串
String interfaceParams = new String();
Iterator<Map.Entry<String, Object>> mapIterator = paramsMap.entrySet().iterator();
while(mapIterator.hasNext()) {
Map.Entry<String, Object> next = mapIterator.next();
interfaceParams += (next.getKey()+ "=" + next.getValue() + "&");
}
if (interfaceParams.lastIndexOf("&") == (interfaceParams.length() - 1)){
interfaceParams = interfaceParams.substring(0, (interfaceParams.lastIndexOf("&")));
}
log.info("接口入参明文字符串:" + interfaceParams);
// 3DES加密
byte[] eBy = EThreeDES.encryptMode(key2.getBytes(),interfaceParams.getBytes());
String eBase64 = "";
try {
eBase64 = EThreeDES.enBase64(eBy);
}catch (IOException e) {
log.error("3DES加密失败");
e.printStackTrace();
return ResponseData.error("数据加密失败");
}
log.info("3DES加密参数:" + eBase64);
// URL编码
String urlEncode = "";
try {
urlEncode = URLEncoder.encode(eBase64, "UTF-8");
}catch (UnsupportedEncodingException e) {
log.error("url编码失败");
e.printStackTrace();
return ResponseData.error("url编码失败");
}
//发送请求
params.put("20210114_8", urlEncode);
log.info("最终请求参数:" + JSONObject.toJSONString(params));
StringBuilder url = new StringBuilder("http://121.8.177.157:8443/UstpCustWeb/ustpSstAccess?");
url.append("r" + "=" + params.get("r") + "&");
url.append("20210114_1" + "=" + params.get("20210114_1") + "&");
url.append("20210114_8" + "=" + params.get("20210114_8"));
log.info("完整url:" + url);
return ResponseData.success(url.toString(), "打开成功!");
}
@RequestMapping(value = "registeredAccount", method = RequestMethod.POST) @RequestMapping(value = "registeredAccount", method = RequestMethod.POST)
public ResponseData<String> registeredAccount(@RequestParam("gender") String gender,@RequestParam("username") String username, @RequestParam("phone") String phone, public ResponseData<String> registeredAccount(@RequestParam("gender") String gender,@RequestParam("username") String username, @RequestParam("phone") String phone,
@RequestParam("idCard") String idCard, @RequestParam(value = "stuCard") String stuCard, @RequestParam("idcardZ") String idcardZ, @RequestParam("idCard") String idCard, @RequestParam(value = "stuCard") String stuCard, @RequestParam("idcardZ") String idcardZ,
......
...@@ -131,6 +131,8 @@ mybatis-plus: ...@@ -131,6 +131,8 @@ mybatis-plus:
typeAliasesPackage: com.winsun.auth.model.common,com.winsun.auth.model.merchant,com.winsun.auth.model.user,com.winsun.auth.core.node typeAliasesPackage: com.winsun.auth.model.common,com.winsun.auth.model.merchant,com.winsun.auth.model.user,com.winsun.auth.core.node
mapper-locations: mapper-locations:
- /com/winsun/item/modular/system/dao/mapping/*.xml - /com/winsun/item/modular/system/dao/mapping/*.xml
- /com/winsun/modular/dao/mapping/*.xml
- com/winsun/mapper/mapping/*.xml
management: management:
endpoints: endpoints:
web: web:
......
...@@ -131,6 +131,7 @@ mybatis-plus: ...@@ -131,6 +131,7 @@ mybatis-plus:
mapper-locations: mapper-locations:
- /com/winsun/item/modular/system/dao/mapping/*.xml - /com/winsun/item/modular/system/dao/mapping/*.xml
- /com/winsun/modular/dao/mapping/*.xml - /com/winsun/modular/dao/mapping/*.xml
- com/winsun/mapper/mapping/*.xml
management: management:
endpoints: endpoints:
web: web:
......
...@@ -131,10 +131,10 @@ ...@@ -131,10 +131,10 @@
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
<version>2.1.6</version> <version>2.1.6</version>
</dependency> </dependency>
<!-- <dependency> <dependency>
<groupId>com.winsun.framework</groupId> <groupId>com.winsun.framework</groupId>
<artifactId>winsun-core-service</artifactId> <artifactId>winsun-core-service</artifactId>
</dependency>--> </dependency>
<dependency> <dependency>
<groupId>dom4j</groupId> <groupId>dom4j</groupId>
......
package com.winsun.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.winsun.auth.core.annotion.Permission;
import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.bean.AppConfig;
import com.winsun.mapper.AppConfigMapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.RowBounds;
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.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 应用配置
* @author chengfengluo
* @date 2021-02-20 10:45
*/
@RestController
@RequestMapping("/appConfig")
public class AppConfigController extends BaseController {
@Autowired
private AppConfigMapper appConfigMapper;
/**
* 新增应用配置
* @param appConfig
* @return
*/
@Permission(menuname = "添加应用配置", value = "add", method = RequestMethod.POST)
public ResponseData<String> addAppConfig(AppConfig appConfig) {
ShiroUser user = getShiroUser();
if (StringUtils.isBlank(appConfig.getAppName())) {
return ResponseData.error("应用名称不能为空");
}
if (StringUtils.isBlank(appConfig.getAppSecret())) {
return ResponseData.error("应用密匙不能为空");
}
// 查重
Wrapper<AppConfig> wrapper = new EntityWrapper<>();
wrapper.eq("app_name", appConfig.getAppName());
Integer integer = appConfigMapper.selectCount(wrapper);
if (integer != null && integer > 0) {
return ResponseData.error("应用名称重复");
}
appConfig.setCreateBy(user.getName());
appConfig.setCreateTime(new Date());
Integer insert = appConfigMapper.insert(appConfig);
if (insert > 0) {
return ResponseData.success(insert + "", "插入成功");
}
return ResponseData.error("插入失败");
}
/**
* 编辑应用配置
* @param appConfig
* @return
*/
@Permission(menuname = "更新应用配置", value = "update", method = RequestMethod.POST)
public ResponseData<String> updateAppConfig(AppConfig appConfig) {
ShiroUser user = getShiroUser();
if (appConfig.getId() == null || StringUtils.isBlank(appConfig.getAppName())) {
return ResponseData.error("参数错误");
}
// 查重
Wrapper<AppConfig> wrapper = new EntityWrapper<>();
wrapper.eq("app_name", appConfig.getAppName());
wrapper.ne("id", appConfig.getId());
Integer integer = appConfigMapper.selectCount(wrapper);
if (integer != null && integer > 0) {
return ResponseData.error("应用名称重复");
}
appConfig.setUpdateBy(user.getName());
appConfig.setUpdateTime(new Date());
Integer integer1 = appConfigMapper.updateById(appConfig);
if(integer1 > 0) {
return ResponseData.success(null, "更新成功");
}
return ResponseData.error("更新失败");
}
/**
* 获取配置信息
* @return
*/
@RequestMapping("/getConfigInfo")
public ResponseData<AppConfig> getConfigInfo (Integer id) {
AppConfig appConfig = appConfigMapper.selectById(id);
return ResponseData.success(appConfig);
}
/**
* 查询应用列表
* @param appConfig
* @param pageIndex
* @param pageSize
* @return
*/
@RequestMapping("/list")
public ResponseData<Page<AppConfig>> list(@RequestParam(value = "appName", required = false) String appName,
@RequestParam(name = "pageNo", required = false) Integer pageIndex,
@RequestParam(name = "pageSize", required = false) Integer pageSize) {
Wrapper<AppConfig> wrapper = new EntityWrapper<>();
wrapper.like(StringUtils.isNotBlank(appName),"app_name", appName);
List<AppConfig> appConfigs = appConfigMapper.selectList(wrapper);
Page<AppConfig> page = new Page<>();
page.setTotal(appConfigs.size());
Integer endpageSize = (pageIndex-1) == appConfigs.size()/pageSize ? (pageIndex-1)*pageSize+appConfigs.size()%pageSize : pageIndex*pageSize;
appConfigs = appConfigs.subList((pageIndex - 1)*pageSize, endpageSize);
page.setRecords(appConfigs);
page.setSize(appConfigs.size());
return ResponseData.success(page, "查询成功");
}
}
...@@ -120,6 +120,9 @@ spring: ...@@ -120,6 +120,9 @@ spring:
exprie: 600 exprie: 600
prohibition: 600 prohibition: 600
datasource: datasource:
url: jdbc:mysql://localhost:3306/school_center?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
username: root
password: AMrGBg6ZSsRrDLs6
dynamic: dynamic:
primary: master primary: master
p6spy: true p6spy: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment