Merge pull request !23 from Bo/bo_dev
This commit is contained in:
Bo 2021-08-13 11:41:13 +00:00 committed by Gitee
commit 0f088d2e82
63 changed files with 10886 additions and 6523 deletions

View File

@ -1,6 +1,6 @@
@echo off
echo.
echo [信息] 清理生成路径。
echo [信息] 清理工程target生成路径。
echo.
%~d0

View File

@ -1,6 +1,6 @@
@echo off
echo.
echo [信息] 运行Web工程。
echo [信息] 使用Jar命令运行Web工程。
echo.
cd %~dp0

View File

@ -6,6 +6,7 @@ import com.ruoyi.bps.service.IExpSubsPushApiService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
/**
* 接受快递推送信息的API接口Controller
@ -50,7 +53,7 @@ public class ExpSubsPushApiController extends BaseController {
//接受topgp订阅
@Log(title = "快递订阅", businessType = BusinessType.OTHER)
@CrossOrigin
@ApiOperation(value="topgp订阅快递",notes = "request body格式 {\"deliveryNo\":\"S301-2108020001\",\"expressNo\":\"300444235610\",\"company\":\"annengwuliu\",\"phone\":\"13800138000\"}")
@ApiOperation(value="topgp订阅快递",notes = "request body格式 {\"requestId\":\"1628584040740\",\"deliveryNo\":\"S301-2108020001\",\"expressNo\":\"300444235610\",\"company\":\"annengwuliu\",\"phone\":\"13800138000\"}")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "requestJson", value = "请求json",required = true, paramType = "body", dataType = "String", dataTypeClass = String.class)
@ -58,7 +61,7 @@ public class ExpSubsPushApiController extends BaseController {
@PostMapping("api/express/topgpSubscribe")
public String topgpSubscribe(HttpServletRequest request, HttpServletResponse response) throws IOException {
return expSubsPushApiService.ExpressSubscribeWithTopgp(request);
return expSubsPushApiService.ExpressSubscribeFromTopgp(request);
}

View File

@ -0,0 +1,126 @@
package com.ruoyi.bps.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bps.domain.ExpTopgpLog;
import com.ruoyi.bps.service.IExpTopgpLogService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* ERP订阅推送日志Controller
*
* @author Bo
* @date 2021-08-11
*/
@Controller
@RequestMapping("/bps/expTopgpLog")
public class ExpTopgpLogController extends BaseController
{
private String prefix = "bps/expTopgpLog";
@Autowired
private IExpTopgpLogService expTopgpLogService;
@RequiresPermissions("bps:expTopgpLog:view")
@GetMapping()
public String expTopgpLog()
{
return prefix + "/expTopgpLog";
}
/**
* 查询ERP订阅推送日志列表
*/
@RequiresPermissions("bps:expTopgpLog:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ExpTopgpLog expTopgpLog)
{
startPage();
List<ExpTopgpLog> list = expTopgpLogService.selectExpTopgpLogList(expTopgpLog);
return getDataTable(list);
}
/**
* 导出ERP订阅推送日志列表
*/
@RequiresPermissions("bps:expTopgpLog:export")
@Log(title = "ERP订阅推送日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ExpTopgpLog expTopgpLog)
{
List<ExpTopgpLog> list = expTopgpLogService.selectExpTopgpLogList(expTopgpLog);
ExcelUtil<ExpTopgpLog> util = new ExcelUtil<ExpTopgpLog>(ExpTopgpLog.class);
return util.exportExcel(list, "ERP订阅推送日志数据");
}
/**
* 新增ERP订阅推送日志
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存ERP订阅推送日志
*/
@RequiresPermissions("bps:expTopgpLog:add")
@Log(title = "ERP订阅推送日志", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ExpTopgpLog expTopgpLog)
{
return toAjax(expTopgpLogService.insertExpTopgpLog(expTopgpLog));
}
/**
* 修改ERP订阅推送日志
*/
@GetMapping("/edit/{sid}")
public String edit(@PathVariable("sid") Long sid, ModelMap mmap)
{
ExpTopgpLog expTopgpLog = expTopgpLogService.selectExpTopgpLogBySid(sid);
mmap.put("expTopgpLog", expTopgpLog);
return prefix + "/edit";
}
/**
* 修改保存ERP订阅推送日志
*/
@RequiresPermissions("bps:expTopgpLog:edit")
@Log(title = "ERP订阅推送日志", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ExpTopgpLog expTopgpLog)
{
return toAjax(expTopgpLogService.updateExpTopgpLog(expTopgpLog));
}
/**
* 删除ERP订阅推送日志
*/
@RequiresPermissions("bps:expTopgpLog:remove")
@Log(title = "ERP订阅推送日志", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(expTopgpLogService.deleteExpTopgpLogBySids(ids));
}
}

View File

@ -5,10 +5,11 @@ package com.ruoyi.bps.controller;
//import com.ruoyi.bps.express.request.QueryTrackParam;
//import com.ruoyi.bps.express.response.QueryTrackResp;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.bps.service.IExpressService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.google.gson.Gson;
//import com.google.gson.Gson;
import com.kuaidi100.sdk.request.QueryTrackParam;
import com.kuaidi100.sdk.response.QueryTrackResp;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -62,7 +63,8 @@ public class QueryExpressController extends BaseController {
System.out.println("快递公司:" + queryTrackParam.getCom());
System.out.println("电话:" + queryTrackParam.getPhone());
String info=expressService.QueryTrackExpress(queryTrackParam);
QueryTrackResp queryTrackResp = new Gson().fromJson(info,QueryTrackResp.class);
//QueryTrackResp queryTrackResp = new Gson().fromJson(info,QueryTrackResp.class);
QueryTrackResp queryTrackResp= JSONObject.parseObject(info,QueryTrackResp.class);
result = new HashMap<>();
result.put("code", "1");
result.put("msg", "ok");

View File

@ -50,6 +50,14 @@ public class ExpSubscribe extends BaseEntity
@Excel(name = "返回消息")
private String message;
/** 返回消息 */
@Excel(name = "请求方")
private String requestFrom;
/** 返回消息 */
@Excel(name = "请求ID")
private String requestId;
public void setSid(Long sid)
{
this.sid = sid;
@ -132,6 +140,26 @@ public class ExpSubscribe extends BaseEntity
return message;
}
public void setRequestFrom(String requestFrom)
{
this.requestFrom = requestFrom;
}
public String getRequestFrom()
{
return requestFrom;
}
public void setRequestId(String requestId)
{
this.requestId = requestId;
}
public String getRequestId()
{
return requestId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -144,6 +172,8 @@ public class ExpSubscribe extends BaseEntity
.append("result", getResult())
.append("returnCode", getReturnCode())
.append("message", getMessage())
.append("message", getMessage())
.append("message", getMessage())
.toString();
}
}

View File

@ -0,0 +1,149 @@
package com.ruoyi.bps.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* ERP订阅推送日志对象 exp_topgp_log
*
* @author Bo
* @date 2021-08-11
*/
public class ExpTopgpLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** SID */
private Long sid;
/** 请求ID */
@Excel(name = "请求ID")
private String requestId;
/** 请求类型FromTopgpERP请求订阅、ToTopgpJava推送签收指令) */
@Excel(name = "请求类型", readConverterExp = "请求类型FromTopgpERP请求订阅、ToTopgpJava推送签收指令)")
private String requestType;
/** 快递单 */
@Excel(name = "快递单")
private String expressNumber;
/** 出货单号 */
@Excel(name = "出货单号")
private String deliveryNumber;
/** 请求报文 */
@Excel(name = "请求报文")
private String requestStr;
/** 请求时间 */
@Excel(name = "请求时间")
private String requestTime;
/** 返回code */
@Excel(name = "返回code")
private String responseCode;
/** 返回报文 */
@Excel(name = "返回报文")
private String responseStr;
public void setSid(Long sid)
{
this.sid = sid;
}
public Long getSid()
{
return sid;
}
public void setRequestId(String requestId)
{
this.requestId = requestId;
}
public String getRequestId()
{
return requestId;
}
public void setRequestType(String requestType)
{
this.requestType = requestType;
}
public String getRequestType()
{
return requestType;
}
public void setExpressNumber(String expressNumber)
{
this.expressNumber = expressNumber;
}
public String getExpressNumber()
{
return expressNumber;
}
public void setDeliveryNumber(String deliveryNumber)
{
this.deliveryNumber = deliveryNumber;
}
public String getDeliveryNumber()
{
return deliveryNumber;
}
public void setRequestStr(String requestStr)
{
this.requestStr = requestStr;
}
public String getRequestStr()
{
return requestStr;
}
public void setRequestTime(String requestTime)
{
this.requestTime = requestTime;
}
public String getRequestTime()
{
return requestTime;
}
public void setResponseCode(String responseCode)
{
this.responseCode = responseCode;
}
public String getResponseCode()
{
return responseCode;
}
public void setResponseStr(String responseStr)
{
this.responseStr = responseStr;
}
public String getResponseStr()
{
return responseStr;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("sid", getSid())
.append("requestId", getRequestId())
.append("requestType", getRequestType())
.append("expressNumber", getExpressNumber())
.append("deliveryNumber", getDeliveryNumber())
.append("requestStr", getRequestStr())
.append("requestTime", getRequestTime())
.append("responseCode", getResponseCode())
.append("responseStr", getResponseStr())
.toString();
}
}

View File

@ -36,7 +36,7 @@ public class ExpressInfo extends BaseEntity
private String ischeck;
/** 快递公司 */
@Excel(name = "快递公司",type= Excel.Type.EXPORT,dictType = "express_company")
@Excel(name = "快递公司",dictType= "express_company",dictTypeExceptImport = "true")
private String com;
/** 通信状态 */
@ -44,7 +44,7 @@ public class ExpressInfo extends BaseEntity
private String status;
/** 运单详情 */
@Excel(name = "运单详情",type= Excel.Type.EXPORT)
@Excel(name = "运单详情",type= Excel.Type.EXPORT,align = Excel.Align.LEFT)
private String data;
/** 当前状态 */

View File

@ -0,0 +1,61 @@
package com.ruoyi.bps.mapper;
import java.util.List;
import com.ruoyi.bps.domain.ExpTopgpLog;
/**
* ERP订阅推送日志Mapper接口
*
* @author Bo
* @date 2021-08-11
*/
public interface ExpTopgpLogMapper
{
/**
* 查询ERP订阅推送日志
*
* @param sid ERP订阅推送日志主键
* @return ERP订阅推送日志
*/
public ExpTopgpLog selectExpTopgpLogBySid(Long sid);
/**
* 查询ERP订阅推送日志列表
*
* @param expTopgpLog ERP订阅推送日志
* @return ERP订阅推送日志集合
*/
public List<ExpTopgpLog> selectExpTopgpLogList(ExpTopgpLog expTopgpLog);
/**
* 新增ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
public int insertExpTopgpLog(ExpTopgpLog expTopgpLog);
/**
* 修改ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
public int updateExpTopgpLog(ExpTopgpLog expTopgpLog);
/**
* 删除ERP订阅推送日志
*
* @param sid ERP订阅推送日志主键
* @return 结果
*/
public int deleteExpTopgpLogBySid(Long sid);
/**
* 批量删除ERP订阅推送日志
*
* @param sids 需要删除的数据主键集合
* @return 结果
*/
public int deleteExpTopgpLogBySids(String[] sids);
}

View File

@ -32,5 +32,5 @@ public interface IExpSubsPushApiService {
* @param request
* @return
*/
public String ExpressSubscribeWithTopgp(HttpServletRequest request) throws IOException;
public String ExpressSubscribeFromTopgp(HttpServletRequest request) throws IOException;
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.bps.service;
import java.util.List;
import com.ruoyi.bps.domain.ExpTopgpLog;
/**
* ERP订阅推送日志Service接口
*
* @author Bo
* @date 2021-08-11
*/
public interface IExpTopgpLogService
{
/**
* 查询ERP订阅推送日志
*
* @param sid ERP订阅推送日志主键
* @return ERP订阅推送日志
*/
public ExpTopgpLog selectExpTopgpLogBySid(Long sid);
/**
* 查询ERP订阅推送日志列表
*
* @param expTopgpLog ERP订阅推送日志
* @return ERP订阅推送日志集合
*/
public List<ExpTopgpLog> selectExpTopgpLogList(ExpTopgpLog expTopgpLog);
/**
* 新增ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
public int insertExpTopgpLog(ExpTopgpLog expTopgpLog);
/**
* 修改ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
public int updateExpTopgpLog(ExpTopgpLog expTopgpLog);
/**
* 批量删除ERP订阅推送日志
*
* @param sids 需要删除的ERP订阅推送日志主键集合
* @return 结果
*/
public int deleteExpTopgpLogBySids(String sids);
/**
* 删除ERP订阅推送日志信息
*
* @param sid ERP订阅推送日志主键
* @return 结果
*/
public int deleteExpTopgpLogBySid(Long sid);
}

View File

@ -133,6 +133,8 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
/* try{*/
//将查询到的快递结果放到expressInfoListForInsert并插入到数据库表expressInfo
for( ExpressInfo expressInfo:expressInfoList){
//去除快递单号中的头尾空白符
expressInfo.setNu(expressInfo.getNu().trim());
ExpressInfo ei= expressInfoService.SelectExpressInfo(expressInfo);
ei.setQueryId(queryId);
ei.setQueryUserName(ShiroUtils.getSysUser().getUserName());
@ -165,10 +167,5 @@ public class ExpImportQueryServiceImpl implements IExpImportQueryService
int message=expImportQueryMapper.insertExpImportQuery(expImportQuery);
return AjaxResult.success(message);
/*}catch (Exception e){
expImportQuery.setStatus("fail");
return AjaxResult.error(e.getMessage());
}*/
}
}

View File

@ -1,7 +1,7 @@
package com.ruoyi.bps.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
//import com.google.gson.Gson;
import com.kuaidi100.sdk.api.Subscribe;
import com.kuaidi100.sdk.contant.ApiInfoConstant;
import com.kuaidi100.sdk.core.IBaseClient;
@ -16,18 +16,25 @@ import com.kuaidi100.sdk.response.SubscribeResp;
import com.kuaidi100.sdk.utils.SignUtils;
import com.ruoyi.bps.domain.ExpSubsPushResp;
import com.ruoyi.bps.domain.ExpSubscribe;
import com.ruoyi.bps.domain.ExpTopgpLog;
import com.ruoyi.bps.service.IExpSubsPushApiService;
import com.ruoyi.bps.service.IExpSubsPushRespService;
import com.ruoyi.bps.service.IExpSubscribeService;
import com.ruoyi.bps.service.IExpTopgpLogService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.TopgpXmlUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -42,15 +49,22 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
String tid = PropertiesReader.get("tid");
String secret_key = PropertiesReader.get("secret_key");
String secret_secret = PropertiesReader.get("secret_secret"); */
private static final Logger log = LoggerFactory.getLogger(HttpUtils.class);
@Value("${express.key}")
private String key;
@Value("${topgp.webservice.toptest}")
private String webserviceUrl;
@Autowired
private IExpSubsPushRespService expSubsPushRespService;
@Autowired
IExpSubscribeService expSubscribeService;
@Autowired
IExpTopgpLogService expTopgpLogService;
/**
* 订阅快递
* @throws Exception
@ -58,14 +72,28 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
@Override
public SubscribeResp ExpressSubscribe(ExpSubscribe expSubscribe) {
String loginFrom= expSubscribe.getSalt();
String subscribeFrom= StringUtils.isNotEmpty(loginFrom)?loginFrom.equals("topgp")?"topgp":"localhost":"localhost";
//如果订阅来源是topgp则来源为topgp,否则为local
/*String loginFrom= expSubscribe.getSalt();
String subscribeFrom= StringUtils.isNotEmpty(loginFrom)?loginFrom.equals("topgp")?"topgp":"local":"local";*/
if(StringUtils.isEmpty(expSubscribe.getRequestFrom())){
expSubscribe.setRequestFrom("local");
}
SubscribeParameters subscribeParameters = new SubscribeParameters();
if( StringUtils.isEmpty(expSubscribe.getRequestId())) {
//expSubscribe.setRequestId("local"+System.currentTimeMillis()); //获取时间戳,生成本地请求的requestId
expSubscribe.setRequestId("local"+ LocalDateTime.now());
}
if(StringUtils.isEmpty(expSubscribe.getSubscribeTime())){
expSubscribe.setSubscribeTime(DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"));
}
String salt="bpsemi"; //定义salt字符串
//组合订阅参数
SubscribeParameters subscribeParameters = new SubscribeParameters();
SubscribeResp subscribeResp = new SubscribeResp();
subscribeParameters.setCallbackurl("http://report.bpsemi.cn:8081/it_war/anon/subscribeCallBackUrl");
subscribeParameters.setPhone(expSubscribe.getPhone());
subscribeParameters.setSalt("bpsemi");
subscribeParameters.setSalt(salt);
SubscribeParam subscribeParam = new SubscribeParam();
subscribeParam.setParameters(subscribeParameters);
subscribeParam.setCompany(expSubscribe.getCompany());
@ -74,13 +102,15 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
SubscribeReq subscribeReq = new SubscribeReq();
subscribeReq.setSchema(ApiInfoConstant.SUBSCRIBE_SCHEMA);
subscribeReq.setParam(new Gson().toJson(subscribeParam));
//subscribeReq.setParam(new Gson().toJson(subscribeParam));
subscribeReq.setParam(JSONObject.toJSONString(subscribeParam));
IBaseClient subscribe = new Subscribe();
try{
//推送订阅并获得快递100响应结果
HttpResult httpResult= subscribe.execute(subscribeReq);
//System.out.println(httpResult);
subscribeResp= new Gson().fromJson(httpResult.getBody(),SubscribeResp.class);
//subscribeResp= new Gson().fromJson(httpResult.getBody(),SubscribeResp.class);
subscribeResp = JSONObject.parseObject(httpResult.getBody(),SubscribeResp.class);
}catch (Exception e)
{
return subscribeResp;
@ -91,16 +121,20 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
return subscribeResp;
}
//订阅记录写入数据库
ExpSubscribe newExpSubscribe = new ExpSubscribe();
newExpSubscribe.setSid(expSubscribe.getSid()); //将时间戳设为Sid 210810 yangbo
newExpSubscribe.setCompany(expSubscribe.getCompany());
newExpSubscribe.setNumber(expSubscribe.getNumber());
newExpSubscribe.setPhone(expSubscribe.getPhone());
newExpSubscribe.setSalt(subscribeFrom); //偷懒把请求来源记录到salt栏位不再增加exp_subscribe字段了以后找时间改吧
newExpSubscribe.setSubscribeTime(DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"));
newExpSubscribe.setSalt(salt);
newExpSubscribe.setSubscribeTime(expSubscribe.getSubscribeTime());
newExpSubscribe.setResult((subscribeResp.isResult())?"true":"false");
newExpSubscribe.setReturnCode(subscribeResp.getReturnCode());
newExpSubscribe.setMessage(subscribeResp.getMessage());
newExpSubscribe.setRequestFrom(expSubscribe.getRequestFrom());
newExpSubscribe.setRequestId(expSubscribe.getRequestId());
/*ExpSubscribe queryExpSubscribe = new ExpSubscribe();
queryExpSubscribe.setCompany(expSubscribe.getCompany());
@ -126,8 +160,91 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
return subscribeResp;
}
/**
* 获取从快递100订阅的快递推送信息并返回响应结果
* 处理Topgp推送的快递订阅请求向快递100推送订阅请求并将结果返回给TOPGP
*
* @param request
* @return
*/
@Override
public String ExpressSubscribeFromTopgp(HttpServletRequest request) throws IOException {
//定义Return变量
String retrunStr;
//获取httpServletRequest传过来的Json字符串并进行解析
JSONObject contentJson= JSONObject.parseObject(ServletUtils.getRequestContent(request));
if(StringUtils.isEmpty(contentJson)){
return "貌似没有接受到任何参数!";
}
String requestId=contentJson.getString("requestId"); //TOPGP请求ID年月日时分稍毫秒
String deliveryNo= contentJson.getString("deliveryNo"); //TOPGP出货单号
String expressNo = contentJson.getString("expressNo"); //TOPGP快递单号
String company = contentJson.getString("company"); //TOPGP物流公司编号
String phone = contentJson.getString("phone"); //TOPGP出货单号
//Long timeStamp = System.currentTimeMillis(); //获取时间戳
String subscribeTime= DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss"); //获取订阅时间
SubscribeResp subscribeResp=new SubscribeResp();
//如果请求ID出货单号或者快递单号为空,则不向快递100请求订阅自己组合返回信息
if(StringUtils.isEmpty(deliveryNo) || StringUtils.isEmpty(expressNo) || StringUtils.isEmpty(requestId)){
subscribeResp.setMessage("请求ID、快递单号或出货单号不可为空");
subscribeResp.setResult(false);
subscribeResp.setReturnCode("700");
}else {
//组合向快递100推送订阅请求的参数
ExpSubscribe expSubscribe=new ExpSubscribe();
expSubscribe.setSid(Long.getLong(requestId)); //时间戳
expSubscribe.setNumber(expressNo);
expSubscribe.setCompany(company);
expSubscribe.setPhone(phone);
expSubscribe.setSubscribeTime(subscribeTime); //订阅时间
expSubscribe.setSalt("topgp"); //
//向快递100推送订阅请求取得订阅返回结果
subscribeResp= ExpressSubscribe(expSubscribe);
}
//根据快递100的订阅返回结果组合返回Topgp的JSON字符串
Map<String,Object> map= new HashMap<>();
map.put("requestId",requestId); //从TOPGP传过来的requestId 时间戳
map.put("deliveryNo",deliveryNo); //出货单号
map.put("expressNo",expressNo); //快递单号
map.put("responseStr",subscribeResp.getMessage()); //返回消息
map.put("responseCode",subscribeResp.getReturnCode()); //返回码
map.put("result",subscribeResp.isResult()); //订阅结果
//返回Json字符串给TOPGP
retrunStr= JSONObject.toJSONString(map);
//记录本次TOPGP订阅请求的Log
ExpTopgpLog expTopgpLog=new ExpTopgpLog();
expTopgpLog.setRequestId(requestId);
expTopgpLog.setRequestType("fromTopgp");
expTopgpLog.setExpressNumber(expressNo);
expTopgpLog.setDeliveryNumber(deliveryNo);
expTopgpLog.setRequestStr(contentJson.toString());
expTopgpLog.setRequestTime(subscribeTime);
expTopgpLog.setResponseCode(subscribeResp.getReturnCode());
expTopgpLog.setResponseStr(retrunStr);
expTopgpLogService.insertExpTopgpLog(expTopgpLog);
//返回TOPGP json字符串
return retrunStr;
}
public JSONObject SendRequestToTopgp( String url,String tip,Map<String,Object> map) {
String param = TopgpXmlUtils.GetTopgpRequestXml(tip, map);
String returnXml = HttpUtils.sendXmlPost(url, param);
return TopgpXmlUtils.GetStatusFromTopgpResponse(returnXml);
}
/**
* 处理快递100订阅的快递推送信息并返回响应结果
*
* @param request 快递100推送的订阅信息
* @return 结果
@ -161,7 +278,8 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
//加密相等继续处理业务逻辑
subscribeResp.setMessage("接受成功!加密验证通过【sign】"+sign+"【ourSign】"+ourSign);
SubscribePushParamResp subscribePushParamResp = new Gson().fromJson(param, SubscribePushParamResp.class);
//SubscribePushParamResp subscribePushParamResp = new Gson().fromJson(param, SubscribePushParamResp.class);
SubscribePushParamResp subscribePushParamResp=JSONObject.parseObject(param,SubscribePushParamResp.class);
SubscribePushResult subscribePushResult = subscribePushParamResp.getLastResult();
//快递单号
String nu = subscribePushResult.getNu();
@ -175,10 +293,48 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
}
//快递单当前状态 0在途1揽收2疑难3签收4退签5派件6退回7转单10待清关11清关中12已清关13清关异常14收件人拒签)
String state = subscribePushResult.getState();
//if(state.equals("3")){
//处理签收逻辑
//如果是快递100推送的快递单状态为签收state=3,并且TOPGP未反馈该快递单已被签收
if(state.equals("3")) {
//如果该快递信息没有推送给TOPGP且TOPGP已反馈生成签收单成功记录则推送给TOPGP
ExpTopgpLog expTopgpLog=new ExpTopgpLog();
expTopgpLog.setExpressNumber(subscribePushResult.getNu());
expTopgpLog.setRequestType("toTopgp");
expTopgpLog.setResponseCode("200");
List<ExpTopgpLog> expTopgpLogList= expTopgpLogService.selectExpTopgpLogList(expTopgpLog);
if(null==expTopgpLogList || expTopgpLogList.size()<1){
Map<String, Object> requestMap = new HashMap<>();
requestMap.put("expressNum", subscribePushResult.getNu());
requestMap.put("expressCom", subscribePushResult.getCom());
requestMap.put("expressState", subscribePushResult.getState());
//一个快递单号对应多个出货单请求
//调用topgp Webservice接口
//topgp返回的
JSONObject jsonObject= SendRequestToTopgp(webserviceUrl, "express_testRequest",requestMap);
log.info(jsonObject.toJSONString());
if(jsonObject.getString("returnCode").equals("200")){
//一个快递单号对应多个出货单号怎么处理如果有多个出货单号部分已签收部分未签收又怎么处理 如果推送到ERP时ERP已经人工生成签收单了又该怎么处理
}
}
}
//将快递流转状态存入数据库
ExpSubsPushResp expSubsPushResp=new ExpSubsPushResp();
expSubsPushRespService.insertExpSubsPushResp(ToExpSubsPushResp(subscribePushParamResp)); //无论数据库中存在快递单号+快递公司编码都更新数据库 210809 yangbo 修正
/*ExpSubsPushResp expSubsPushResp=new ExpSubsPushResp();
expSubsPushResp.setLastResultNu(subscribePushResult.getNu());
expSubsPushResp.setLastResultCom(subscribePushResult.getCom());
List<ExpSubsPushResp> list=expSubsPushRespService.selectExpSubsPushRespList(expSubsPushResp);
@ -193,8 +349,8 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
}else {
//如果数据库中没有快递单号+快递公司编码则更插入新记录
expSubsPushRespService.insertExpSubsPushResp(ToExpSubsPushResp(subscribePushParamResp));
}
// }
}*/
return subscribeResp;
}
@ -265,57 +421,6 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
}
/**
* 获取Topgp推送的快递信息向快递100推送订阅请求
*
* @param request
* @return
*/
@Override
public String ExpressSubscribeWithTopgp(HttpServletRequest request) throws IOException {
//获取httpServletRequest传过来的Json字符串并进行解析
JSONObject contentJson= JSONObject.parseObject(ServletUtils.getRequestContent(request));
String deliveryNo= contentJson.getString("deliveryNo");
String expressNo = contentJson.getString("expressNo");
String company = contentJson.getString("company");
String phone = contentJson.getString("phone");
//如果出货单号或者快递单号为空则返回错误信息并写入Logo
if(StringUtils.isEmpty(deliveryNo) || StringUtils.isEmpty(expressNo)){
SubscribeResp subscribeResp=new SubscribeResp();
subscribeResp.setMessage("快递单号或出货单号为空");
subscribeResp.setResult(false);
subscribeResp.setReturnCode("700");
Map<String,Object> map=new HashMap<>();
map.put("subscribeResp",subscribeResp);
map.put("deliveryNo",deliveryNo);
map.put("expressNo",expressNo);
//写入Logo
//todo
//返回错误信息
return JSONObject.toJSONString(map);
}
//向快递100推送订阅请求
ExpSubscribe expSubscribe=new ExpSubscribe();
expSubscribe.setNumber(expressNo);
expSubscribe.setCompany(company);
expSubscribe.setPhone(phone);
expSubscribe.setSalt("topgp"); //偷懒把请求来源记录到salt栏位不再增加exp_subscribe字段了以后找时间改吧
SubscribeResp subscribeResp= ExpressSubscribe(expSubscribe);
/*Object object = JSONObject.toJSON(subscribeResp);
Map map=JSONObject.parseObject(object.toString(), Map.class);*/
Map<String,Object> map= new HashMap<>();
map.put("expSubscribe",subscribeResp);
map.put("deliveryNo",deliveryNo);
map.put("expressNo",expressNo);
return JSONObject.toJSONString(map);
}
}

View File

@ -0,0 +1,94 @@
package com.ruoyi.bps.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bps.mapper.ExpTopgpLogMapper;
import com.ruoyi.bps.domain.ExpTopgpLog;
import com.ruoyi.bps.service.IExpTopgpLogService;
import com.ruoyi.common.core.text.Convert;
/**
* ERP订阅推送日志Service业务层处理
*
* @author Bo
* @date 2021-08-11
*/
@Service
public class ExpTopgpLogServiceImpl implements IExpTopgpLogService
{
@Autowired
private ExpTopgpLogMapper expTopgpLogMapper;
/**
* 查询ERP订阅推送日志
*
* @param sid ERP订阅推送日志主键
* @return ERP订阅推送日志
*/
@Override
public ExpTopgpLog selectExpTopgpLogBySid(Long sid)
{
return expTopgpLogMapper.selectExpTopgpLogBySid(sid);
}
/**
* 查询ERP订阅推送日志列表
*
* @param expTopgpLog ERP订阅推送日志
* @return ERP订阅推送日志
*/
@Override
public List<ExpTopgpLog> selectExpTopgpLogList(ExpTopgpLog expTopgpLog)
{
return expTopgpLogMapper.selectExpTopgpLogList(expTopgpLog);
}
/**
* 新增ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
@Override
public int insertExpTopgpLog(ExpTopgpLog expTopgpLog)
{
return expTopgpLogMapper.insertExpTopgpLog(expTopgpLog);
}
/**
* 修改ERP订阅推送日志
*
* @param expTopgpLog ERP订阅推送日志
* @return 结果
*/
@Override
public int updateExpTopgpLog(ExpTopgpLog expTopgpLog)
{
return expTopgpLogMapper.updateExpTopgpLog(expTopgpLog);
}
/**
* 批量删除ERP订阅推送日志
*
* @param sids 需要删除的ERP订阅推送日志主键
* @return 结果
*/
@Override
public int deleteExpTopgpLogBySids(String sids)
{
return expTopgpLogMapper.deleteExpTopgpLogBySids(Convert.toStrArray(sids));
}
/**
* 删除ERP订阅推送日志信息
*
* @param sid ERP订阅推送日志主键
* @return 结果
*/
@Override
public int deleteExpTopgpLogBySid(Long sid)
{
return expTopgpLogMapper.deleteExpTopgpLogBySid(sid);
}
}

View File

@ -1,5 +1,8 @@
package com.ruoyi.bps.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.bps.domain.ExpressInfo;
import com.ruoyi.bps.mapper.ExpressInfoMapper;
import com.ruoyi.bps.service.IExpressInfoService;
@ -7,7 +10,7 @@ import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.google.gson.Gson;
//import com.google.gson.Gson;
import com.kuaidi100.sdk.api.AutoNum;
import com.kuaidi100.sdk.api.QueryTrack;
import com.kuaidi100.sdk.core.IBaseClient;
@ -131,12 +134,18 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
callbackExpressInfo.setPhone(phone);
callbackExpressInfo.setDeliveryNum(deliveryNum);
//如果没有输入快递公司编号则查询快递公司编号
if(StringUtils.isEmpty(com)){
if(AutoGetExpressCom(nu)==null){
callbackExpressInfo.setData("请提供要查询的快递所属物流公司编号!");
if(StringUtils.isEmpty(com)){
List<AutoNumResp> list= AutoGetExpressCom(nu);
if(null==list || list.size()<1){
callbackExpressInfo.setData("请提供要查询的快递所属物流公司编号!,且根据快递单号没有查询到物流公司编号!");
return callbackExpressInfo;
}
com=AutoGetExpressCom(nu).getComCode();
if (list.size()>1)
{
callbackExpressInfo.setData("您没有提供要查询的快递所属物流公司编号,且根据快递单号查询到多个物流公司编号");
return callbackExpressInfo;
}
com=list.get(0).getComCode();
}
callbackExpressInfo.setCom(com);
@ -152,7 +161,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
queryTrackParam.setPhone(expressInfo.getPhone());
//获取快递信息
String param = new Gson().toJson(queryTrackParam);
//String param = new Gson().toJson(queryTrackParam);
String param= JSONObject.toJSONString(queryTrackParam);
QueryTrackReq queryTrackReq=new QueryTrackReq();
queryTrackReq.setParam(param);
queryTrackReq.setCustomer(customer);
@ -168,7 +178,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
}
//将快递信息转化为QueryTrackResp对象
QueryTrackResp queryTrackResp = new Gson().fromJson(msg,QueryTrackResp.class);
//QueryTrackResp queryTrackResp = new Gson().fromJson(msg,QueryTrackResp.class);
QueryTrackResp queryTrackResp= JSONObject.parseObject(msg,QueryTrackResp.class);
//如果没有查到物流信息则返回错误信息
if(StringUtils.isEmpty(queryTrackResp.getStatus()) || !queryTrackResp.getStatus().equals("200")){
@ -233,21 +244,30 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
* @return 快递公司编码
*/
private AutoNumResp AutoGetExpressCom(String num){
private List<AutoNumResp> AutoGetExpressCom(String num){
AutoNumReq autoNumReq = new AutoNumReq();
autoNumReq.setKey(key);
autoNumReq.setNum(num);
autoNumReq.setNum(num.trim());
IBaseClient baseClient = new AutoNum();
AutoNumResp autoNumResp=new AutoNumResp();
//AutoNumResp autoNumResp=new AutoNumResp();
List<AutoNumResp> autoNumRespList=new ArrayList<>();
try {
String str= baseClient.execute(autoNumReq).getBody().replace("[","").replace("]","");
autoNumResp = new Gson().fromJson(str,AutoNumResp.class);
JSONArray jsonArray= JSONArray.parseArray(baseClient.execute(autoNumReq).getBody());
if(StringUtils.isEmpty(jsonArray))
{
return null;
}
for (Object object:jsonArray)
{
autoNumRespList.add(JSONObject.parseObject(JSONObject.toJSONString(object),AutoNumResp.class));
}
} catch (Exception e) {
e.printStackTrace();
}
return autoNumResp;
//return autoNumResp;
return autoNumRespList;
}
/**

View File

@ -1,7 +1,9 @@
package com.ruoyi.bps.service.impl;
import com.google.gson.Gson;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
//import com.google.gson.Gson;
import com.kuaidi100.sdk.api.QueryTrack;
import com.kuaidi100.sdk.api.Subscribe;
import com.kuaidi100.sdk.contant.ApiInfoConstant;
@ -12,7 +14,7 @@ import com.kuaidi100.sdk.response.QueryTrackResp;
import com.kuaidi100.sdk.utils.PropertiesReader;
import com.kuaidi100.sdk.utils.SignUtils;
import com.ruoyi.bps.service.IExpressService;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -22,20 +24,7 @@ import java.util.List;
@Service
public class ExpressServiceImpl implements IExpressService {
/*
String key = "Jydbrxsm2311";
String customer = "2DD48B3469B82F2B7700569093AB792B";
String secret = "8781ed9b35a7438499eb02fee915915a";
String userid = "2a62da2192c24d17a943ff78ee64f8c6";
*/
/*String key = PropertiesReader.get("key");
String customer = PropertiesReader.get("customer");
String secret = PropertiesReader.get("secret");
String siid = PropertiesReader.get("siid");
String userid = PropertiesReader.get("userid");
String tid = PropertiesReader.get("tid");
String secret_key = PropertiesReader.get("secret_key");
String secret_secret = PropertiesReader.get("secret_secret");*/
/*String key = PropertiesReader.get("key");*/
@Value("${express.key}")
private String key;
@ -53,7 +42,8 @@ public class ExpressServiceImpl implements IExpressService {
for(QueryTrackParam queryTrackParam:list)
{
QueryTrackResp queryTrackResp = new Gson().fromJson(expressService.QueryTrackExpress(queryTrackParam),QueryTrackResp.class);
//QueryTrackResp queryTrackResp = new Gson().fromJson(expressService.QueryTrackExpress(queryTrackParam),QueryTrackResp.class);
QueryTrackResp queryTrackResp= JSONObject.parseObject(expressService.QueryTrackExpress(queryTrackParam),QueryTrackResp.class);
qtList.add(queryTrackResp);
}
return qtList;
@ -78,7 +68,8 @@ public class ExpressServiceImpl implements IExpressService {
public String QueryTrackExpress(QueryTrackParam queryTrackParam) {
String str="";
QueryTrackReq queryTrackReq = new QueryTrackReq();
String param = new Gson().toJson(queryTrackParam);
//String param = new Gson().toJson(queryTrackParam);
String param = JSONObject.toJSONString(queryTrackParam);
queryTrackReq.setParam(param);
queryTrackReq.setCustomer(customer);
@ -93,24 +84,17 @@ public class ExpressServiceImpl implements IExpressService {
msg=e.toString();
}
JSONObject jsonObject = new JSONObject(msg);
if (jsonObject.has("returnCode")){
QueryTrackResp queryTrackResp= new Gson().fromJson(msg,QueryTrackResp.class);
//JSONObject jsonObject = new JSONObject(msg);
JSONObject jsonObject = JSON.parseObject(msg);
if (jsonObject.containsKey("returnCode")){
//QueryTrackResp queryTrackResp= new Gson().fromJson(msg,QueryTrackResp.class);
QueryTrackResp queryTrackResp= JSONObject.parseObject(msg,QueryTrackResp.class);
queryTrackResp.setStatus(queryTrackResp.getReturnCode());
queryTrackResp.setNu(queryTrackParam.getNum());
msg= new Gson().toJson(queryTrackResp);
//msg= new Gson().toJson(queryTrackResp);
msg= JSONObject.toJSONString(queryTrackResp);
}
/* else {
QueryTrackResp queryTrackResp=new Gson().fromJson(msg,QueryTrackResp.class);
for(int i=0;i<queryTrackResp.getData().size();i++) {
QueryTrackData queryTrackData = queryTrackResp.getData().get(i);
str += "时间:" + queryTrackData.getTime();
str += " 物流信息:" + queryTrackData.getContext();
str += " 格式化后时间+" + queryTrackData.getFtime();
} *
}*/
// System.out.println(msg);
return msg;
}
@ -130,7 +114,8 @@ public class ExpressServiceImpl implements IExpressService {
SubscribeReq subscribeReq = new SubscribeReq();
subscribeReq.setSchema(ApiInfoConstant.SUBSCRIBE_SCHEMA); //返回的数据格式必须
subscribeReq.setParam(new Gson().toJson(subscribeParam));
//subscribeReq.setParam(new Gson().toJson(subscribeParam));
subscribeReq.setParam(JSONObject.toJSONString(subscribeParam));
IBaseClient subscribe = new Subscribe();
try{

View File

@ -14,10 +14,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="result" column="result" />
<result property="returnCode" column="returnCode" />
<result property="message" column="message" />
<result property="requestFrom" column="requestFrom" />
<result property="requestId" column="requestId" />
</resultMap>
<sql id="selectExpSubscribeVo">
select sid, company, number, phone, salt, subscribeTime, result, returnCode, message from exp_subscribe
select sid, company, number, phone, salt, subscribeTime, result, returnCode, message, requestFrom, requestId from exp_subscribe
</sql>
<select id="selectExpSubscribeList" parameterType="ExpSubscribe" resultMap="ExpSubscribeResult">
@ -29,6 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="subscribeTime != null and subscribeTime != ''"> and subscribeTime like concat('%', #{subscribeTime}, '%')</if>
<if test="result != null and result != ''"> and result = #{result}</if>
<if test="returnCode != null and returnCode != ''"> and returnCode = #{returnCode}</if>
<if test="requestFrom != null and requestFrom != ''"> and requestFrom = #{requestFrom}</if>
<if test="requestId != null and requestId != ''"> and requestId = #{requestId}</if>
</where>
</select>
@ -48,6 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="result != null">result,</if>
<if test="returnCode != null">returnCode,</if>
<if test="message != null">message,</if>
<if test="requestFrom != null">requestFrom,</if>
<if test="requestId != null">requestId,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="company != null">#{company},</if>
@ -58,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="result != null">#{result},</if>
<if test="returnCode != null">#{returnCode},</if>
<if test="message != null">#{message},</if>
<if test="requestFrom != null">#{requestFrom},</if>
<if test="requestId != null">#{requestId},</if>
</trim>
</insert>
@ -72,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="result != null">result = #{result},</if>
<if test="returnCode != null">returnCode = #{returnCode},</if>
<if test="message != null">message = #{message},</if>
<if test="requestFrom != null">requestFrom = #{requestFrom},</if>
<if test="requestId != null">requestId = #{requestId},</if>
</trim>
where sid = #{sid}
</update>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.bps.mapper.ExpTopgpLogMapper">
<resultMap type="ExpTopgpLog" id="ExpTopgpLogResult">
<result property="sid" column="sid" />
<result property="requestId" column="requestId" />
<result property="requestType" column="requestType" />
<result property="expressNumber" column="expressNumber" />
<result property="deliveryNumber" column="deliveryNumber" />
<result property="requestStr" column="requestStr" />
<result property="requestTime" column="requestTime" />
<result property="responseCode" column="responseCode" />
<result property="responseStr" column="responseStr" />
</resultMap>
<sql id="selectExpTopgpLogVo">
select sid, requestId, requestType, expressNumber, deliveryNumber, requestStr, requestTime, responseCode, responseStr from exp_topgp_log
</sql>
<select id="selectExpTopgpLogList" parameterType="ExpTopgpLog" resultMap="ExpTopgpLogResult">
<include refid="selectExpTopgpLogVo"/>
<where>
<if test="requestId != null and requestId != ''"> and requestId = #{requestId}</if>
<if test="requestType != null and requestType != ''"> and requestType = #{requestType}</if>
<if test="expressNumber != null and expressNumber != ''"> and expressNumber = #{expressNumber}</if>
<if test="deliveryNumber != null and deliveryNumber != ''"> and deliveryNumber = #{deliveryNumber}</if>
<if test="requestStr != null and requestStr != ''"> and requestStr = #{requestStr}</if>
<if test="requestTime != null and requestTime != ''"> and requestTime = #{requestTime}</if>
<if test="responseCode != null and responseCode != ''"> and responseCode = #{responseCode}</if>
<if test="responseStr != null and responseStr != ''"> and responseStr = #{responseStr}</if>
</where>
</select>
<select id="selectExpTopgpLogBySid" parameterType="Long" resultMap="ExpTopgpLogResult">
<include refid="selectExpTopgpLogVo"/>
where sid = #{sid}
</select>
<insert id="insertExpTopgpLog" parameterType="ExpTopgpLog" useGeneratedKeys="true" keyProperty="sid">
insert into exp_topgp_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="requestId != null">requestId,</if>
<if test="requestType != null">requestType,</if>
<if test="expressNumber != null">expressNumber,</if>
<if test="deliveryNumber != null">deliveryNumber,</if>
<if test="requestStr != null">requestStr,</if>
<if test="requestTime != null">requestTime,</if>
<if test="responseCode != null">responseCode,</if>
<if test="responseStr != null">responseStr,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="requestId != null">#{requestId},</if>
<if test="requestType != null">#{requestType},</if>
<if test="expressNumber != null">#{expressNumber},</if>
<if test="deliveryNumber != null">#{deliveryNumber},</if>
<if test="requestStr != null">#{requestStr},</if>
<if test="requestTime != null">#{requestTime},</if>
<if test="responseCode != null">#{responseCode},</if>
<if test="responseStr != null">#{responseStr},</if>
</trim>
</insert>
<update id="updateExpTopgpLog" parameterType="ExpTopgpLog">
update exp_topgp_log
<trim prefix="SET" suffixOverrides=",">
<if test="requestId != null">requestId = #{requestId},</if>
<if test="requestType != null">requestType = #{requestType},</if>
<if test="expressNumber != null">expressNumber = #{expressNumber},</if>
<if test="deliveryNumber != null">deliveryNumber = #{deliveryNumber},</if>
<if test="requestStr != null">requestStr = #{requestStr},</if>
<if test="requestTime != null">requestTime = #{requestTime},</if>
<if test="responseCode != null">responseCode = #{responseCode},</if>
<if test="responseStr != null">responseStr = #{responseStr},</if>
</trim>
where sid = #{sid}
</update>
<delete id="deleteExpTopgpLogBySid" parameterType="Long">
delete from exp_topgp_log where sid = #{sid}
</delete>
<delete id="deleteExpTopgpLogBySids" parameterType="String">
delete from exp_topgp_log where sid in
<foreach item="sid" collection="array" open="(" separator="," close=")">
#{sid}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增ERP订阅推送日志')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-expTopgpLog-add">
<div class="form-group">
<label class="col-sm-3 control-label">请求ID</label>
<div class="col-sm-8">
<input name="requestId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求类型:</label>
<div class="col-sm-8">
<input name="requestType" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">快递单:</label>
<div class="col-sm-8">
<input name="expressNumber" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">出货单号:</label>
<div class="col-sm-8">
<input name="deliveryNumber" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求报文:</label>
<div class="col-sm-8">
<textarea name="requestStr" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求时间:</label>
<div class="col-sm-8">
<input name="requestTime" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回code</label>
<div class="col-sm-8">
<input name="responseCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回报文:</label>
<div class="col-sm-8">
<textarea name="responseStr" class="form-control"></textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "bps/expTopgpLog"
$("#form-expTopgpLog-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-expTopgpLog-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改ERP订阅推送日志')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-expTopgpLog-edit" th:object="${expTopgpLog}">
<input name="sid" th:field="*{sid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">请求ID</label>
<div class="col-sm-8">
<input name="requestId" th:field="*{requestId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求类型:</label>
<div class="col-sm-8">
<input name="requestType" th:field="*{requestType}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">快递单:</label>
<div class="col-sm-8">
<input name="expressNumber" th:field="*{expressNumber}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">出货单号:</label>
<div class="col-sm-8">
<input name="deliveryNumber" th:field="*{deliveryNumber}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求报文:</label>
<div class="col-sm-8">
<textarea name="requestStr" class="form-control">[[*{requestStr}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请求时间:</label>
<div class="col-sm-8">
<input name="requestTime" th:field="*{requestTime}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回code</label>
<div class="col-sm-8">
<input name="responseCode" th:field="*{responseCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">返回报文:</label>
<div class="col-sm-8">
<textarea name="responseStr" class="form-control">[[*{responseStr}]]</textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "bps/expTopgpLog";
$("#form-expTopgpLog-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-expTopgpLog-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('ERP订阅推送日志列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>请求ID</label>
<input type="text" name="requestId"/>
</li>
<li>
<label>请求类型:</label>
<input type="text" name="requestType"/>
</li>
<li>
<label>快递单:</label>
<input type="text" name="expressNumber"/>
</li>
<li>
<label>出货单号:</label>
<input type="text" name="deliveryNumber"/>
</li>
<li>
<label>请求时间:</label>
<input type="text" name="requestTime"/>
</li>
<li>
<label>返回code</label>
<input type="text" name="responseCode"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="bps:expTopgpLog:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="bps:expTopgpLog:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="bps:expTopgpLog:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="bps:expTopgpLog:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('bps:expTopgpLog:edit')}]];
var removeFlag = [[${@permission.hasPermi('bps:expTopgpLog:remove')}]];
var prefix = ctx + "bps/expTopgpLog";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
sortName: "requesttime", //不要用驼峰式变量requestTimemybatis会转换成request_time
sortOrder: "desc",
modalName: "ERP订阅推送日志",
columns: [{
checkbox: true
},
{
field: 'sid',
title: 'SID',
visible: false
},
{
field: 'requestId',
title: '请求ID'
},
{
field: 'requestType',
title: '请求类型'
},
{
field: 'expressNumber',
title: '快递单'
},
{
field: 'deliveryNumber',
title: '出货单号'
},
{
field: 'requestStr',
title: '请求报文'
},
{
field: 'requestTime',
title: '请求时间'
},
{
field: 'responseCode',
title: '返回code'
},
{
field: 'responseStr',
title: '返回报文'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.sid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.sid + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -1,6 +1,6 @@
package com.ruoyi.web.controller.common;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -17,7 +17,6 @@ import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.config.ServerConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.FileInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
@ -35,6 +34,8 @@ public class CommonController
@Autowired
private ServerConfig serverConfig;
private static final String FILE_DELIMETER = ",";
/**
* 通用下载请求
*
@ -103,15 +104,20 @@ public class CommonController
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
List<FileInfo> fileInfos = new LinkedList<FileInfo>();
List<String> fileNames = new ArrayList<String>();
List<String> urls = new ArrayList<String>();
for (MultipartFile file : files)
{
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
fileInfos.add(new FileInfo(fileName, url));
fileNames.add(fileName);
urls.add(url);
}
return AjaxResult.success(fileInfos);
AjaxResult ajax = AjaxResult.success();
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
return ajax;
}
catch (Exception e)
{

View File

@ -17,7 +17,6 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
@ -89,7 +88,7 @@ public class SysConfigController extends BaseController
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(ShiroUtils.getLoginName());
config.setCreateBy(getLoginName());
return toAjax(configService.insertConfig(config));
}
@ -116,7 +115,7 @@ public class SysConfigController extends BaseController
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(ShiroUtils.getLoginName());
config.setUpdateBy(getLoginName());
return toAjax(configService.updateConfig(config));
}

View File

@ -21,7 +21,6 @@ import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
@ -64,9 +63,9 @@ public class SysDeptController extends BaseController
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{
if (!ShiroUtils.getSysUser().isAdmin())
if (!getSysUser().isAdmin())
{
parentId = ShiroUtils.getSysUser().getDeptId();
parentId = getSysUser().getDeptId();
}
mmap.put("dept", deptService.selectDeptById(parentId));
return prefix + "/add";
@ -85,7 +84,7 @@ public class SysDeptController extends BaseController
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(ShiroUtils.getLoginName());
dept.setCreateBy(getLoginName());
return toAjax(deptService.insertDept(dept));
}
@ -126,7 +125,7 @@ public class SysDeptController extends BaseController
{
return AjaxResult.error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(ShiroUtils.getLoginName());
dept.setUpdateBy(getLoginName());
return toAjax(deptService.updateDept(dept));
}

View File

@ -17,7 +17,6 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService;
@ -82,7 +81,7 @@ public class SysDictDataController extends BaseController
@ResponseBody
public AjaxResult addSave(@Validated SysDictData dict)
{
dict.setCreateBy(ShiroUtils.getLoginName());
dict.setCreateBy(getLoginName());
return toAjax(dictDataService.insertDictData(dict));
}
@ -105,7 +104,7 @@ public class SysDictDataController extends BaseController
@ResponseBody
public AjaxResult editSave(@Validated SysDictData dict)
{
dict.setUpdateBy(ShiroUtils.getLoginName());
dict.setUpdateBy(getLoginName());
return toAjax(dictDataService.updateDictData(dict));
}

View File

@ -19,7 +19,6 @@ import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService;
@ -88,7 +87,7 @@ public class SysDictTypeController extends BaseController
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(ShiroUtils.getLoginName());
dict.setCreateBy(getLoginName());
return toAjax(dictTypeService.insertDictType(dict));
}
@ -115,7 +114,7 @@ public class SysDictTypeController extends BaseController
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(ShiroUtils.getLoginName());
dict.setUpdateBy(getLoginName());
return toAjax(dictTypeService.updateDictType(dict));
}

View File

@ -24,7 +24,6 @@ import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.CookieUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.service.ISysConfigService;
@ -52,7 +51,7 @@ public class SysIndexController extends BaseController
public String index(ModelMap mmap)
{
// 取身份信息
SysUser user = ShiroUtils.getSysUser();
SysUser user = getSysUser();
// 根据用户id取出菜单
List<SysMenu> menus = menuService.selectMenusByUser(user);
mmap.put("menus", menus);
@ -64,6 +63,7 @@ public class SysIndexController extends BaseController
mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled());
mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
mmap.put("isMobile", ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")));
// 菜单导航显示风格
String menuStyle = configService.selectConfigByKey("sys.index.menuStyle");
@ -88,7 +88,7 @@ public class SysIndexController extends BaseController
@GetMapping("/lockscreen")
public String lockscreen(ModelMap mmap)
{
mmap.put("user", ShiroUtils.getSysUser());
mmap.put("user", getSysUser());
ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
return "lock";
}
@ -98,7 +98,7 @@ public class SysIndexController extends BaseController
@ResponseBody
public AjaxResult unlockscreen(String password)
{
SysUser user = ShiroUtils.getSysUser();
SysUser user = getSysUser();
if (StringUtils.isNull(user))
{
return AjaxResult.error("服务器超时,请重新登陆");

View File

@ -19,6 +19,7 @@ import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -28,6 +29,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.ConfigService;
import com.ruoyi.framework.jwt.utils.JwtUtils;
import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.service.ISysUserService;
@ -43,6 +45,15 @@ import java.util.Map;
@Controller
public class SysLoginController extends BaseController
{
/**
* 是否开启记住我功能
*/
@Value("${shiro.rememberMe.enabled: false}")
private boolean rememberMe;
@Autowired
private ConfigService configService;
@Autowired
private IJwtTokenService jwtTokenService;
@ -50,7 +61,7 @@ public class SysLoginController extends BaseController
private IWechatApiService wechatApiService;
@GetMapping("/login")
public String login(HttpServletRequest request, HttpServletResponse response, Map<String,String> map)
public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap)
{
String loginType= request.getParameter("loginType");
if(StringUtils.isNotEmpty(loginType) && request.getParameter("loginType").equals("wechat")){
@ -63,9 +74,9 @@ public class SysLoginController extends BaseController
}
String password="";
map.put("loginType","wechat");
map.put("username",username);
map.put("password",password);
mmap.put("loginType","wechat");
mmap.put("username",username);
mmap.put("password",password);
return "loginwechat";
@ -76,6 +87,10 @@ public class SysLoginController extends BaseController
{
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
}
// 是否开启记住我
mmap.put("isRemembered", rememberMe);
// 是否开启用户注册
mmap.put("isAllowRegister", configService.getKey("sys.account.registerUser"));
return "login";
}

View File

@ -109,7 +109,7 @@ public class SysMenuController extends BaseController
{
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
menu.setCreateBy(ShiroUtils.getLoginName());
menu.setCreateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(menuService.insertMenu(menu));
}
@ -137,7 +137,7 @@ public class SysMenuController extends BaseController
{
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
menu.setUpdateBy(ShiroUtils.getLoginName());
menu.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(menuService.updateMenu(menu));
}

View File

@ -15,7 +15,6 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
@ -71,7 +70,7 @@ public class SysNoticeController extends BaseController
@ResponseBody
public AjaxResult addSave(SysNotice notice)
{
notice.setCreateBy(ShiroUtils.getLoginName());
notice.setCreateBy(getLoginName());
return toAjax(noticeService.insertNotice(notice));
}
@ -94,7 +93,7 @@ public class SysNoticeController extends BaseController
@ResponseBody
public AjaxResult editSave(SysNotice notice)
{
notice.setUpdateBy(ShiroUtils.getLoginName());
notice.setUpdateBy(getLoginName());
return toAjax(noticeService.updateNotice(notice));
}

View File

@ -17,7 +17,6 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
@ -106,7 +105,7 @@ public class SysPostController extends BaseController
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(ShiroUtils.getLoginName());
post.setCreateBy(getLoginName());
return toAjax(postService.insertPost(post));
}
@ -137,7 +136,7 @@ public class SysPostController extends BaseController
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(ShiroUtils.getLoginName());
post.setUpdateBy(getLoginName());
return toAjax(postService.updatePost(post));
}

View File

@ -50,7 +50,7 @@ public class SysProfileController extends BaseController
@GetMapping()
public String profile(ModelMap mmap)
{
SysUser user = ShiroUtils.getSysUser();
SysUser user = getSysUser();
mmap.put("user", user);
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
@ -61,7 +61,7 @@ public class SysProfileController extends BaseController
@ResponseBody
public boolean checkPassword(String password)
{
SysUser user = ShiroUtils.getSysUser();
SysUser user = getSysUser();
if (passwordService.matches(user, password))
{
return true;
@ -72,7 +72,7 @@ public class SysProfileController extends BaseController
@GetMapping("/resetPwd")
public String resetPwd(ModelMap mmap)
{
SysUser user = ShiroUtils.getSysUser();
SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/resetPwd";
}
@ -82,7 +82,7 @@ public class SysProfileController extends BaseController
@ResponseBody
public AjaxResult resetPwd(String oldPassword, String newPassword)
{
SysUser user = ShiroUtils.getSysUser();
SysUser user = getSysUser();
if (!passwordService.matches(user, oldPassword))
{
return error("修改密码失败,旧密码错误");
@ -96,7 +96,7 @@ public class SysProfileController extends BaseController
user.setPwdUpdateDate(DateUtils.getNowDate());
if (userService.resetUserPwd(user) > 0)
{
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
setSysUser(userService.selectUserById(user.getUserId()));
return success();
}
return error("修改密码异常,请联系管理员");
@ -108,7 +108,7 @@ public class SysProfileController extends BaseController
@GetMapping("/edit")
public String edit(ModelMap mmap)
{
SysUser user = ShiroUtils.getSysUser();
SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/edit";
}
@ -119,7 +119,7 @@ public class SysProfileController extends BaseController
@GetMapping("/avatar")
public String avatar(ModelMap mmap)
{
SysUser user = ShiroUtils.getSysUser();
SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/avatar";
}
@ -132,7 +132,7 @@ public class SysProfileController extends BaseController
@ResponseBody
public AjaxResult update(SysUser user)
{
SysUser currentUser = ShiroUtils.getSysUser();
SysUser currentUser = getSysUser();
currentUser.setUserName(user.getUserName());
currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber());
@ -149,7 +149,7 @@ public class SysProfileController extends BaseController
}
if (userService.updateUserInfo(currentUser) > 0)
{
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
setSysUser(userService.selectUserById(currentUser.getUserId()));
return success();
}
return error();
@ -163,7 +163,7 @@ public class SysProfileController extends BaseController
@ResponseBody
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
{
SysUser currentUser = ShiroUtils.getSysUser();
SysUser currentUser = getSysUser();
try
{
if (!file.isEmpty())
@ -172,7 +172,7 @@ public class SysProfileController extends BaseController
currentUser.setAvatar(avatar);
if (userService.updateUserInfo(currentUser) > 0)
{
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
setSysUser(userService.selectUserById(currentUser.getUserId()));
return success();
}
}

View File

@ -19,7 +19,6 @@ import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
import com.ruoyi.system.domain.SysUserRole;
@ -97,7 +96,7 @@ public class SysRoleController extends BaseController
{
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(ShiroUtils.getLoginName());
role.setCreateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(roleService.insertRole(role));
@ -131,7 +130,7 @@ public class SysRoleController extends BaseController
{
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(ShiroUtils.getLoginName());
role.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(roleService.updateRole(role));
}
@ -156,10 +155,10 @@ public class SysRoleController extends BaseController
public AjaxResult authDataScopeSave(SysRole role)
{
roleService.checkRoleAllowed(role);
role.setUpdateBy(ShiroUtils.getLoginName());
role.setUpdateBy(getLoginName());
if (roleService.authDataScope(role) > 0)
{
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
setSysUser(userService.selectUserById(getUserId()));
return success();
}
return error();

View File

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -22,6 +23,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
@ -93,8 +95,7 @@ public class SysUserController extends BaseController
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream());
String operName = ShiroUtils.getSysUser().getLoginName();
String message = userService.importUser(userList, updateSupport, operName);
String message = userService.importUser(userList, updateSupport, getLoginName());
return AjaxResult.success(message);
}
@ -143,7 +144,7 @@ public class SysUserController extends BaseController
}
user.setSalt(ShiroUtils.randomSalt());
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
user.setCreateBy(ShiroUtils.getLoginName());
user.setCreateBy(getLoginName());
return toAjax(userService.insertUser(user));
}
@ -180,7 +181,7 @@ public class SysUserController extends BaseController
{
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(ShiroUtils.getLoginName());
user.setUpdateBy(getLoginName());
return toAjax(userService.updateUser(user));
}
@ -205,7 +206,7 @@ public class SysUserController extends BaseController
{
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
{
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
setSysUser(userService.selectUserById(user.getUserId()));
}
return success();
}
@ -245,6 +246,10 @@ public class SysUserController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(ids));
}

View File

@ -144,6 +144,9 @@ shiro:
maxSession: -1
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
kickoutAfter: false
rememberMe:
# 是否开启记住我
enabled: true
# 防止XSS攻击
xss:
@ -187,4 +190,8 @@ express:
secret_key:
secret_secret:
#TOPGP Webservice
topgp:
webservice:
topprod: http://192.168.2.81:85/web/ws/r/aws_ttsrv2
toptest: http://192.168.2.81:85/web/ws/r/aws_ttsrv2_toptest

View File

@ -1,16 +1,18 @@
/*!
* bootstrap-fileinput v5.1.3
* bootstrap-fileinput v5.2.3
* http://plugins.krajee.com/file-input
*
* Krajee default styling for bootstrap-fileinput.
*
* Author: Kartik Visweswaran
* Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com
* Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com
*
* Licensed under the BSD-3-Clause
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
*/
.file-loading input[type=file], input[type=file].file-loading {
.file-loading input[type=file],
input[type=file].file-loading {
width: 0;
height: 0;
}
@ -29,11 +31,31 @@
box-shadow: none;
}
.kv-hidden, .file-caption-icon, .file-zoom-dialog .modal-header:before, .file-zoom-dialog .modal-header:after, .file-input-new .file-preview, .file-input-new .close, .file-input-new .glyphicon-file, .file-input-new .fileinput-remove-button, .file-input-new .fileinput-upload-button, .file-input-new .no-browse .input-group-btn, .file-input-ajax-new .fileinput-remove-button, .file-input-ajax-new .fileinput-upload-button, .file-input-ajax-new .no-browse .input-group-btn, .hide-content .kv-file-content, .is-locked .fileinput-upload-button, .is-locked .fileinput-remove-button {
.kv-hidden,
.file-caption-icon,
.file-zoom-dialog .modal-header:before,
.file-zoom-dialog .modal-header:after,
.file-input-new .file-preview,
.file-input-new .close,
.file-input-new .glyphicon-file,
.file-input-new .fileinput-remove-button,
.file-input-new .fileinput-upload-button,
.file-input-new .no-browse .input-group-btn,
.file-input-ajax-new .fileinput-remove-button,
.file-input-ajax-new .fileinput-upload-button,
.file-input-ajax-new .no-browse .input-group-btn,
.hide-content .kv-file-content,
.is-locked .fileinput-upload-button,
.is-locked .fileinput-remove-button {
display: none;
}
.btn-file input[type=file], .file-caption-icon, .file-preview .fileinput-remove, .krajee-default .file-thumb-progress, .file-zoom-dialog .btn-navigate, .file-zoom-dialog .floating-buttons {
.btn-file input[type=file],
.file-caption-icon,
.file-preview .fileinput-remove,
.krajee-default .file-thumb-progress,
.file-zoom-dialog .btn-navigate,
.file-zoom-dialog .floating-buttons {
position: absolute;
}
@ -41,35 +63,50 @@
line-height: inherit;
}
.file-input, .file-loading:before, .btn-file, .file-caption, .file-preview, .krajee-default.file-preview-frame, .krajee-default .file-thumbnail-footer, .file-zoom-dialog .modal-dialog {
.file-input,
.file-loading:before,
.btn-file,
.file-caption,
.file-preview,
.krajee-default.file-preview-frame,
.krajee-default .file-thumbnail-footer,
.file-zoom-dialog .modal-dialog {
position: relative;
}
.file-error-message pre, .file-error-message ul, .krajee-default .file-actions, .krajee-default .file-other-error {
.file-error-message pre,
.file-error-message ul,
.krajee-default .file-actions,
.krajee-default .file-other-error {
text-align: left;
}
.file-error-message pre, .file-error-message ul {
.file-error-message pre,
.file-error-message ul {
margin: 0;
}
.krajee-default .file-drag-handle, .krajee-default .file-upload-indicator {
.krajee-default .file-drag-handle,
.krajee-default .file-upload-indicator {
float: left;
margin-top: 10px;
width: 16px;
height: 16px;
}
.file-thumb-progress .progress, .file-thumb-progress .progress-bar {
.file-thumb-progress .progress,
.file-thumb-progress .progress-bar {
font-family: Verdana, Helvetica, sans-serif;
font-size: 0.7rem;
}
.krajee-default .file-thumb-progress .progress, .kv-upload-progress .progress {
.krajee-default .file-thumb-progress .progress,
.kv-upload-progress .progress {
background-color: #ccc;
}
.krajee-default .file-caption-info, .krajee-default .file-size-info {
.krajee-default .file-caption-info,
.krajee-default .file-size-info {
display: block;
white-space: nowrap;
overflow: hidden;
@ -79,17 +116,23 @@
margin: auto;
}
.file-zoom-content > .file-object.type-video, .file-zoom-content > .file-object.type-flash, .file-zoom-content > .file-object.type-image {
.file-zoom-content > .file-object.type-video,
.file-zoom-content > .file-object.type-flash,
.file-zoom-content > .file-object.type-image {
max-width: 100%;
max-height: 100%;
width: auto;
}
.file-zoom-content > .file-object.type-video, .file-zoom-content > .file-object.type-flash {
.file-zoom-content > .file-object.type-video,
.file-zoom-content > .file-object.type-flash {
height: 100%;
}
.file-zoom-content > .file-object.type-pdf, .file-zoom-content > .file-object.type-html, .file-zoom-content > .file-object.type-text, .file-zoom-content > .file-object.type-default {
.file-zoom-content > .file-object.type-pdf,
.file-zoom-content > .file-object.type-html,
.file-zoom-content > .file-object.type-text,
.file-zoom-content > .file-object.type-default {
width: 100%;
}
@ -131,26 +174,44 @@
height: 100%;
}
.file-caption .file-caption-name {
width: 100%;
margin: 0;
padding: 0;
box-shadow: none;
border: none;
background: none;
outline: none;
}
.file-caption.icon-visible .file-caption-icon {
display: inline-block;
}
.file-caption.icon-visible .file-caption-name {
padding-left: 15px;
padding-left: 1.875rem;
}
.file-caption.icon-visible > .input-group-lg .file-caption-name {
padding-left: 2.1rem;
}
.file-caption.icon-visible > .input-group-sm .file-caption-name {
padding-left: 1.5rem;
}
.file-caption-name:not(.file-caption-disabled) {
background-color: transparent;
}
.file-caption-name.file-processing {
font-style: italic;
border-color: #bbb;
opacity: 0.5;
}
.file-caption-icon {
left: 8px;
padding: 0.5rem;
left: 4px;
}
.input-group-lg .file-caption-icon {
font-size: 1.25rem;
}
.input-group-sm .file-caption-icon {
font-size: 0.875rem;
padding: 0.25rem;
}
.file-error-message {
@ -200,10 +261,10 @@
.file-preview-image {
font: 40px Impact, Charcoal, sans-serif;
color: #008000;
width:auto;
height:auto;
max-width:100%;
max-height:100%;
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
.krajee-default.file-preview-frame {
@ -319,7 +380,9 @@
font-family: Verdana, Helvetica, sans-serif;
}
/*noinspection CssOverwrittenProperties*/
.file-zoom-dialog .file-other-icon {
font-size: 22em;
font-size: 50vmin;
@ -336,21 +399,18 @@
}
.file-zoom-dialog .btn-navigate {
margin: 0 0.1rem;
padding: 0;
margin: -60px 0 0;
font-size: 60px;
background: transparent;
text-decoration: none;
outline: none;
opacity: 0.7;
font-size: 1.2rem;
width: 2.4rem;
height: 2.4rem;
top: 50%;
color: #1c94c4;
border-radius: 50%;
text-align:center;
}
.file-zoom-dialog .btn-navigate:not([disabled]):hover {
outline: none;
box-shadow: none;
opacity: 0.6;
.btn-navigate * {
width: auto;
}
.file-zoom-dialog .floating-buttons {
@ -358,27 +418,59 @@
right: 10px;
}
.file-zoom-dialog .btn-navigate[disabled] {
opacity: 0.3;
.file-zoom-dialog .btn-kv-prev {
left: 0;
}
.file-zoom-dialog .btn-prev {
left: 1px;
.file-zoom-dialog .btn-kv-next {
right: 0;
}
.file-zoom-dialog .btn-next {
right: 1px;
}
.file-zoom-dialog .kv-zoom-title {
font-weight: 300;
color: #999;
.file-zoom-dialog .kv-zoom-caption {
max-width: 50%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.file-zoom-dialog .kv-zoom-header {
padding: 0.5rem;
}
.file-zoom-dialog .kv-zoom-body {
padding: 0.25rem 0.5rem 0.25rem 0;
}
.file-zoom-dialog .kv-zoom-description {
position: absolute;
opacity: 0.8;
font-size: 0.8rem;
background-color: #1a1a1a;
padding: 1rem;
text-align: center;
border-radius: 0.5rem;
color: #fff;
left: 15%;
right: 15%;
bottom: 15%;
}
.file-zoom-dialog .kv-desc-hide {
float: right;
color: #fff;
padding: 0 0.1rem;
background: none;
border: none;
}
.file-zoom-dialog .kv-desc-hide:hover {
opacity: 0.7;
}
.file-zoom-dialog .kv-desc-hide:focus {
opacity: 0.9;
}
.file-input-new .no-browse .form-control {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
@ -389,8 +481,9 @@
border-bottom-right-radius: 4px;
}
.file-caption-main {
.file-caption {
width: 100%;
position: relative;
}
.file-thumb-loading {
@ -422,7 +515,7 @@
.file-drop-zone-title {
color: #aaa;
font-size: 1.6em;
text-align:center;
text-align: center;
padding: 85px 10px;
cursor: default;
}
@ -448,7 +541,7 @@
min-height: 100vh;
}
.file-zoom-fullscreen .modal-body {
.file-zoom-fullscreen .kv-zoom-body {
overflow-y: auto;
}
@ -467,9 +560,23 @@
.file-zoom-content {
text-align: center;
white-space: nowrap;
min-height: 300px;
}
.file-zoom-content:hover {
background: transparent;
}
.file-zoom-content > * {
display: inline-block;
vertical-align: middle;
}
.file-zoom-content .kv-spacer {
height: 100%;
}
.file-zoom-content .file-preview-image {
max-height: 100%;
}
@ -544,7 +651,8 @@
opacity: 1;
}
.file-grabbing, .file-grabbing * {
.file-grabbing,
.file-grabbing * {
cursor: not-allowed !important;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,149 @@
@font-face {
font-family:ZenIcon;src:url(../fonts/zenicon.woff?v=2.2.0) format('woff')
}
.checkbox-primary,.radio-primary {
position: relative;
display: block
}
.checkbox-primary>input,.radio-primary>input {
position: absolute;
top: 0;
left: 0;
z-index: 3;
width: 100%;
width: 20px;
height: 100%;
margin: 0;
opacity: 0
}
.checkbox-primary>label,.radio-primary>label {
padding-left: 25px;
font-weight: 400;
cursor: pointer
}
.checkbox-primary>label:after,.checkbox-primary>label:before,.radio-primary>label:after,.radio-primary>label:before {
position: absolute;
top: 2px;
right: 0;
left: 0;
display: block;
width: 16px;
height: 16px;
line-height: 16px;
text-align: center;
content: ' ';
border-radius: 2px
}
.checkbox-primary>label:after,.radio-primary>label:after {
z-index: 1;
border: 1px solid gray;
-webkit-transition: .4s cubic-bezier(.175,.885,.32,1);
-o-transition: .4s cubic-bezier(.175,.885,.32,1);
transition: .4s cubic-bezier(.175,.885,.32,1);
-webkit-transition-property: border,background-color;
-o-transition-property: border,background-color;
transition-property: border,background-color
}
.checkbox-primary>label:before,.radio-primary>label:before {
top: 3px;
z-index: 2;
font-family: ZenIcon;
font-size: 14px;
font-style: normal;
font-weight: 400;
font-variant: normal;
line-height: 1;
text-transform: none;
content: '\e60d';
opacity: 0;
-webkit-transition: .2s cubic-bezier(.175,.885,.32,1);
-o-transition: .2s cubic-bezier(.175,.885,.32,1);
transition: .2s cubic-bezier(.175,.885,.32,1);
-webkit-transition-property: opacity,-webkit-transform;
-o-transition-property: opacity,-o-transform;
transition-property: opacity,-webkit-transform;
transition-property: opacity,transform;
transition-property: opacity,transform,-webkit-transform,-o-transform;
-webkit-transform: scale(0);
-ms-transform: scale(0);
-o-transform: scale(0);
transform: scale(0);
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale
}
.checkbox-primary.checked>label:after,.checkbox-primary>input:checked+label:after,.radio-primary.checked>label:after,.radio-primary>input:checked+label:after {
background-color: #3280fc;
border-color: #3280fc;
border-width: 4px
}
.checkbox-primary.checked>label:before,.checkbox-primary>input:checked+label:before,.radio-primary.checked>label:before,.radio-primary>input:checked+label:before {
color: #fff;
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1)
}
.checkbox-primary.focus>label:after,.checkbox-primary>input:focus+label:after,.radio-primary.focus>label:after,.radio-primary>input:focus+label:after {
border-color: #3280fc;
-webkit-box-shadow: 0 0 8px #3280fc;
box-shadow: 0 0 8px #3280fc
}
.checkbox-primary input:disabled+label:after,.checkbox-primary.disabled>label:after,.radio-primary input:disabled+label:after,.radio-primary.disabled>label:after {
background-color: #e5e5e5;
border-color: #bbb
}
.checkbox-primary input:disabled:checked+label:after,.checkbox-primary.checked.disabled>label:after,.radio-primary input:disabled:checked+label:after,.radio-primary.checked.disabled>label:after {
background-color: #bbb
}
.radio-primary>label:after {
border-radius: 50%
}
.radio-primary>label:before {
top: 7px;
left: 5px;
width: 6px;
height: 6px;
content: ' ';
border: 0;
border-radius: 50%
}
.radio-primary.checked>label:after,.radio-primary>input:checked+label:after {
background-color: transparent;
border-color: #3280fc;
border-width: 2px
}
.radio-primary.checked>label:before,.radio-primary>input:checked+label:before {
background-color: #3280fc
}
.radio-primary input:disabled:checked+label:after,.radio-primary.checked.disabled>label:after {
background-color: transparent;
border-color: #bbb
}
.radio-primary input:disabled:checked+label:before,.radio-primary.checked.disabled>label:before {
background-color: #bbb
}
.tab-cron .tab-pane .tabsecondchk .checkbox-primary,.tab-qqskey .tab-pane .tabsecondchk .checkbox-primary {
width: 50px;
display: inline-block;
margin-bottom: 10px
}

View File

@ -0,0 +1,926 @@
$().ready(function () {
$("#unrunBtn").click(function () {
var str = $("#cron").val();
var str_arr = str.split(" ");
try {
$("#v_second").val(str_arr[0])
$("#v_min").val(str_arr[1])
$("#v_hour").val(str_arr[2])
$("#v_day").val(str_arr[3])
$("#v_month").val(str_arr[4])
$("#v_week").val(str_arr[5])
$("#v_year").val(str_arr[6])
} catch (e) {
}
});
//second
$("#sec_all").click(function () {
if ($(this).prop('checked')) {
$("#v_second").val("*");
gen_cron();
}
});
$("#sec_circle").click(function () {
if ($(this).prop('checked')) {
change_sec_circle();
}
});
$("#sec_circle1").change(function () {
if ($("#sec_circle").prop('checked')) {
change_sec_circle();
}
});
$("#sec_circle2").change(function () {
if ($("#sec_circle").prop('checked')) {
change_sec_circle();
}
});
$("#sec_per").click(function () {
if ($(this).prop('checked')) {
change_sec_per();
}
});
$("#sec_per1").change(function () {
if ($("#sec_per").prop('checked')) {
change_sec_per();
}
});
$("#sec_per2").change(function () {
if ($("#sec_per").prop('checked')) {
change_sec_per();
}
});
$("#sec_assign").click(function () {
if ($("#sec_assign").prop('checked')) {
change_sec_assign();
}
});
$("input[name='zd_second']").click(function () {
if ($("#sec_assign").prop('checked')) {
change_sec_assign();
}
});
//minute
$("#min_all").click(function () {
if ($(this).prop('checked')) {
$("#v_min").val("*");
gen_cron();
}
});
$("#min_circle").click(function () {
if ($(this).prop('checked')) {
change_min_circle();
}
});
$("#min_circle1").change(function () {
if ($("#min_circle").prop('checked')) {
change_min_circle();
}
});
$("#min_circle2").change(function () {
if ($("#min_circle").prop('checked')) {
change_min_circle();
}
});
$("#min_per").click(function () {
if ($(this).prop('checked')) {
change_min_per();
}
});
$("#min_per1").change(function () {
if ($("#min_per").prop('checked')) {
change_min_per();
}
});
$("#min_per2").change(function () {
if ($("#min_per").prop('checked')) {
change_min_per();
}
});
$("#min_assign").click(function () {
if ($("#min_assign").prop('checked')) {
change_min_assign();
}
});
$("input[name='zd_minute']").click(function () {
if ($("#min_assign").prop('checked')) {
change_min_assign();
}
});
//hour
$("#hour_all").click(function () {
if ($(this).prop('checked')) {
$("#v_hour").val("*");
gen_cron();
}
});
$("#hour_circle").click(function () {
if ($(this).prop('checked')) {
change_hour_circle();
}
});
$("#hour_circle1").change(function () {
if ($("#hour_circle").prop('checked')) {
change_hour_circle();
}
});
$("#hour_circle2").change(function () {
if ($("#hour_circle").prop('checked')) {
change_hour_circle();
}
});
$("#hour_per").click(function () {
if ($(this).prop('checked')) {
change_hour_per();
}
});
$("#hour_per1").change(function () {
if ($("#hour_per").prop('checked')) {
change_hour_per();
}
});
$("#hour_per2").change(function () {
if ($("#hour_per").prop('checked')) {
change_hour_per();
}
});
$("#hour_assign").click(function () {
if ($("#hour_assign").prop('checked')) {
change_hour_assign();
}
});
$("input[name='zd_hour']").click(function () {
if ($("#hour_assign").prop('checked')) {
change_hour_assign();
}
});
//day
$("#day_all").click(function () {
if ($(this).prop('checked')) {
$("#v_day").val("*");
gen_cron();
}
});
$("#day_no").click(function () {
if ($(this).prop('checked')) {
$("#v_day").val("?");
gen_cron();
}
});
$("#day_last").click(function () {
if ($(this).prop('checked')) {
$("#v_day").val("L");
gen_cron();
}
});
$("#day_circle").click(function () {
if ($(this).prop('checked')) {
change_day_circle();
}
});
$("#day_circle1").change(function () {
if ($("#day_circle").prop('checked')) {
change_day_circle();
}
});
$("#day_circle2").change(function () {
if ($("#day_circle").prop('checked')) {
change_day_circle();
}
});
$("#day_per").click(function () {
if ($(this).prop('checked')) {
change_day_per();
}
});
$("#day_per1").change(function () {
if ($("#day_per").prop('checked')) {
change_day_per();
}
});
$("#day_per2").change(function () {
if ($("#day_per").prop('checked')) {
change_day_per();
}
});
$("#day_work").click(function () {
if ($("#day_work").prop('checked')) {
change_day_work();
}
});
$("#day_work1").change(function () {
if ($("#day_work").prop('checked')) {
change_day_work();
}
});
$("#day_assign").click(function () {
if ($("#day_assign").prop('checked')) {
change_day_assign();
}
});
$("input[name='zd_day']").click(function () {
if ($("#day_assign").prop('checked')) {
change_day_assign();
}
});
//month
$("#month_all").click(function () {
if ($(this).prop('checked')) {
$("#v_month").val("*");
gen_cron();
}
});
$("#month_no").click(function () {
if ($(this).prop('checked')) {
$("#v_month").val("?");
gen_cron();
}
});
$("#month_last").click(function () {
if ($(this).prop('checked')) {
$("#v_month").val("L");
gen_cron();
}
});
$("#month_circle").click(function () {
if ($(this).prop('checked')) {
change_month_circle();
}
});
$("#month_circle1").change(function () {
if ($("#month_circle").prop('checked')) {
change_month_circle();
}
});
$("#month_circle2").change(function () {
if ($("#month_circle").prop('checked')) {
change_month_circle();
}
});
$("#month_per").click(function () {
if ($(this).prop('checked')) {
change_month_per();
}
});
$("#month_per1").change(function () {
if ($("#month_per").prop('checked')) {
change_month_per();
}
});
$("#month_per2").change(function () {
if ($("#month_per").prop('checked')) {
change_month_per();
}
});
$("#month_assign").click(function () {
if ($("#month_assign").prop('checked')) {
change_month_assign();
}
});
$("input[name='zd_month']").click(function () {
if ($("#month_assign").prop('checked')) {
change_month_assign();
}
});
//week
$("#week_all").click(function () {
if ($(this).prop('checked')) {
$("#v_week").val("*");
gen_cron();
}
});
$("#week_no").click(function () {
if ($(this).prop('checked')) {
$("#v_week").val("?");
gen_cron();
}
});
$("#week_circle").click(function () {
if ($(this).prop('checked')) {
change_week_circle();
}
});
$("#week_circle1").change(function () {
if ($("#week_circle").prop('checked')) {
change_week_circle();
}
});
$("#week_circle2").change(function () {
if ($("#week_circle").prop('checked')) {
change_week_circle();
}
});
$("#week_last").click(function () {
if ($("#week_last").prop('checked')) {
change_week_last();
}
});
$("#week_last1").change(function () {
if ($("#week_last").prop('checked')) {
change_week_last();
}
});
$("#week_num").click(function () {
if ($("#week_num").prop('checked')) {
change_week_num();
}
});
$("#week_num1").change(function () {
if ($("#week_num").prop('checked')) {
change_week_num();
}
});
$("#week_num2").change(function () {
if ($("#week_num").prop('checked')) {
change_week_num();
}
});
$("#week_assign").click(function () {
if ($("#week_assign").prop('checked')) {
change_week_assign();
}
});
$("input[name='zd_week']").click(function () {
if ($("#week_assign").prop('checked')) {
change_week_assign();
}
});
//year
$("#year_all").click(function () {
if ($(this).prop('checked')) {
$("#v_year").val("*");
gen_cron();
}
});
$("#year_no").click(function () {
if ($(this).prop('checked')) {
$("#v_year").val("");
gen_cron();
}
});
$("#year_circle").click(function () {
if ($(this).prop('checked')) {
change_year_circle();
}
});
$("#year_circle1").change(function () {
if ($("#year_circle").prop('checked')) {
change_year_circle();
}
});
$("#year_circle2").change(function () {
if ($("#year_circle").prop('checked')) {
change_year_circle();
}
});
});
function change_sec_assign() {
var sec_array = new Array();
$("input[name='zd_second']:checked").each(function () {
sec_array[sec_array.length] = $(this).val();
});
sec_array = sec_array.join(",");
if (sec_array == null || sec_array == '') {
$("#v_second").val("*");
} else {
$("#v_second").val(sec_array);
}
gen_cron();
}
function change_sec_circle() {
var v1 = $("#sec_circle1").val();
var v2 = $("#sec_circle2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#sec_circle1").val(v1);
}
if (v2 < 2) {
v2 = 2;
$("#sec_circle2").val(v2);
}
if (v2 > 59) {
v2 = 59;
$("#sec_circle2").val(v2);
}
if (v1 > 59) {
v1 = 59;
$("#sec_circle1").val(v1);
}
if (v1 >= v2) {
v1 = v2 - 1;
$("#sec_circle1").val(v1);
}
if (v1 > 60 || v2 > 60) {
return;
}
if (v1 > v2) {
return;
}
$("#v_second").val(v1 + "-" + v2);
gen_cron();
}
function change_sec_per() {
var v1 = $("#sec_per1").val();
var v2 = $("#sec_per2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 0) {
v1 = 0;
$("#sec_per1").val(v1);
}
if (v1 > 59) {
v1 = 59;
$("#sec_per1").val(v1);
}
if (v2 < 1) {
v2 = 1;
$("#sec_per2").val(v2);
}
if (v2 > 59) {
v2 = 59;
$("#sec_per2").val(v2);
}
$("#v_second").val(v1 + "/" + v2);
gen_cron()
}
function change_min_assign() {
var sec_array = new Array();
$("input[name='zd_minute']:checked").each(function () {
sec_array[sec_array.length] = $(this).val();
});
sec_array = sec_array.join(",");
if (sec_array == null || sec_array == '') {
$("#v_min").val("*");
} else {
$("#v_min").val(sec_array);
}
gen_cron();
}
function change_min_circle() {
var v1 = $("#min_circle1").val();
var v2 = $("#min_circle2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#min_circle1").val(v1);
}
if (v2 < 2) {
v2 = 2;
$("#min_circle2").val(v2);
}
if (v2 > 59) {
v2 = 59;
$("#min_circle2").val(v2);
}
if (v1 > 59) {
v1 = 59;
$("#min_circle1").val(v1);
}
if (v1 >= v2) {
v1 = v2 - 1;
$("#min_circle1").val(v1);
}
if (v1 > 60 || v2 > 60) {
return;
}
if (v1 > v2) {
return;
}
$("#v_min").val(v1 + "-" + v2);
gen_cron();
}
function change_min_per() {
var v1 = $("#min_per1").val();
var v2 = $("#min_per2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 0) {
v1 = 0;
$("#min_per1").val(v1);
}
if (v1 > 59) {
v1 = 59;
$("#min_per1").val(v1);
}
if (v2 < 1) {
v2 = 1;
$("#min_per2").val(v2);
}
if (v2 > 59) {
v2 = 59;
$("#min_per2").val(v2);
}
$("#v_min").val(v1 + "/" + v2);
gen_cron()
}
function change_hour_assign() {
var sec_array = new Array();
$("input[name='zd_hour']:checked").each(function () {
sec_array[sec_array.length] = $(this).val();
});
sec_array = sec_array.join(",");
if (sec_array == null || sec_array == '') {
$("#v_hour").val("*");
} else {
$("#v_hour").val(sec_array);
}
gen_cron();
}
function change_hour_circle() {
var v1 = $("#hour_circle1").val();
var v2 = $("#hour_circle2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#hour_circle1").val(v1);
}
if (v2 < 2) {
v2 = 2;
$("#hour_circle2").val(v2);
}
if (v2 > 23) {
v2 = 23;
$("#hour_circle2").val(v2);
}
if (v1 > 23) {
v1 = 23;
$("#hour_circle1").val(v1);
}
if (v1 >= v2) {
v1 = v2 - 1;
$("#hour_circle1").val(v1);
}
if (v1 > 23 || v2 > 23) {
return;
}
if (v1 > v2) {
return;
}
$("#v_hour").val(v1 + "-" + v2);
gen_cron();
}
function change_hour_per() {
var v1 = $("#hour_per1").val();
var v2 = $("#hour_per2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 0) {
v1 = 0;
$("#hour_per1").val(v1);
}
if (v1 > 23) {
v1 = 23;
$("#hour_per1").val(v1);
}
if (v2 < 1) {
v2 = 1;
$("#hour_per2").val(v2);
}
if (v2 > 23) {
v2 = 23;
$("#hour_per2").val(v2);
}
$("#v_hour").val(v1 + "/" + v2);
gen_cron()
}
function change_day_assign() {
var sec_array = new Array();
$("input[name='zd_day']:checked").each(function () {
sec_array[sec_array.length] = $(this).val();
});
sec_array = sec_array.join(",");
if (sec_array == null || sec_array == '') {
$("#v_day").val("*");
} else {
$("#v_day").val(sec_array);
}
gen_cron();
}
function change_day_circle() {
var v1 = $("#day_circle1").val();
var v2 = $("#day_circle2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#day_circle1").val(v1);
}
if (v2 < 2) {
v2 = 2;
$("#day_circle2").val(v2);
}
if (v2 > 31) {
v2 = 31;
$("#day_circle2").val(v2);
}
if (v1 > 31) {
v1 = 31;
$("#day_circle1").val(v1);
}
if (v1 >= v2) {
v1 = v2 - 1;
$("#day_circle1").val(v1);
}
if (v1 > 31 || v2 > 31) {
return;
}
if (v1 > v2) {
return;
}
$("#v_day").val(v1 + "-" + v2);
gen_cron();
}
function change_day_per() {
var v1 = $("#day_per1").val();
var v2 = $("#day_per2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#day_per1").val(v1);
}
if (v1 > 31) {
v1 = 31;
$("#day_per1").val(v1);
}
if (v2 < 1) {
v2 = 1;
$("#day_per2").val(v2);
}
if (v2 > 31) {
v2 = 31;
$("#day_per2").val(v2);
}
$("#v_day").val(v1 + "/" + v2);
gen_cron()
}
function change_day_work() {
var v1 = $("#day_work1").val();
if (v1 == null || v1 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#day_work1").val(v1);
}
if (v1 > 31) {
v1 = 31;
$("#day_work1").val(v1);
}
$("#v_day").val(v1 + "W");
gen_cron()
}
function change_month_assign() {
var sec_array = new Array();
$("input[name='zd_month']:checked").each(function () {
sec_array[sec_array.length] = $(this).val();
});
sec_array = sec_array.join(",");
if (sec_array == null || sec_array == '') {
$("#v_month").val("*");
} else {
$("#v_month").val(sec_array);
}
gen_cron();
}
function change_month_circle() {
var v1 = $("#month_circle1").val();
var v2 = $("#month_circle2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#month_circle1").val(v1);
}
if (v2 < 2) {
v2 = 2;
$("#month_circle2").val(v2);
}
if (v2 > 12) {
v2 = 12;
$("#month_circle2").val(v2);
}
if (v1 > 12) {
v1 = 12;
$("#month_circle1").val(v1);
}
if (v1 >= v2) {
v1 = v2 - 1;
$("#month_circle1").val(v1);
}
if (v1 > 12 || v2 > 12) {
return;
}
if (v1 > v2) {
return;
}
$("#v_month").val(v1 + "-" + v2);
gen_cron();
}
function change_month_per() {
var v1 = $("#month_per1").val();
var v2 = $("#month_per2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#month_per1").val(v1);
}
if (v1 > 12) {
v1 = 12;
$("#month_per1").val(v1);
}
if (v2 < 1) {
v2 = 1;
$("#month_per2").val(v2);
}
if (v2 > 12) {
v2 = 12;
$("#month_per2").val(v2);
}
$("#v_month").val(v1 + "/" + v2);
gen_cron()
}
function change_week_assign() {
var sec_array = new Array();
$("input[name='zd_week']:checked").each(function () {
sec_array[sec_array.length] = $(this).val();
});
sec_array = sec_array.join(",");
if (sec_array == null || sec_array == '') {
$("#v_week").val("*");
} else {
$("#v_week").val(sec_array);
}
gen_cron();
}
function change_week_circle() {
var v1 = $("#week_circle1").val();
var v2 = $("#week_circle2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#week_circle1").val(v1);
}
if (v2 < 2) {
v2 = 2;
$("#week_circle2").val(v2);
}
if (v2 > 7) {
v2 = 7;
$("#week_circle2").val(v2);
}
if (v1 > 7) {
v1 = 7;
$("#week_circle1").val(v1);
}
if (v1 >= v2) {
v1 = v2 - 1;
$("#week_circle1").val(v1);
}
if (v1 > 7 || v2 > 7) {
return;
}
if (v1 > v2) {
return;
}
$("#v_week").val(v1 + "-" + v2);
gen_cron();
}
function change_week_last() {
var v1 = $("#week_last1").val();
if (v1 == null || v1 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#week_last1").val(v1);
}
if (v1 > 7) {
v1 = 7;
$("#week_last1").val(v1);
}
$("#v_week").val(v1 + "L");
gen_cron()
}
function change_week_num() {
var v1 = $("#week_num1").val();
var v2 = $("#week_num2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 1) {
v1 = 1;
$("#week_num1").val(v1);
}
if (v2 < 1) {
v2 = 1;
$("#week_num2").val(v2);
}
if (v2 > 7) {
v2 = 7;
$("#week_num2").val(v2);
}
if (v1 > 4) {
v1 = 4;
$("#week_num1").val(v1);
}
$("#v_week").val(v1 + "#" + v2);
gen_cron();
}
function change_year_circle() {
var v1 = $("#year_circle1").val();
var v2 = $("#year_circle2").val();
if (v1 == null || v1 == '' || v2 == null || v2 == '') {
return;
}
if (v1 < 2000) {
v1 = 2000;
$("#year_circle1").val(v1);
}
if (v2 < 2000) {
v2 = 2000;
$("#year_circle2").val(v2);
}
if (v2 > 3000) {
v2 = 3000;
$("#year_circle2").val(v2);
}
if (v1 > 3000) {
v1 = 3000;
$("#year_circle1").val(v1);
}
if (v1 >= v2) {
v1 = v2 - 1;
$("#year_circle1").val(v1);
}
if (v1 > 3000 || v2 > 3000) {
return;
}
if (v1 > v2) {
return;
}
$("#v_year").val(v1 + "-" + v2);
gen_cron();
}
function gen_cron() {
var str = $("#v_second").val() + " "
+ $("#v_min").val() + " "
+ $("#v_hour").val() + " "
+ $("#v_day").val() + " "
+ $("#v_month").val() + " "
+ $("#v_week").val() + " "
+ $("#v_year").val();
$("#cron").val(str);
}

View File

@ -52,6 +52,7 @@ $(function() {
elem: '#startTime',
max: $('#endTime').val(),
theme: 'molv',
type: $('#startTime').attr("data-type") || 'date',
trigger: 'click',
done: function(value, date) {
// 结束时间大于开始时间
@ -70,6 +71,7 @@ $(function() {
elem: '#endTime',
min: $('#startTime').val(),
theme: 'molv',
type: $('#endTime').attr("data-type") || 'date',
trigger: 'click',
done: function(value, date) {
// 开始时间小于结束时间

View File

@ -60,11 +60,8 @@
uploadAsync: false
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
var rsp = data.response;
var fileJson = rsp.data;
for (var i in fileJson) {
log.info("return data.url" + fileJson[i].url)
log.info("reutrn data.name" + fileJson[i].name)
}
log.info("return urls" + rsp.urls)
log.info("reutrn fileNames" + rsp.fileNames)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})

View File

@ -108,10 +108,10 @@
<!-- fileinput文件上传插件 -->
<div th:fragment="bootstrap-fileinput-css">
<link th:href="@{/ajax/libs/bootstrap-fileinput/fileinput.min.css?v=20201202}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/bootstrap-fileinput/fileinput.min.css?v=202108081}" rel="stylesheet"/>
</div>
<div th:fragment="bootstrap-fileinput-js">
<script th:src="@{/ajax/libs/bootstrap-fileinput/fileinput.min.js?v=20201202}"></script>
<script th:src="@{/ajax/libs/bootstrap-fileinput/fileinput.min.js?v=202108081}"></script>
</div>
<!-- duallistbox双列表框插件 -->

View File

@ -16,7 +16,7 @@
<link th:href="@{/css/skins.css?v=20200902}" rel="stylesheet"/>
<link th:href="@{/ruoyi/css/ry-ui.css?v=4.6.2}" rel="stylesheet"/>
</head>
<body class="fixed-sidebar full-height-layout gray-bg" style="overflow: hidden">
<body class="fixed-sidebar full-height-layout gray-bg" th:classappend="${isMobile} ? 'canvas-menu'" style="overflow: hidden">
<div id="wrapper">
<!--左侧导航开始-->

View File

@ -16,7 +16,7 @@
<link th:href="@{/css/skins.css}" rel="stylesheet"/>
<link th:href="@{/ruoyi/css/ry-ui.css?v=4.6.2}" rel="stylesheet"/>
</head>
<body class="fixed-sidebar full-height-layout gray-bg" style="overflow: hidden">
<body class="fixed-sidebar full-height-layout gray-bg" th:classappend="${isMobile} ? 'canvas-menu'" style="overflow: hidden">
<div id="wrapper">
<!--左侧导航开始-->

View File

@ -37,7 +37,7 @@
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Thymeleaf</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Bootstrap</li>
</ul>
<strong th:if="${@config.getKey('sys.account.registerUser')}">还没有账号? <a th:href="@{/register}">立即注册&raquo;</a></strong>
<strong th:if="${isAllowRegister}">还没有账号? <a th:href="@{/register}">立即注册&raquo;</a></strong>
</div>
</div>
<div class="col-sm-5">
@ -56,7 +56,7 @@
</a>
</div>
</div>
<div class="checkbox-custom" th:classappend="${captchaEnabled==false} ? 'm-t'">
<div class="checkbox-custom" th:if="${isRemembered}" th:classappend="${captchaEnabled==false} ? 'm-t'">
<input type="checkbox" id="rememberme" name="rememberme"> <label for="rememberme">记住我</label>
</div>
<button class="btn btn-success btn-block" id="btnSubmit" data-loading="正在验证登录,请稍后...">登录</button>

View File

@ -35,6 +35,16 @@ public @interface Excel
*/
public String dictType() default "";
/**
* 如果使用字典转换但不希望导入时转换则dictTypeExceptImport="true";
*/
public String dictTypeExceptImport() default "";
/**
* 如果使用字典转换但不希望导出时转换则dictTypeExceptExport="true"
*/
public String dictTypeExceptExport() default "";
/**
* 读取内容转表达式 (: 0=,1=,2=未知)
*/

View File

@ -90,6 +90,14 @@ public class RuoYiConfig
RuoYiConfig.addressEnabled = addressEnabled;
}
/**
* 获取导入上传路径
*/
public static String getImportPath()
{
return getProfile() + "/import";
}
/**
* 获取头像上传路径
*/

View File

@ -14,11 +14,13 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.AjaxResult.Type;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
@ -159,6 +161,14 @@ public class BaseController
return AjaxResult.success(message);
}
/**
* 返回成功数据
*/
public static AjaxResult success(Object data)
{
return AjaxResult.success("操作成功", data);
}
/**
* 返回失败消息
*/
@ -182,4 +192,36 @@ public class BaseController
{
return StringUtils.format("redirect:{}", url);
}
/**
* 获取用户缓存信息
*/
public SysUser getSysUser()
{
return ShiroUtils.getSysUser();
}
/**
* 设置用户缓存信息
*/
public void setSysUser(SysUser user)
{
ShiroUtils.setSysUser(user);
}
/**
* 获取登录用户id
*/
public Long getUserId()
{
return getSysUser().getUserId();
}
/**
* 获取登录用户名
*/
public String getLoginName()
{
return getSysUser().getLoginName();
}
}

View File

@ -1,61 +0,0 @@
package com.ruoyi.common.core.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 文件信息
*
* @author ruoyi
*/
public class FileInfo
{
/**
* 文件名称
*/
private String name;
/**
* 文件地址
*/
private String url;
public FileInfo()
{
}
public FileInfo(String name, String url)
{
this.name = name;
this.url = url;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getUrl()
{
return url;
}
public void setUrl(String url)
{
this.url = url;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName())
.append("url", getUrl())
.toString();
}
}

View File

@ -418,6 +418,22 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return false;
}
/**
* 删除最后一个字符串
*
* @param str 输入字符串
* @param spit 以什么类型结尾的
* @return 截取后的字符串
*/
public static String lastStringDel(String str, String spit)
{
if (!StringUtils.isEmpty(str) && str.endsWith(spit))
{
return str.subSequence(0, str.length() - 1).toString();
}
return str;
}
/**
* 将下划线大写方式命名的字符串转换为驼峰式如果转换前的下划线大写方式命名的字符串为空则返回空字符串 例如HELLO_WORLD->HelloWorld
*

View File

@ -1,7 +1,7 @@
package com.ruoyi.common.utils;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.http.HttpUtils;
import org.json.JSONObject;
import org.json.XML;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -34,10 +34,9 @@ public class TopgpXmlUtils {
" &lt;/Access>\n" +
" &lt;RequestContent>\n" +
" &lt;Parameter>\n" +
" &lt;Record>\n" +
" &lt;Field name=");
" &lt;Record>\n");
for(String key:mapInfo.keySet()){
stringBuffer.append("'"+key+"' value='" +mapInfo.get(key).toString().replaceAll("&","&amp")+"' />\n");
stringBuffer.append("&lt;Field name='"+key+"' value='" +mapInfo.get(key).toString().replaceAll("&","&amp")+"' />\n");
}
stringBuffer.append(" &lt;/Record>\n" +
" &lt;/Parameter>\n" +
@ -54,12 +53,11 @@ public class TopgpXmlUtils {
/**
* 将TOPGP返回的XML转化为Json,并提出返回Status
* @param TopgpResonseXml 调用TOPGP的Webservice的方法名 express_testRequest
* @param TopgpResponseXml 调用TOPGP的Webservice的方法名 express_testRequest
* @return Status JsonObject
*/
public static JSONObject GetStatusFromTopgpResponse(String TopgpResonseXml) {
JSONObject jsonObject = XML.toJSONObject(TopgpResonseXml);
public static JSONObject GetStatusFromTopgpResponse(String TopgpResponseXml) {
JSONObject jsonObject = JSONObject.parseObject(XML.toJSONObject(TopgpResponseXml).toString());
JSONObject envelope = jsonObject.getJSONObject("SOAP-ENV:Envelope");
JSONObject body = envelope.getJSONObject("SOAP-ENV:Body");
JSONObject express_testResponse = body.getJSONObject("fjs1:express_testResponse");

View File

@ -127,7 +127,7 @@ public class FileUploadUtils
return fileName;
}
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
{
File desc = new File(uploadDir + File.separator + fileName);
@ -141,7 +141,7 @@ public class FileUploadUtils
return desc;
}
private static final String getPathFileName(String uploadDir, String fileName) throws IOException
public static final String getPathFileName(String uploadDir, String fileName) throws IOException
{
int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);

View File

@ -3,6 +3,7 @@ package com.ruoyi.common.utils.file;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
@ -10,8 +11,12 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
/**
* 文件处理工具类
@ -53,31 +58,50 @@ public class FileUtils
}
finally
{
if (os != null)
{
try
{
os.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
if (fis != null)
{
try
{
fis.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
IOUtils.close(os);
IOUtils.close(fis);
}
}
/**
* 写数据到文件中
*
* @param data 数据
* @return 目标文件
* @throws IOException IO异常
*/
public static String writeImportBytes(byte[] data) throws IOException
{
return writeBytes(data, RuoYiConfig.getImportPath());
}
/**
* 写数据到文件中
*
* @param data 数据
* @param uploadDir 目标文件
* @return 目标文件
* @throws IOException IO异常
*/
public static String writeBytes(byte[] data, String uploadDir) throws IOException
{
FileOutputStream fos = null;
String pathName = "";
try
{
String extension = getFileExtendName(data);
pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
fos = new FileOutputStream(file);
fos.write(data);
}
finally
{
IOUtils.close(fos);
}
return FileUploadUtils.getPathFileName(uploadDir, pathName);
}
/**
* 删除文件
*
@ -200,4 +224,33 @@ public class FileUtils
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
return encode.replaceAll("\\+", "%20");
}
/**
* 获取图像后缀
*
* @param photoByte 图像数据
* @return 后缀名
*/
public static String getFileExtendName(byte[] photoByte)
{
String strFileExtendName = "jpg";
if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56)
&& ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97))
{
strFileExtendName = "gif";
}
else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70))
{
strFileExtendName = "jpg";
}
else if ((photoByte[0] == 66) && (photoByte[1] == 77))
{
strFileExtendName = "bmp";
}
else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71))
{
strFileExtendName = "png";
}
return strFileExtendName;
}
}

View File

@ -19,6 +19,13 @@ import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFPicture;
import org.apache.poi.hssf.usermodel.HSSFPictureData;
import org.apache.poi.hssf.usermodel.HSSFShape;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
@ -33,6 +40,7 @@ import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
@ -43,6 +51,12 @@ import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.xssf.usermodel.XSSFDrawing;
import org.apache.poi.xssf.usermodel.XSSFPicture;
import org.apache.poi.xssf.usermodel.XSSFShape;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ruoyi.common.annotation.Excel;
@ -57,6 +71,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileTypeUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.file.ImageUtils;
import com.ruoyi.common.utils.reflect.ReflectUtils;
@ -170,23 +185,22 @@ public class ExcelUtil<T>
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
List<T> list = new ArrayList<T>();
Sheet sheet = null;
if (StringUtils.isNotEmpty(sheetName))
{
// 如果指定sheet名,则取指定sheet中的内容.
sheet = wb.getSheet(sheetName);
}
else
{
// 如果传入的sheet名不存在则默认指向第1个sheet.
sheet = wb.getSheetAt(0);
}
// 如果指定sheet名,则取指定sheet中的内容 否则默认指向第1个sheet
Sheet sheet = StringUtils.isNotEmpty(sheetName) ? wb.getSheet(sheetName) : wb.getSheetAt(0);
if (sheet == null)
{
throw new IOException("文件sheet不存在");
}
boolean isXSSFWorkbook = !(wb instanceof HSSFWorkbook);
Map<String, PictureData> pictures;
if (isXSSFWorkbook)
{
pictures = getSheetPictrues07((XSSFSheet) sheet, (XSSFWorkbook) wb);
}
else
{
pictures = getSheetPictrues03((HSSFSheet) sheet, (HSSFWorkbook) wb);
}
// 获取最后一个非空行的行下标比如总行数为n则返回的为n-1
int rows = sheet.getLastRowNum();
@ -315,10 +329,20 @@ public class ExcelUtil<T>
{
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
}
else if (StringUtils.isNotEmpty(attr.dictType()))
else if (StringUtils.isNotEmpty(attr.dictType()) && StringUtils.isEmpty(attr.dictTypeExceptImport()))
{
val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
}
else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures))
{
PictureData image = pictures.get(row.getRowNum() + "_" + entry.getKey());
if (image == null)
{
val = "";
}
byte[] data = image.getData();
val = FileUtils.writeImportBytes(data);
}
ReflectUtils.invokeSetter(entity, propertyName, val);
}
}
@ -694,7 +718,8 @@ public class ExcelUtil<T>
{
cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator));
}
else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value))
else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value) && StringUtils.isEmpty(attr.dictTypeExceptExport()))
{
cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator));
}
@ -904,10 +929,9 @@ public class ExcelUtil<T>
{
if (statistics.size() > 0)
{
Cell cell = null;
Row row = sheet.createRow(sheet.getLastRowNum() + 1);
Set<Integer> keys = statistics.keySet();
cell = row.createCell(0);
Cell cell = row.createCell(0);
cell.setCellStyle(styles.get("total"));
cell.setCellValue("合计");
@ -1165,4 +1189,71 @@ public class ExcelUtil<T>
}
return true;
}
}
/**
* 获取Excel2003图片
*
* @param sheet 当前sheet对象
* @param workbook 工作簿对象
* @return Map key:图片单元格索引1_1Stringvalue:图片流PictureData
*/
public static Map<String, PictureData> getSheetPictrues03(HSSFSheet sheet, HSSFWorkbook workbook)
{
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
List<HSSFPictureData> pictures = workbook.getAllPictures();
if (!pictures.isEmpty())
{
for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren())
{
HSSFClientAnchor anchor = (HSSFClientAnchor) shape.getAnchor();
if (shape instanceof HSSFPicture)
{
HSSFPicture pic = (HSSFPicture) shape;
int pictureIndex = pic.getPictureIndex() - 1;
HSSFPictureData picData = pictures.get(pictureIndex);
String picIndex = String.valueOf(anchor.getRow1()) + "_" + String.valueOf(anchor.getCol1());
sheetIndexPicMap.put(picIndex, picData);
}
}
return sheetIndexPicMap;
}
else
{
return sheetIndexPicMap;
}
}
/**
* 获取Excel2007图片
*
* @param sheet 当前sheet对象
* @param workbook 工作簿对象
* @return Map key:图片单元格索引1_1Stringvalue:图片流PictureData
*/
public static Map<String, PictureData> getSheetPictrues07(XSSFSheet sheet, XSSFWorkbook workbook)
{
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
for (POIXMLDocumentPart dr : sheet.getRelations())
{
if (dr instanceof XSSFDrawing)
{
XSSFDrawing drawing = (XSSFDrawing) dr;
List<XSSFShape> shapes = drawing.getShapes();
for (XSSFShape shape : shapes)
{
if (shape instanceof XSSFPicture)
{
XSSFPicture pic = (XSSFPicture) shape;
XSSFClientAnchor anchor = pic.getPreferredSize();
CTMarker ctMarker = anchor.getFrom();
//String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
//todo 此处有错误暂时picIndex=""处理掉
String picIndex="";
sheetIndexPicMap.put(picIndex, pic.getPictureData());
}
}
}
}
return sheetIndexPicMap;
}
}

View File

@ -125,6 +125,12 @@ public class ShiroConfig
@Value("${shiro.user.unauthorizedUrl}")
private String unauthorizedUrl;
/**
* 是否开启记住我功能
*/
@Value("${shiro.rememberMe.enabled: false}")
private boolean rememberMe;
/**
* 缓存管理器 使用Ehcache实现
*/
@ -239,7 +245,7 @@ public class ShiroConfig
// 设置realm.
securityManager.setRealm(userRealm);
// 记住我
securityManager.setRememberMeManager(rememberMeManager());
securityManager.setRememberMeManager(rememberMe ? rememberMeManager() : null);
// 注入缓存管理器;
securityManager.setCacheManager(getEhCacheManager());
// session管理器

View File

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.Constants;
@ -189,4 +190,31 @@ public class SysJobController extends BaseController
{
return jobService.checkCronExpressionIsValid(job.getCronExpression());
}
/**
* Cron表达式在线生成
*/
@GetMapping("/cron")
public String cron()
{
return prefix + "/cron";
}
/**
* 查询cron表达式近5次的执行时间
*/
@GetMapping("/queryCronExpression")
@ResponseBody
public AjaxResult queryCronExpression(@RequestParam(value = "cronExpression", required = false) String cronExpression)
{
if (jobService.checkCronExpressionIsValid(cronExpression))
{
List<String> dateList = CronUtils.getRecentTriggerTime(cronExpression);
return success(dateList);
}
else
{
return error("表达式无效");
}
}
}

View File

@ -1,8 +1,13 @@
package com.ruoyi.quartz.util;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.quartz.CronExpression;
import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl;
import com.ruoyi.common.utils.DateUtils;
/**
* cron表达式工具类
@ -60,4 +65,30 @@ public class CronUtils
throw new IllegalArgumentException(e.getMessage());
}
}
/**
* 通过表达式获取近10次的执行时间
*
* @param cron 表达式
* @return 时间列表
*/
public static List<String> getRecentTriggerTime(String cron)
{
List<String> list = new ArrayList<String>();
try
{
CronTriggerImpl cronTriggerImpl = new CronTriggerImpl();
cronTriggerImpl.setCronExpression(cron);
List<Date> dates = TriggerUtils.computeFireTimes(cronTriggerImpl, null, 10);
for (Date date : dates)
{
list.add(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, date));
}
}
catch (ParseException e)
{
return null;
}
return list;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,9 @@
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-primary" onclick="javascript:cron()">
<i class="fa fa-code"></i> 生成表达式
</a>
<a class="btn btn-info" onclick="javascript:jobLog()" shiro:hasPermission="monitor:job:detail">
<i class="fa fa-list"></i> 日志
</a>
@ -176,6 +179,19 @@
}
$.modal.openTab("调度日志", url);
}
/* cron表达式生成 */
function cron() {
var url = prefix + '/cron';
var height = $(window).height() - 50;
top.layer.open({
title: "Cron表达式生成器",
type: 2,
area: ['800px', height + "px" ], //宽高
shadeClose: true,
content: url
});
}
</script>
</body>
</html>

View File

@ -136,6 +136,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 加载字典缓存数据
*/
@Override
public void loadingDictCache()
{
List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();
@ -149,6 +150,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 清空字典缓存数据
*/
@Override
public void clearDictCache()
{
DictUtils.clearDictCache();
@ -157,6 +159,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
/**
* 重置字典缓存数据
*/
@Override
public void resetDictCache()
{
clearDictCache();