Commit f246d8444551f869035bfd50ceb7383d92dba468

Authored by liujun001
1 parent 51a1f0c5

对接统一登录平台和优化

Showing 33 changed files with 2011 additions and 40 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/RefreshController.java
... ... @@ -12,6 +12,7 @@ import com.ruoyi.domain.sign.in.summary.SignReportDaySummary;
12 12 import com.ruoyi.equipment.domain.Equipment;
13 13 import com.ruoyi.equipment.service.IEquipmentService;
14 14 import com.ruoyi.job.DriverJob;
  15 +import com.ruoyi.job.SignReportSummerJob;
15 16 import com.ruoyi.service.SignReportServer;
16 17 import com.ruoyi.service.driver.NewDriverService;
17 18 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
... ... @@ -60,6 +61,8 @@ public class RefreshController {
60 61 private SignReportDaySummaryService signReportDaySummaryService;
61 62 @Autowired
62 63 private SignReportServer signReportServer;
  64 + @Autowired
  65 + private SignReportSummerJob signReportSummerJob;
63 66  
64 67  
65 68 @GetMapping(value = "/scheduling")
... ... @@ -109,7 +112,7 @@ public class RefreshController {
109 112  
110 113 @GetMapping(value = "/driver")
111 114 @ApiOperation("driver")
112   - @PreAuthorize("@ss.hasPermi('refresh:driver')")
  115 + //@PreAuthorize("@ss.hasPermi('refresh:driver')")
113 116 public ResponseResult<Boolean> insertDriver() {
114 117 newDriverService.insertJob();
115 118 log.info("人员信息同步完毕");
... ... @@ -331,4 +334,12 @@ public class RefreshController {
331 334 return ResponseResult.success();
332 335 }
333 336  
  337 + @GetMapping(value = "/sign/report/summary/day")
  338 + @ApiOperation("/sign/report/summary/day")
  339 + public ResponseResult<String> signReportSummary1() throws ParseException {
  340 + signReportSummerJob.calSignReportSummary();
  341 +
  342 + return ResponseResult.success();
  343 + }
  344 +
334 345 }
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
... ... @@ -224,8 +224,12 @@ public class KeyBoxController extends BaseController {
224 224 logger.info("根据DTO的数据无法查询车辆信息:[{}]", dto);
225 225 }
226 226  
  227 + scheduling.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addMonths(scheduling.getStartScheduleDate(), 1));
  228 + scheduling.setStartScheduleDate(org.apache.commons.lang3.time.DateUtils.addMonths(dto.getTime(), -1));
227 229  
228   - BasicSyncVo vo = convertBasicSyncVo(workLocations, schedulings, keyInfos, drivers, carInfos, equipment, venueInfo, equipmentList);
  230 +
  231 + Collection<String> nbbms1 = schedulingService.listNbbmByEntity(scheduling);
  232 + BasicSyncVo vo = convertBasicSyncVo(workLocations, schedulings, keyInfos, drivers, carInfos, equipment, venueInfo, equipmentList, nbbms1);
229 233 return ResponseResult.success(vo);
230 234 } catch (ParseException e) {
231 235 logger.error("钥匙柜基础信息同步异常:[{}]", dto, e);
... ... @@ -835,6 +839,7 @@ public class KeyBoxController extends BaseController {
835 839 if (Objects.nonNull(venueInfo)) {
836 840 vo.setYardId(Convert.toStr(venueInfo.getId()));
837 841 vo.setYardName(venueInfo.getName());
  842 +
838 843 }
839 844  
840 845  
... ... @@ -855,7 +860,7 @@ public class KeyBoxController extends BaseController {
855 860  
856 861 private BasicSyncVo convertBasicSyncVo(List<LinggangKeyWorkLocation> workLocations, List<LinggangScheduling> schedulings,
857 862 List<KeyInfo> keyInfos, List<NewDriver> drivers, List<CarInfo> carInfos, Equipment equipment,
858   - LinggangVenueInfo venueInfo, List<Equipment> equipmentList) {
  863 + LinggangVenueInfo venueInfo, List<Equipment> equipmentList, Collection<String> nbbms1) {
859 864 BasicSyncVo vo = new BasicSyncVo();
860 865  
861 866 vo.setDevice(equipment.getDeviceId());
... ... @@ -924,11 +929,9 @@ public class KeyBoxController extends BaseController {
924 929 });
925 930 }
926 931 vo.setDriverWork(driverWork);
927   - if (CollectionUtils.isNotEmpty(schedulings) && CollectionUtils.isNotEmpty(carInfos)) {
928   - Set<String> nbbms = schedulings.stream().filter(s -> Objects.equals(s.getQdzcode(), venueInfo.getParkCode()) ||
929   - Objects.equals(s.getZdzcode(), venueInfo.getParkCode())).map(LinggangScheduling::getNbbm).collect(Collectors.toSet());
930   - List<String> plateNums = carInfos.stream().filter(c -> nbbms.contains(c.getNbbm())).map(CarInfo::getNbbm).collect(Collectors.toList());
931   - vo.setYardVehicles(plateNums);
  932 + if (CollectionUtils.isNotEmpty(nbbms1)) {
  933 + List<String> nbbms2 = nbbms1.stream().collect(Collectors.toList());
  934 + vo.setYardVehicles(nbbms2);
932 935  
933 936 }
934 937  
... ... @@ -966,6 +969,7 @@ public class KeyBoxController extends BaseController {
966 969 Optional<LinggangKeyWorkLocation> opt = schedulings.stream().filter(s -> Objects.equals(item.getKey(), s.getCabinetNo())).findFirst();
967 970 if (opt.isPresent()) {
968 971 location.setKeyInfoId(opt.get().getKeyInfoId());
  972 + location.setSchedulingId(opt.get().getId());
969 973 }
970 974 }
971 975 if (Objects.nonNull(keyInfos)) {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/caiinfo/LingangCarInfo.java 0 → 100644
  1 +package com.ruoyi.domain.caiinfo;
  2 +
  3 +import lombok.Data;
  4 +import com.baomidou.mybatisplus.annotation.IdType;
  5 +import com.baomidou.mybatisplus.annotation.TableField;
  6 +import com.baomidou.mybatisplus.annotation.TableId;
  7 +import com.baomidou.mybatisplus.annotation.TableName;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import lombok.EqualsAndHashCode;
  10 +import lombok.experimental.Accessors;
  11 +import lombok.extern.slf4j.Slf4j;
  12 +import lombok.NoArgsConstructor;
  13 +import lombok.AllArgsConstructor;
  14 +import com.ruoyi.common.annotation.Excel;
  15 +
  16 +
  17 +@Data
  18 +@Slf4j
  19 +@NoArgsConstructor
  20 +@AllArgsConstructor
  21 +@Accessors(chain = true)
  22 +@EqualsAndHashCode(callSuper = false)
  23 +@TableName("car_info")
  24 +/**车辆信息 实体*/
  25 +public class LingangCarInfo {
  26 + /***ID*/
  27 + @TableId(value = "id", type = IdType.AUTO)
  28 + @Excel(name = "ID")
  29 + private Integer id;
  30 +
  31 +
  32 + /***车牌号*/
  33 + @Excel(name = "车牌号")
  34 + private String plateNum;
  35 +
  36 +
  37 + /***车位号*/
  38 + @Excel(name = "车位号")
  39 + private String parkingNo;
  40 +
  41 +
  42 + /***车辆状态:1为正常车,0为维修车,2为故障车*/
  43 + @Excel(name = "车辆状态:1为正常车,0为维修车,2为故障车")
  44 + private Integer status;
  45 +
  46 +
  47 + /***创建人员*/
  48 + @Excel(name = "创建人员")
  49 + private String createBy;
  50 +
  51 +
  52 + /***创建时间*/
  53 + @Excel(name = "创建时间")
  54 + private java.util.Date createTime;
  55 +
  56 +
  57 + /***修改人员*/
  58 + @Excel(name = "修改人员")
  59 + private String updateBy;
  60 +
  61 +
  62 + /***修改时间*/
  63 + @Excel(name = "修改时间")
  64 + private java.util.Date updateTime;
  65 +
  66 +
  67 + /***车辆自编号*/
  68 + @Excel(name = "车辆自编号")
  69 + private String nbbm;
  70 +
  71 +
  72 + @Override
  73 + public String toString() {
  74 + return com.alibaba.fastjson2.JSON.toJSONString(this);
  75 + }
  76 +}
0 77 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/caiinfo/dto/LingangCarInfoAddDTO.java 0 → 100644
  1 +package com.ruoyi.domain.caiinfo.dto;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.experimental.Accessors;
  8 +
  9 +@Data
  10 +@ApiModel(value = "车辆信息的添加DTO")
  11 +@Accessors(chain = true)
  12 +@EqualsAndHashCode(callSuper = false)
  13 +/**车辆信息 DTO*/
  14 +public class LingangCarInfoAddDTO implements java.io.Serializable {
  15 + private static final long serialVersionUID = 425294388L;
  16 +
  17 + /***ID*/
  18 + @ApiModelProperty(value = "ID", example = "1")
  19 + private Integer id;
  20 + /***车牌号*/
  21 + @ApiModelProperty(value = "车牌号")
  22 + private String plateNum;
  23 + /***车位号*/
  24 + @ApiModelProperty(value = "车位号")
  25 + private String parkingNo;
  26 + /***车辆状态:1为正常车,0为维修车,2为故障车*/
  27 + @ApiModelProperty(value = "车辆状态:1为正常车,0为维修车,2为故障车", example = "1")
  28 + private Integer status;
  29 + /***创建人员*/
  30 + @ApiModelProperty(value = "创建人员")
  31 + private String createBy;
  32 + /***创建时间*/
  33 + @ApiModelProperty(value = "创建时间")
  34 + private java.util.Date createTime;
  35 + /***修改人员*/
  36 + @ApiModelProperty(value = "修改人员")
  37 + private String updateBy;
  38 + /***修改时间*/
  39 + @ApiModelProperty(value = "修改时间")
  40 + private java.util.Date updateTime;
  41 + /***车辆自编号*/
  42 + @ApiModelProperty(value = "车辆自编号")
  43 + private String nbbm;
  44 + /***操作人员*/
  45 + @ApiModelProperty(value = "操作人员")
  46 + private String operator;
  47 +
  48 +
  49 + public void clearStrEmpty() {
  50 + if (org.apache.commons.lang3.StringUtils.isEmpty(this.plateNum)) {
  51 + this.plateNum = null;
  52 + }
  53 + if (org.apache.commons.lang3.StringUtils.isEmpty(this.parkingNo)) {
  54 + this.parkingNo = null;
  55 + }
  56 + if (org.apache.commons.lang3.StringUtils.isEmpty(this.createBy)) {
  57 + this.createBy = null;
  58 + }
  59 + if (org.apache.commons.lang3.StringUtils.isEmpty(this.updateBy)) {
  60 + this.updateBy = null;
  61 + }
  62 + if (org.apache.commons.lang3.StringUtils.isEmpty(this.nbbm)) {
  63 + this.nbbm = null;
  64 + }
  65 + if (org.apache.commons.lang3.StringUtils.isEmpty(this.operator)) {
  66 + this.operator = null;
  67 + }
  68 + }
  69 +
  70 +
  71 + @Override
  72 + public String toString() {
  73 + return com.alibaba.fastjson2.JSON.toJSONString(this);
  74 + }
  75 +}
0 76 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/caiinfo/dto/LingangCarInfoQueryDTO.java 0 → 100644
  1 +package com.ruoyi.domain.caiinfo.dto;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.experimental.Accessors;
  8 +
  9 +@Data
  10 +@ApiModel(value="车辆信息的查询DTO")
  11 +@Accessors(chain = true)
  12 +@EqualsAndHashCode(callSuper = false)
  13 +/**车辆信息 DTO*/
  14 +public class LingangCarInfoQueryDTO implements java.io.Serializable{
  15 + private static final long serialVersionUID = 494396122L;
  16 +
  17 + /***ID*/
  18 + @ApiModelProperty(value="ID",example ="1")
  19 + private Integer id;
  20 + /***车牌号*/
  21 + @ApiModelProperty(value="车牌号")
  22 + private String plateNum;
  23 + /***车位号*/
  24 + @ApiModelProperty(value="车位号")
  25 + private String parkingNo;
  26 + /***车辆状态:1为正常车,0为维修车,2为故障车*/
  27 + @ApiModelProperty(value="车辆状态:1为正常车,0为维修车,2为故障车",example ="1")
  28 + private Integer status;
  29 + /***创建人员*/
  30 + @ApiModelProperty(value="创建人员")
  31 + private String createBy;
  32 + /***创建时间*/
  33 + @ApiModelProperty(value="创建时间")
  34 + private java.util.Date createTime;
  35 + /***修改人员*/
  36 + @ApiModelProperty(value="修改人员")
  37 + private String updateBy;
  38 + /***修改时间*/
  39 + @ApiModelProperty(value="修改时间")
  40 + private java.util.Date updateTime;
  41 + /***车辆自编号*/
  42 + @ApiModelProperty(value="车辆自编号")
  43 + private String nbbm;
  44 +
  45 +
  46 +
  47 + public void clearStrEmpty(){
  48 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.plateNum)){
  49 + this.plateNum = null;
  50 + }
  51 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.parkingNo)){
  52 + this.parkingNo = null;
  53 + }
  54 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.createBy)){
  55 + this.createBy = null;
  56 + }
  57 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.updateBy)){
  58 + this.updateBy = null;
  59 + }
  60 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.nbbm)){
  61 + this.nbbm = null;
  62 + }
  63 + }
  64 +
  65 +
  66 +
  67 + @Override
  68 + public String toString() {return com.alibaba.fastjson2.JSON.toJSONString(this);}
  69 +}
0 70 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/caiinfo/dto/LingangCarInfoUpdateDTO.java 0 → 100644
  1 +package com.ruoyi.domain.caiinfo.dto;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.experimental.Accessors;
  8 +
  9 +@Data
  10 +@ApiModel(value="车辆信息的修改DTO")
  11 +@Accessors(chain = true)
  12 +@EqualsAndHashCode(callSuper = false)
  13 +/**车辆信息 DTO*/
  14 +public class LingangCarInfoUpdateDTO implements java.io.Serializable{
  15 + private static final long serialVersionUID = 966326136L;
  16 +
  17 + /***ID*/
  18 + @ApiModelProperty(value="ID",example ="1")
  19 + private Integer id;
  20 + /***车牌号*/
  21 + @ApiModelProperty(value="车牌号")
  22 + private String plateNum;
  23 + /***车位号*/
  24 + @ApiModelProperty(value="车位号")
  25 + private String parkingNo;
  26 + /***车辆状态:1为正常车,0为维修车,2为故障车*/
  27 + @ApiModelProperty(value="车辆状态:1为正常车,0为维修车,2为故障车",example ="1")
  28 + private Integer status;
  29 + /***创建人员*/
  30 + @ApiModelProperty(value="创建人员")
  31 + private String createBy;
  32 + /***创建时间*/
  33 + @ApiModelProperty(value="创建时间")
  34 + private java.util.Date createTime;
  35 + /***修改人员*/
  36 + @ApiModelProperty(value="修改人员")
  37 + private String updateBy;
  38 + /***修改时间*/
  39 + @ApiModelProperty(value="修改时间")
  40 + private java.util.Date updateTime;
  41 + /***车辆自编号*/
  42 + @ApiModelProperty(value="车辆自编号")
  43 + private String nbbm;
  44 + /***操作人员*/
  45 + @ApiModelProperty(value="操作人员")
  46 + private String operator;
  47 +
  48 +
  49 +
  50 + public void clearStrEmpty(){
  51 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.plateNum)){
  52 + this.plateNum = null;
  53 + }
  54 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.parkingNo)){
  55 + this.parkingNo = null;
  56 + }
  57 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.createBy)){
  58 + this.createBy = null;
  59 + }
  60 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.updateBy)){
  61 + this.updateBy = null;
  62 + }
  63 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.nbbm)){
  64 + this.nbbm = null;
  65 + }
  66 + if(org.apache.commons.lang3.StringUtils.isEmpty(this.operator)){
  67 + this.operator = null;
  68 + }
  69 + }
  70 +
  71 +
  72 +
  73 + @Override
  74 + public String toString() {return com.alibaba.fastjson2.JSON.toJSONString(this);}
  75 +}
0 76 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/job/SignReportSummerJob.java
... ... @@ -21,7 +21,7 @@ import java.util.Set;
21 21 import java.util.stream.Collectors;
22 22  
23 23 @Slf4j
24   -@Component("SignReportSummerJob")
  24 +@Component("signReportSummerJob")
25 25 public class SignReportSummerJob implements InitializingBean {
26 26 @Autowired
27 27 private SignReportServer signReportServer;
... ... @@ -32,13 +32,14 @@ public class SignReportSummerJob implements InitializingBean {
32 32 Date date = new Date();
33 33 String dateStr = DateUtil.YYYY_MM_LINK.format(DateUtils.addDays(date, -1));
34 34 List<SignReportGroupByVo> signReportGroupByVos = signReportServer.querySignReportGroupByDateStrVo(dateStr);
  35 + String dateStr1 = DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(date, -1));
35 36  
36 37 if (CollectionUtils.isNotEmpty(signReportGroupByVos)) {
37   - List<SignReportGroupByVo> voList = signReportGroupByVos.stream().filter(s -> StringUtils.equals(s.getDateStr(), dateStr)).collect(Collectors.toList());
  38 + List<SignReportGroupByVo> voList = signReportGroupByVos.stream().filter(s -> StringUtils.equals(s.getDateStr(), dateStr1)).collect(Collectors.toList());
38 39  
39 40 if (CollectionUtils.isNotEmpty(voList)) {
40 41 SignReportDaySummary summary = new SignReportDaySummary();
41   - summary.setDatestr(dateStr);
  42 + summary.setDatestr(dateStr1);
42 43  
43 44 List<SignReportDaySummary> summaries = signReportDaySummaryService.list(summary);
44 45 if (CollectionUtils.isNotEmpty(summaries)) {
... ...
Bsth-admin/src/main/java/com/ruoyi/mapper/carinfo/LingangCarInfoMapper.java 0 → 100644
  1 +package com.ruoyi.mapper.carinfo;
  2 +
  3 +import com.ruoyi.domain.caiinfo.LingangCarInfo;
  4 +import org.apache.ibatis.annotations.Mapper;
  5 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  6 +
  7 +
  8 +@Mapper
  9 +/**车辆信息 Mapper接口*/
  10 +public interface LingangCarInfoMapper extends BaseMapper<LingangCarInfo> {
  11 + /**插入有值的列 */
  12 + int insertSelective(LingangCarInfo carInfo);
  13 +
  14 + int insertNotExit(LingangCarInfo carInfo);
  15 +}
0 16 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/mapper/key/info/KeyInfoMapper.java
... ... @@ -10,5 +10,7 @@ public interface KeyInfoMapper extends BaseMapper&lt;KeyInfo&gt; {
10 10 /**
11 11 * 插入有值的列
12 12 */
13   - int insertSelective(KeyInfo name);
  13 + int insertSelective(KeyInfo entity);
  14 +
  15 + int insertNotExists(KeyInfo entity);
14 16 }
15 17 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/mapper/scheduling/LinggangSchedulingMapper.java
... ... @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.ruoyi.domain.scheduling.LinggangScheduling;
5 5 import org.apache.ibatis.annotations.Mapper;
6 6  
  7 +import java.util.Collection;
7 8 import java.util.List;
8 9  
9 10  
... ... @@ -16,4 +17,7 @@ public interface LinggangSchedulingMapper extends BaseMapper&lt;LinggangScheduling&gt;
16 17 int insertSelective(LinggangScheduling name);
17 18  
18 19 List<LinggangScheduling> listByCZ(LinggangScheduling entity);
  20 +
  21 +
  22 + Collection<String> listNbbmByEntity(LinggangScheduling entity);
19 23 }
20 24 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
... ... @@ -35,6 +35,7 @@ import com.ruoyi.in.domain.SignIn;
35 35 import com.ruoyi.job.DriverJob;
36 36 import com.ruoyi.pojo.GlobalIndex;
37 37 import com.ruoyi.pojo.response.ResponseSchedulingDto;
  38 +import com.ruoyi.service.carinfo.LingangCarInfoService;
38 39 import com.ruoyi.service.driver.NewDriverService;
39 40 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
40 41 import com.ruoyi.service.scheduling.LinggangSchedulingService;
... ... @@ -136,6 +137,8 @@ public class ThreadJobService {
136 137 private LinggangSchedulingService linggangSchedulingService;
137 138 @Autowired
138 139 private NewDriverService newDriverService;
  140 + @Autowired
  141 + private LingangCarInfoService lingangCarInfoService;
139 142  
140 143 @Value("${bsth.process.sign.url}")
141 144 private String processSignExceptionURL;
... ... @@ -606,6 +609,8 @@ public class ThreadJobService {
606 609 }
607 610 List<DriverScheduling> bcList = getBcList(originSchedulingMap, type);
608 611  
  612 + lingangCarInfoService.insert(bcList);
  613 +
609 614 // 处理非司售人员的排班明细
610 615 bcList.addAll(handleOtherPostsScheduling(type));
611 616 // 插入排班
... ...
Bsth-admin/src/main/java/com/ruoyi/service/carinfo/LingangCarInfoService.java 0 → 100644
  1 +package com.ruoyi.service.carinfo;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.baomidou.mybatisplus.core.metadata.IPage;
  5 +
  6 +import java.util.List;
  7 +
  8 +import com.ruoyi.domain.DriverScheduling;
  9 +import com.ruoyi.domain.OrderEntity;
  10 +import com.ruoyi.domain.caiinfo.LingangCarInfo;
  11 +
  12 +/**
  13 + * 车辆信息 Service接口
  14 + */
  15 +public interface LingangCarInfoService extends IService<LingangCarInfo> {
  16 + /**
  17 + * 分页查询
  18 + */
  19 + IPage<LingangCarInfo> pageList(com.baomidou.mybatisplus.extension.plugins.pagination.Page<LingangCarInfo> page, LingangCarInfo entity, OrderEntity orderEntity);
  20 +
  21 + /**
  22 + * 带条件查询
  23 + */
  24 + List<LingangCarInfo> list(LingangCarInfo entity);
  25 +
  26 + // List<LingangCarInfo> listOfIds(java.util.Collection<java.lang.Integer> ids);
  27 + // /***
  28 + // *用于页面选择
  29 + // */
  30 + // List<LingangCarInfo> listOfSelect(LingangCarInfo entity);
  31 +
  32 + /**
  33 + * 条件查询只返回一条数据的方法
  34 + */
  35 + LingangCarInfo getOne(LingangCarInfo entity);
  36 +
  37 + Integer countId(LingangCarInfo entity);
  38 +
  39 + /**
  40 + * 插入有值的列
  41 + */
  42 + int insertSelective(LingangCarInfo entity);
  43 +
  44 + /***插入数据*/
  45 + boolean insert(LingangCarInfo entity);
  46 +
  47 + boolean insert(List<DriverScheduling> bcList);
  48 +
  49 + /**
  50 + * 根据主键修改数据
  51 + */
  52 + boolean updateByPrimaryKey(LingangCarInfo entity);
  53 +
  54 + boolean deleteById(Integer id);
  55 +}
0 56 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/carinfo/LingangCarInfoServiceImpl.java 0 → 100644
  1 +package com.ruoyi.service.impl.carinfo;
  2 +
  3 +import com.ruoyi.domain.DriverScheduling;
  4 +import com.ruoyi.domain.key.info.KeyInfo;
  5 +import com.ruoyi.service.carinfo.LingangCarInfoService;
  6 +import com.ruoyi.service.key.info.KeyInfoService;
  7 +import org.apache.commons.collections4.CollectionUtils;
  8 +import org.apache.commons.lang3.RandomUtils;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  13 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  14 +import com.baomidou.mybatisplus.core.metadata.IPage;
  15 +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  16 +
  17 +import com.github.pagehelper.PageHelper;
  18 +import lombok.extern.slf4j.Slf4j;
  19 +
  20 +import java.util.Collections;
  21 +import java.util.List;
  22 +import java.util.Set;
  23 +import java.util.stream.Collectors;
  24 +
  25 +import com.ruoyi.domain.OrderEntity;
  26 +import com.ruoyi.domain.caiinfo.LingangCarInfo;
  27 +import com.ruoyi.mapper.carinfo.LingangCarInfoMapper;
  28 +
  29 +@Slf4j
  30 +@Service
  31 +/**车辆信息 Service实现类*/
  32 +public class LingangCarInfoServiceImpl extends ServiceImpl<LingangCarInfoMapper, LingangCarInfo> implements LingangCarInfoService {
  33 + @Autowired
  34 + private LingangCarInfoMapper lingangCarInfoMapper;
  35 + @Autowired
  36 + private KeyInfoService keyInfoService;
  37 +
  38 + /**
  39 + * 分页查询
  40 + */
  41 + @Override
  42 + public IPage<LingangCarInfo> pageList(Page<LingangCarInfo> page, LingangCarInfo entity, OrderEntity orderEntity) {
  43 + LambdaQueryWrapper<LingangCarInfo> countWrapper = new LambdaQueryWrapper<>(entity);
  44 + countWrapper.select(LingangCarInfo::getId);
  45 + int count = count(countWrapper);
  46 +
  47 + List<LingangCarInfo> lists = Collections.emptyList();
  48 + if (count > 0) {
  49 + PageHelper.startPage((int) page.getCurrent(), (int) page.getSize(), false);
  50 + LambdaQueryWrapper<LingangCarInfo> selectWrapper = new LambdaQueryWrapper<>(entity);
  51 + orderColumn(selectWrapper, orderEntity);
  52 + lists = list(selectWrapper);
  53 + }
  54 +
  55 + IPage<LingangCarInfo> returnPage = new Page<LingangCarInfo>();
  56 + returnPage.setRecords(lists);
  57 + returnPage.setPages(count % page.getSize() == 0 ? count / page.getSize() : count / page.getSize() + 1);
  58 + returnPage.setCurrent(page.getCurrent());
  59 + returnPage.setSize(page.getSize());
  60 + returnPage.setTotal(count);
  61 +
  62 + return returnPage;
  63 + }
  64 +
  65 + @Override
  66 + public List<LingangCarInfo> list(LingangCarInfo entity) {
  67 + return list(new LambdaQueryWrapper<>(entity));
  68 + }
  69 + // @Override
  70 + // public List<LingangCarInfo> listOfSelect(LingangCarInfo entity) {
  71 + // LambdaQueryWrapper<LingangCarInfo> wrapper = new LambdaQueryWrapper<>(entity);
  72 + // wrapper.select(LingangCarInfo::, LingangCarInfo::);
  73 + // return list(wrapper);
  74 + // }
  75 +
  76 + // @Override
  77 + // public List<LingangCarInfo> listOfIds(java.util.Collection<java.lang.Integer> ids) {
  78 + // if (org.springframework.util.CollectionUtils.isEmpty(ids)) {
  79 + // return java.util.Collections.emptyList();
  80 + // }
  81 + // LambdaQueryWrapper<LingangCarInfo> wrapper = new LambdaQueryWrapper<>();
  82 + // wrapper.select(LingangCarInfo::getId,LingangCarInfo::);
  83 + // wrapper.in(LingangCarInfo::getId, ids);
  84 + // return list(wrapper);
  85 + // }
  86 +
  87 + @Override
  88 + public LingangCarInfo getOne(LingangCarInfo entity) {
  89 + return getOne(new LambdaQueryWrapper<>(entity));
  90 + }
  91 +
  92 + @Override
  93 + public Integer countId(LingangCarInfo entity) {
  94 + LambdaQueryWrapper<LingangCarInfo> wrapper = new LambdaQueryWrapper<>(entity);
  95 + wrapper.select(LingangCarInfo::getId);
  96 + return count(wrapper);
  97 + }
  98 +
  99 +
  100 + /**
  101 + * 插入有值的列
  102 + */
  103 + @Override
  104 + public int insertSelective(LingangCarInfo entity) {
  105 + return lingangCarInfoMapper.insertSelective(entity);
  106 + }
  107 +
  108 + /**
  109 + * 插入数据
  110 + */
  111 + @Override
  112 + public boolean insert(LingangCarInfo entity) {
  113 + return save(entity);
  114 + }
  115 +
  116 + @Override
  117 + public boolean insert(List<DriverScheduling> bcList) {
  118 + if (CollectionUtils.isEmpty(bcList)) {
  119 + return Boolean.TRUE;
  120 + }
  121 + Set<String> nbbms = bcList.stream().map(DriverScheduling::getNbbm).collect(Collectors.toSet());
  122 + nbbms.stream().forEach(nbbm -> {
  123 + LingangCarInfo carInfo = new LingangCarInfo();
  124 + carInfo.setNbbm(nbbm);
  125 + carInfo.setStatus(1);
  126 +
  127 + int count = lingangCarInfoMapper.insertNotExit(carInfo);
  128 + if (count > 0) {
  129 + log.info("添加车辆:[{}}", carInfo.getNbbm());
  130 + }
  131 +
  132 + LambdaQueryWrapper<LingangCarInfo> wrapper = new LambdaQueryWrapper<>();
  133 + wrapper.eq(LingangCarInfo::getNbbm, nbbm);
  134 + carInfo = list(wrapper).get(0);
  135 +
  136 + KeyInfo keyInfo = new KeyInfo();
  137 + keyInfo.setName("自编号为" + nbbm + "的车辆钥匙");
  138 + keyInfo.setDelFlag(Boolean.FALSE);
  139 + keyInfo.setPlateNum(carInfo.getPlateNum());
  140 + keyInfo.setNmmb(nbbm);
  141 + keyInfo.setKeyCode(nbbm + RandomUtils.nextInt(1, 100));
  142 + count = keyInfoService.insertNotExists(keyInfo);
  143 +
  144 + if (count > 0) {
  145 + log.info("添加车辆钥匙:[{}}", carInfo.getNbbm());
  146 + }
  147 +
  148 + });
  149 +
  150 + return true;
  151 + }
  152 +
  153 + /**
  154 + * 根据主键修改数据
  155 + */
  156 + @Override
  157 + public boolean updateByPrimaryKey(LingangCarInfo entity) {
  158 + return updateById(entity);
  159 + }
  160 +
  161 + /***根据主键删除数据*/
  162 + @Override
  163 + public boolean deleteById(Integer id) {
  164 + return removeById(id);
  165 + }
  166 +
  167 +
  168 + public static void orderColumn(LambdaQueryWrapper<LingangCarInfo> wrapper, OrderEntity orderEntity) {
  169 + if (org.apache.commons.lang3.StringUtils.equals("ascending", orderEntity.getOrder())) {
  170 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "id")) {
  171 + wrapper.orderByAsc(LingangCarInfo::getId);
  172 + }
  173 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "plateNum")) {
  174 + wrapper.orderByAsc(LingangCarInfo::getPlateNum);
  175 + }
  176 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "parkingNo")) {
  177 + wrapper.orderByAsc(LingangCarInfo::getParkingNo);
  178 + }
  179 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "status")) {
  180 + wrapper.orderByAsc(LingangCarInfo::getStatus);
  181 + }
  182 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "createBy")) {
  183 + wrapper.orderByAsc(LingangCarInfo::getCreateBy);
  184 + }
  185 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "createTime")) {
  186 + wrapper.orderByAsc(LingangCarInfo::getCreateTime);
  187 + }
  188 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "updateBy")) {
  189 + wrapper.orderByAsc(LingangCarInfo::getUpdateBy);
  190 + }
  191 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "updateTime")) {
  192 + wrapper.orderByAsc(LingangCarInfo::getUpdateTime);
  193 + }
  194 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "nbbm")) {
  195 + wrapper.orderByAsc(LingangCarInfo::getNbbm);
  196 + }
  197 + } else if (org.apache.commons.lang3.StringUtils.equals("descending", orderEntity.getOrder())) {
  198 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "id")) {
  199 + wrapper.orderByDesc(LingangCarInfo::getId);
  200 + }
  201 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "plateNum")) {
  202 + wrapper.orderByDesc(LingangCarInfo::getPlateNum);
  203 + }
  204 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "parkingNo")) {
  205 + wrapper.orderByDesc(LingangCarInfo::getParkingNo);
  206 + }
  207 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "status")) {
  208 + wrapper.orderByDesc(LingangCarInfo::getStatus);
  209 + }
  210 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "createBy")) {
  211 + wrapper.orderByDesc(LingangCarInfo::getCreateBy);
  212 + }
  213 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "createTime")) {
  214 + wrapper.orderByDesc(LingangCarInfo::getCreateTime);
  215 + }
  216 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "updateBy")) {
  217 + wrapper.orderByDesc(LingangCarInfo::getUpdateBy);
  218 + }
  219 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "updateTime")) {
  220 + wrapper.orderByDesc(LingangCarInfo::getUpdateTime);
  221 + }
  222 + if (org.apache.commons.lang3.StringUtils.equals(orderEntity.getProp(), "nbbm")) {
  223 + wrapper.orderByDesc(LingangCarInfo::getNbbm);
  224 + }
  225 + } else {
  226 + wrapper.orderByDesc(LingangCarInfo::getId);
  227 + }
  228 + }
  229 +}
0 230 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/info/KeyInfoServiceImpl.java
... ... @@ -140,6 +140,11 @@ public class KeyInfoServiceImpl extends ServiceImpl&lt;com.ruoyi.mapper.key.info.Ke
140 140 return KeyInfoMapper.insertSelective(entity);
141 141 }
142 142  
  143 + @Override
  144 + public int insertNotExists(KeyInfo entity) {
  145 + return KeyInfoMapper.insertNotExists(entity);
  146 + }
  147 +
143 148 /**
144 149 * 插入数据
145 150 */
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/scheduling/LinggangSchedulingServiceImpl.java
... ... @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8 8 import com.github.pagehelper.PageHelper;
9 9 import com.ruoyi.common.utils.DateUtils;
10 10 import com.ruoyi.domain.OrderEntity;
  11 +import com.ruoyi.domain.lin.gang.LingangScheduling;
11 12 import com.ruoyi.domain.scheduling.LinggangScheduling;
12 13 import com.ruoyi.mapper.scheduling.LinggangSchedulingMapper;
13 14 import com.ruoyi.scheduling.domain.DriverSchedulingV1;
... ... @@ -110,6 +111,11 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl&lt;LinggangSchedulin
110 111 }
111 112  
112 113 @Override
  114 + public Collection<String> listNbbmByEntity(LinggangScheduling entity) {
  115 + return linggangSchedulingMapper.listNbbmByEntity(entity);
  116 + }
  117 +
  118 + @Override
113 119 public List<LinggangScheduling> listNbbm(LinggangScheduling entity, Collection<String> nbbm) {
114 120 LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity);
115 121 switchScheduleDate(wrapper, entity);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/key/info/KeyInfoService.java
... ... @@ -46,6 +46,7 @@ public interface KeyInfoService extends IService&lt;KeyInfo&gt; {
46 46 * 插入有值的列
47 47 */
48 48 int insertSelective(KeyInfo entity);
  49 + int insertNotExists(KeyInfo entity);
49 50  
50 51 /***插入数据*/
51 52 boolean insert(KeyInfo entity);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/scheduling/LinggangSchedulingService.java
... ... @@ -3,6 +3,7 @@ package com.ruoyi.service.scheduling;
3 3 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4 import com.baomidou.mybatisplus.extension.service.IService;
5 5 import com.ruoyi.domain.OrderEntity;
  6 +import com.ruoyi.domain.lin.gang.LingangScheduling;
6 7 import com.ruoyi.domain.scheduling.LinggangScheduling;
7 8  
8 9 import java.util.Collection;
... ... @@ -29,6 +30,8 @@ public interface LinggangSchedulingService extends IService&lt;LinggangScheduling&gt;
29 30  
30 31 List<LinggangScheduling> listByCZ(LinggangScheduling entity);
31 32  
  33 + Collection<String> listNbbmByEntity(LinggangScheduling entity);
  34 +
32 35 List<LinggangScheduling> listNbbm(LinggangScheduling entity,Collection<String> nbbm);
33 36  
34 37 List<LinggangScheduling> listByTime(LinggangScheduling entity);
... ...
Bsth-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
... ... @@ -57,7 +57,7 @@ public class SysDictDataController extends BaseController {
57 57 /**
58 58 * 查询字典数据详细
59 59 */
60   - @PreAuthorize("@ss.hasPermi('system:dict:query')")
  60 +
61 61 @GetMapping(value = "/{dictCode}")
62 62 public AjaxResult getInfo(@PathVariable Long dictCode) {
63 63 return success(dictDataService.selectDictDataById(dictCode));
... ...
Bsth-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
... ... @@ -5,9 +5,12 @@ import com.ruoyi.common.core.domain.AjaxResult;
5 5 import com.ruoyi.common.core.domain.entity.SysMenu;
6 6 import com.ruoyi.common.core.domain.entity.SysUser;
7 7 import com.ruoyi.common.core.domain.model.LoginBody;
  8 +import com.ruoyi.common.core.domain.model.LoginUser;
8 9 import com.ruoyi.common.utils.SecurityUtils;
  10 +import com.ruoyi.common.utils.ServletUtils;
9 11 import com.ruoyi.framework.web.service.SysLoginService;
10 12 import com.ruoyi.framework.web.service.SysPermissionService;
  13 +import com.ruoyi.framework.web.service.TokenService;
11 14 import com.ruoyi.system.service.ISysMenuService;
12 15 import io.swagger.annotations.Api;
13 16 import io.swagger.annotations.ApiOperation;
... ... @@ -36,6 +39,8 @@ public class SysLoginController {
36 39  
37 40 @Autowired
38 41 private SysPermissionService permissionService;
  42 + @Autowired
  43 + private TokenService tokenService;
39 44  
40 45 /**
41 46 * 登录方法
... ... @@ -48,13 +53,30 @@ public class SysLoginController {
48 53 public AjaxResult login(@RequestBody LoginBody loginBody) {
49 54 AjaxResult ajax = AjaxResult.success();
50 55 // 生成令牌
51   - String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
52   - loginBody.getUuid());
  56 + String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid());
53 57 ajax.put(Constants.TOKEN, token);
54 58 return ajax;
55 59 }
56 60  
57 61 /**
  62 + * 获取路由信息
  63 + *
  64 + * @return 路由信息
  65 + */
  66 + @GetMapping("getRouters")
  67 + public AjaxResult getRouters() {
  68 +// Long userId = SecurityUtils.getUserId();
  69 +
  70 + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  71 + // 用户信息
  72 + SysUser user = loginUser.getUser();
  73 +
  74 + Long userId = user.getUserId();
  75 + List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
  76 + return AjaxResult.success(menuService.buildMenus(menus));
  77 + }
  78 +
  79 + /**
58 80 * 登录方法
59 81 *
60 82 * @param loginBody 登录信息
... ... @@ -71,7 +93,6 @@ public class SysLoginController {
71 93 }
72 94  
73 95  
74   -
75 96 /**
76 97 * 获取用户信息
77 98 *
... ... @@ -80,7 +101,9 @@ public class SysLoginController {
80 101 @ApiOperation("获取用户信息")
81 102 @GetMapping("getInfo")
82 103 public AjaxResult getInfo() {
83   - SysUser user = SecurityUtils.getLoginUser().getUser();
  104 + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  105 + SysUser user = loginUser.getUser();
  106 +// SysUser user = SecurityUtils.getLoginUser().getUser();
84 107 // 角色集合
85 108 Set<String> roles = permissionService.getRolePermission(user);
86 109 // 权限集合
... ... @@ -92,16 +115,16 @@ public class SysLoginController {
92 115 return ajax;
93 116 }
94 117  
95   - /**
96   - * 获取路由信息
97   - *
98   - * @return 路由信息
99   - */
100   - @ApiOperation("获取路由信息")
101   - @GetMapping("getRouters")
102   - public AjaxResult getRouters() {
103   - Long userId = SecurityUtils.getUserId();
104   - List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
105   - return AjaxResult.success(menuService.buildMenus(menus));
106   - }
  118 +// /**
  119 +// * 获取路由信息
  120 +// *
  121 +// * @return 路由信息
  122 +// */
  123 +// @ApiOperation("获取路由信息")
  124 +// @GetMapping("getRouters")
  125 +// public AjaxResult getRouters() {
  126 +// Long userId = SecurityUtils.getUserId();
  127 +// List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
  128 +// return AjaxResult.success(menuService.buildMenus(menus));
  129 +// }
107 130 }
... ...
Bsth-admin/src/main/resources/application-druid-lingangPrd.yml 0 → 100644
  1 +# 数据源配置
  2 +spring:
  3 + # 邮箱配置
  4 + mail:
  5 + # 只发送不接收
  6 + host: smtp.163.com
  7 + # 自己的邮箱
  8 + username: m18980249160@163.com
  9 + # 提供的密码 不是自己的登录密码
  10 + password: RZHJXWXPCALIAOCG1
  11 + # 占用端口号
  12 + port: 465
  13 + nickname: 酒精测试异常通知
  14 + form: m18980249160@163.com
  15 + protocol: smtp
  16 + properties:
  17 + mail:
  18 + smtp:
  19 + ssl:
  20 + enable: true
  21 + socketFactory:
  22 + class: javax.net.ssl.SSLSocketFactory
  23 +
  24 + datasource:
  25 + type: com.alibaba.druid.pool.DruidDataSource
  26 + driverClassName: com.mysql.cj.jdbc.Driver
  27 + druid:
  28 + # 主库数据源
  29 + master:
  30 + # 测试地址
  31 + url: jdbc:mysql://10.10.200.172:3666/lingang_all_in_one1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&useAffectedRows=true&allowMultiQueries=true
  32 + username: alcohol_sign
  33 + password: 6ZG5F&V@4rA(X=@#3
  34 + # 从库数据源
  35 + slave:
  36 + # 从数据源开关/默认关闭
  37 + enabled: false
  38 + url:
  39 + username:
  40 + password:
  41 + # 初始连接数
  42 + initialSize: 5
  43 + # 最小连接池数量
  44 + minIdle: 10
  45 + # 最大连接池数量
  46 + maxActive: 20
  47 + # 配置获取连接等待超时的时间
  48 + maxWait: 60000
  49 + # 配置连接超时时间
  50 + connectTimeout: 30000
  51 + # 配置网络超时时间
  52 + socketTimeout: 60000
  53 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  54 + timeBetweenEvictionRunsMillis: 60000
  55 + # 配置一个连接在池中最小生存的时间,单位是毫秒
  56 + minEvictableIdleTimeMillis: 300000
  57 + # 配置一个连接在池中最大生存的时间,单位是毫秒
  58 + maxEvictableIdleTimeMillis: 900000
  59 + # 配置检测连接是否有效
  60 + validationQuery: SELECT 1 FROM DUAL
  61 + testWhileIdle: true
  62 + testOnBorrow: false
  63 + testOnReturn: false
  64 + webStatFilter:
  65 + enabled: true
  66 + statViewServlet:
  67 + enabled: true
  68 + # 设置白名单,不填则允许所有访问
  69 + allow:
  70 + url-pattern: /druid/*
  71 + # 控制台管理用户名和密码
  72 + login-username: qpgj
  73 + login-password: 2023#manager@qpgjuse
  74 + filter:
  75 + stat:
  76 + enabled: true
  77 + # 慢SQL记录
  78 + log-slow-sql: true
  79 + slow-sql-millis: 1000
  80 + merge-sql: true
  81 + wall:
  82 + config:
  83 + multi-statement-allow: true
  84 + # 文件上传
  85 + servlet:
  86 + multipart:
  87 + # 单个文件大小
  88 + max-file-size: 100MB
  89 + # 设置总上传的文件大小
  90 + max-request-size: 100MB
  91 + # 服务模块
  92 + devtools:
  93 + restart:
  94 + # 热部署开关
  95 + enabled: false
  96 + # redis 配置
  97 + redis:
  98 + # 地址
  99 +# host: 121.41.83.61
  100 + host: 10.10.200.172
  101 + database: 4
  102 + password: 728926
  103 + port: 7829
  104 + # 连接超时时间
  105 + timeout: 10s
  106 + lettuce:
  107 + pool:
  108 + # 连接池中的最小空闲连接
  109 + min-idle: 0
  110 + # 连接池中的最大空闲连接
  111 + max-idle: 8
  112 + # 连接池的最大数据库连接数
  113 + max-active: 8
  114 + # #连接池最大阻塞等待时间(使用负值表示没有限制)
  115 + max-wait: -1ms
  116 + # token配置
  117 + token:
  118 + # 令牌自定义标识
  119 + header: Authorization
  120 + # 令牌密钥
  121 + secret: abcdefghijklmnopqrstuvwxys
  122 + # 令牌有效期(默认30分钟)
  123 + expireTime: 30
  124 +
  125 +# 项目相关配置
  126 +ruoyi:
  127 + # 名称
  128 + name: RuoYi
  129 + # 版本
  130 + version: 3.8.5
  131 + # 版权年份
  132 + copyrightYear: 2023
  133 + # 实例演示开关
  134 + demoEnabled: true
  135 + # 文件路径 示例( Windows配置E:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
  136 + profile: /uploadPath
  137 + # 获取ip地址开关
  138 + addressEnabled: false
  139 + # 验证码类型 math 数字计算 char 字符验证
  140 + captchaType: math
  141 +# 开发环境配置
  142 +server:
  143 + # 服务器的HTTP端口,默认为8080
  144 + port: 8102
  145 + servlet:
  146 + # 应用的访问路径
  147 + context-path: /
  148 + tomcat:
  149 + # tomcat的URI编码
  150 + uri-encoding: UTF-8
  151 + # 连接数满后的排队数,默认为100
  152 + accept-count: 1000
  153 + threads:
  154 + # tomcat最大线程数,默认为200
  155 + max: 800
  156 + # Tomcat启动初始化的线程数,默认值10
  157 + min-spare: 100
  158 +
  159 +mybatis-plus:
  160 + # 搜索指定包别名
  161 + typeAliasesPackage: com.ruoyi.**.domain
  162 + # 配置mapper的扫描,找到所有的mapper.xml映射文件
  163 + mapperLocations: classpath*:mapper/**/*Mapper.xml
  164 + # 加载全局的配置文件
  165 + configLocation: classpath:mybatis/mybatis-config.xml
  166 +# Swagger配置
  167 +swagger:
  168 + # 是否开启swagger
  169 + enabled: false
  170 + production: true
  171 + # 请求前缀
  172 + # pathMapping: /dev-api
  173 + pathMapping: /
  174 +springfox:
  175 + documentation:
  176 + auto-startup: false
  177 + enabled: false
  178 +
  179 +api:
  180 + template: 车队与线路匹配模板
  181 + url:
  182 + # all 为获取所有驾驶员信息
  183 + getDriverInfo: http://dsh.bdo2o.com:6280/shr
  184 + # 获取公司编码下的员工信息 暂时没用
  185 + getCompanyInfo:
  186 + # 获取排班信息
  187 + getSchedulingInfo: http://10.10.150.103:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  188 + getSchedulingInfoNew: http://10.10.150.103:9089/webservice/rest/schedule_real/sch_jk4modify/%s/%s/%d?timestamp=%d&nonce=%s&password=%s&sign=%s
  189 + getSchedulingInfoNew1: http://10.10.150.103:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  190 + getSchedulingInfoPlan: http://10.10.150.103:9089/webservice/rest/schedule/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  191 + config:
  192 + password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464
  193 + # 随机字符串
  194 + nonce: adfsad
  195 + apk:
  196 + path: /apk/dev
  197 + # 用户头像存放位置
  198 + headImage: /head/image
  199 + sign:
  200 + image: /image
  201 + video:
  202 + basePath: /video
  203 +
  204 + personnel:
  205 + token:
  206 + tokenUrl: https://api.dingtalk.com/v1.0/oauth2/accessToken
  207 + appKey: dingsclwvxui5zilg1xk
  208 + appSecret: ckV20k3jMKJpUkfXXSGhLk077rQQjsSaAusiSVY-nm4glwweCmb_SMJ62Cpf4YQ5
  209 + people:
  210 + url: https://api.dingtalk.com/v1.0/yida/forms/instances/search
  211 +log:
  212 + path: logs
  213 +netty:
  214 + # 是否开启netty服务
  215 + enabled: false
  216 + socket:
  217 + # 相对路径 classpath
  218 + catalogue:
  219 + image: device/image
  220 + speech: device/speech
  221 + port: 8989
  222 +bsth:
  223 + face:
  224 + app:
  225 + id: 8jPk3SNnaoGsd9SidMefgZXg1zbst64jB44vVyx9Cijq
  226 + sdk:
  227 + key: C21s5J1n1rHwXPkvVjubKshtfYuvuSe2GHus41Q1NPcT
  228 + # key: C21s5J1n1rHwXPkvVjubKshtofV5sHXvyUQqSWYxHp2b
  229 + lib:
  230 + path: /opt/alcoholSign/lib/LINUX64
  231 + # path: D:/work/code/jienengjiancha/bsth-alcohol-sign/Bsth-admin/src/main/resources/libs/WIN64
  232 + faceFeature:
  233 + url: http://222.76.217.238:8880/fcgi-bin/entry.fcgi/system
  234 + process:
  235 + sign:
  236 + url: http://127.0.0.1:9103/commonOpenDataApi/sendAppAndSmsNotice
  237 +
... ...
Bsth-admin/src/main/resources/application-druid-lingangPrdAPI.yml 0 → 100644
  1 +# 数据源配置
  2 +spring:
  3 + # 邮箱配置
  4 + mail:
  5 + # 只发送不接收
  6 + host: smtp.163.com
  7 + # 自己的邮箱
  8 + username: m18980249160@163.com
  9 + # 提供的密码 不是自己的登录密码
  10 + password: RZHJXWXPCALIAOCG1
  11 + # 占用端口号
  12 + port: 465
  13 + nickname: 酒精测试异常通知
  14 + form: m18980249160@163.com
  15 + protocol: smtp
  16 + properties:
  17 + mail:
  18 + smtp:
  19 + ssl:
  20 + enable: true
  21 + socketFactory:
  22 + class: javax.net.ssl.SSLSocketFactory
  23 +
  24 + datasource:
  25 + type: com.alibaba.druid.pool.DruidDataSource
  26 + driverClassName: com.mysql.cj.jdbc.Driver
  27 + druid:
  28 + # 主库数据源
  29 + master:
  30 + # 测试地址
  31 + url: jdbc:mysql://10.10.200.172:3666/lingang_all_in_one1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&useAffectedRows=true&allowMultiQueries=true
  32 + username: alcohol_sign
  33 + password: 6ZG5F&V@4rA(X=@#3
  34 + # 从库数据源
  35 + slave:
  36 + # 从数据源开关/默认关闭
  37 + enabled: false
  38 + url:
  39 + username:
  40 + password:
  41 + # 初始连接数
  42 + initialSize: 5
  43 + # 最小连接池数量
  44 + minIdle: 10
  45 + # 最大连接池数量
  46 + maxActive: 20
  47 + # 配置获取连接等待超时的时间
  48 + maxWait: 60000
  49 + # 配置连接超时时间
  50 + connectTimeout: 30000
  51 + # 配置网络超时时间
  52 + socketTimeout: 60000
  53 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
  54 + timeBetweenEvictionRunsMillis: 60000
  55 + # 配置一个连接在池中最小生存的时间,单位是毫秒
  56 + minEvictableIdleTimeMillis: 300000
  57 + # 配置一个连接在池中最大生存的时间,单位是毫秒
  58 + maxEvictableIdleTimeMillis: 900000
  59 + # 配置检测连接是否有效
  60 + validationQuery: SELECT 1 FROM DUAL
  61 + testWhileIdle: true
  62 + testOnBorrow: false
  63 + testOnReturn: false
  64 + webStatFilter:
  65 + enabled: true
  66 + statViewServlet:
  67 + enabled: true
  68 + # 设置白名单,不填则允许所有访问
  69 + allow:
  70 + url-pattern: /druid/*
  71 + # 控制台管理用户名和密码
  72 + login-username: qpgj
  73 + login-password: 2023#manager@qpgjuse
  74 + filter:
  75 + stat:
  76 + enabled: true
  77 + # 慢SQL记录
  78 + log-slow-sql: true
  79 + slow-sql-millis: 1000
  80 + merge-sql: true
  81 + wall:
  82 + config:
  83 + multi-statement-allow: true
  84 + # 文件上传
  85 + servlet:
  86 + multipart:
  87 + # 单个文件大小
  88 + max-file-size: 100MB
  89 + # 设置总上传的文件大小
  90 + max-request-size: 100MB
  91 + # 服务模块
  92 + devtools:
  93 + restart:
  94 + # 热部署开关
  95 + enabled: false
  96 + # redis 配置
  97 + redis:
  98 + # 地址
  99 +# host: 121.41.83.61
  100 + host: 10.10.200.172
  101 + database: 4
  102 + password: 728926
  103 + port: 7829
  104 + # 连接超时时间
  105 + timeout: 10s
  106 + lettuce:
  107 + pool:
  108 + # 连接池中的最小空闲连接
  109 + min-idle: 0
  110 + # 连接池中的最大空闲连接
  111 + max-idle: 8
  112 + # 连接池的最大数据库连接数
  113 + max-active: 8
  114 + # #连接池最大阻塞等待时间(使用负值表示没有限制)
  115 + max-wait: -1ms
  116 + # token配置
  117 + token:
  118 + # 令牌自定义标识
  119 + header: Authorization
  120 + # 令牌密钥
  121 + secret: abcdefghijklmnopqrstuvwxys
  122 + # 令牌有效期(默认30分钟)
  123 + expireTime: 30
  124 +
  125 +# 项目相关配置
  126 +ruoyi:
  127 + # 名称
  128 + name: RuoYi
  129 + # 版本
  130 + version: 3.8.5
  131 + # 版权年份
  132 + copyrightYear: 2023
  133 + # 实例演示开关
  134 + demoEnabled: true
  135 + # 文件路径 示例( Windows配置E:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
  136 + profile: /mnt/newdisk/alcoholSign/apache-tomcat/webapps/uploadPath
  137 + # 获取ip地址开关
  138 + addressEnabled: false
  139 + # 验证码类型 math 数字计算 char 字符验证
  140 + captchaType: math
  141 +# 开发环境配置
  142 +server:
  143 + # 服务器的HTTP端口,默认为8080
  144 + port: 8106
  145 + servlet:
  146 + # 应用的访问路径
  147 + context-path: /alcoholApi
  148 + tomcat:
  149 + # tomcat的URI编码
  150 + uri-encoding: UTF-8
  151 + # 连接数满后的排队数,默认为100
  152 + accept-count: 1000
  153 + threads:
  154 + # tomcat最大线程数,默认为200
  155 + max: 800
  156 + # Tomcat启动初始化的线程数,默认值10
  157 + min-spare: 100
  158 +
  159 +mybatis-plus:
  160 + # 搜索指定包别名
  161 + typeAliasesPackage: com.ruoyi.**.domain
  162 + # 配置mapper的扫描,找到所有的mapper.xml映射文件
  163 + mapperLocations: classpath*:mapper/**/*Mapper.xml
  164 + # 加载全局的配置文件
  165 + configLocation: classpath:mybatis/mybatis-config.xml
  166 +# Swagger配置
  167 +swagger:
  168 + # 是否开启swagger
  169 + enabled: false
  170 + production: true
  171 + # 请求前缀
  172 + # pathMapping: /dev-api
  173 + pathMapping: /
  174 +springfox:
  175 + documentation:
  176 + auto-startup: false
  177 + enabled: false
  178 +
  179 +api:
  180 + template: 车队与线路匹配模板
  181 + url:
  182 + # all 为获取所有驾驶员信息
  183 + getDriverInfo: http://dsh.bdo2o.com:6280/shr
  184 + # 获取公司编码下的员工信息 暂时没用
  185 + getCompanyInfo:
  186 + # 获取排班信息
  187 + getSchedulingInfo: http://10.10.150.103:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  188 + getSchedulingInfoNew: http://10.10.150.103:9089/webservice/rest/schedule_real/sch_jk4modify/%s/%s/%d?timestamp=%d&nonce=%s&password=%s&sign=%s
  189 + getSchedulingInfoNew1: http://10.10.150.103:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  190 + getSchedulingInfoPlan: http://10.10.150.103:9089/webservice/rest/schedule/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  191 + config:
  192 + password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464
  193 + # 随机字符串
  194 + nonce: adfsad
  195 + apk:
  196 + path: /apk/dev
  197 + # 用户头像存放位置
  198 + headImage: /head/image
  199 + sign:
  200 + image: /image
  201 + video:
  202 + basePath: /video
  203 +
  204 + personnel:
  205 + token:
  206 + tokenUrl: https://api.dingtalk.com/v1.0/oauth2/accessToken
  207 + appKey: dingsclwvxui5zilg1xk
  208 + appSecret: ckV20k3jMKJpUkfXXSGhLk077rQQjsSaAusiSVY-nm4glwweCmb_SMJ62Cpf4YQ5
  209 + people:
  210 + url: https://api.dingtalk.com/v1.0/yida/forms/instances/search
  211 +log:
  212 + path: logs
  213 +netty:
  214 + # 是否开启netty服务
  215 + enabled: false
  216 + socket:
  217 + # 相对路径 classpath
  218 + catalogue:
  219 + image: device/image
  220 + speech: device/speech
  221 + port: 8989
  222 +bsth:
  223 + face:
  224 + app:
  225 + id: 8jPk3SNnaoGsd9SidMefgZXg1zbst64jB44vVyx9Cijq
  226 + sdk:
  227 + key: C21s5J1n1rHwXPkvVjubKshtfYuvuSe2GHus41Q1NPcT
  228 + # key: C21s5J1n1rHwXPkvVjubKshtofV5sHXvyUQqSWYxHp2b
  229 + lib:
  230 + path: /opt/LINUX64
  231 + # path: D:/work/code/jienengjiancha/bsth-alcohol-sign/Bsth-admin/src/main/resources/libs/WIN64
  232 + faceFeature:
  233 + url: http://222.76.217.238:8880/fcgi-bin/entry.fcgi/system
  234 + process:
  235 + sign:
  236 + url: http://127.0.0.1:9103/commonOpenDataApi/sendAppAndSmsNotice
  237 +
... ...
Bsth-admin/src/main/resources/mapper/carinfo/LingangCarInfoMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.ruoyi.mapper.carinfo.LingangCarInfoMapper">
  4 + <resultMap id="BaseResultMap" type="com.ruoyi.domain.caiinfo.LingangCarInfo">
  5 + <id column="id" jdbcType="INTEGER" property="id"/>
  6 + <result column="plate_Num" jdbcType="VARCHAR" property="plateNum"/>
  7 + <result column="parking_No" jdbcType="VARCHAR" property="parkingNo"/>
  8 + <result column="status" jdbcType="INTEGER" property="status"/>
  9 + <result column="create_By" jdbcType="VARCHAR" property="createBy"/>
  10 + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  11 + <result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
  12 + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  13 + <result column="nbbm" jdbcType="VARCHAR" property="nbbm"/>
  14 + </resultMap>
  15 +
  16 + <insert id="insertSelective" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  17 + parameterType="com.ruoyi.domain.caiinfo.LingangCarInfo">
  18 + INSERT INTO car_info <include refid="insertSelectiveColumn"></include>
  19 + <include refid="insertSelectiveValue"></include>
  20 + </insert>
  21 + <insert id="insertNotExit" parameterType="com.ruoyi.domain.caiinfo.LingangCarInfo">
  22 + INSERT INTO car_info(plate_Num,status,nbbm)
  23 + select #{nbbm} plate_Num,#{status} status,#{nbbm} nbbm from(
  24 + select count(nbbm) c from car_info ci where ci.nbbm =#{nbbm}
  25 + )t where t.c=0
  26 + </insert>
  27 +
  28 + <sql id="columns">
  29 + id , plate_Num , parking_No , status , create_By , create_time , update_by , update_time , nbbm
  30 + </sql>
  31 +
  32 + <sql id="insert_columns">
  33 + id , plate_Num , parking_No , status , create_By , create_time , update_by , update_time , nbbm
  34 + </sql>
  35 +
  36 + <sql id="insert_values">
  37 + #{id}, #{plateNum}, #{parkingNo}, #{status}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{nbbm}
  38 + </sql>
  39 +
  40 + <sql id="insertSelectiveColumn">
  41 + <trim prefix="(" suffix=")" suffixOverrides=",">
  42 + <if test="null!=id">id,</if>
  43 + <if test="null!=plateNum">plate_Num,</if>
  44 + <if test="null!=parkingNo">parking_No,</if>
  45 + <if test="null!=status">status,</if>
  46 + <if test="null!=createBy">create_By,</if>
  47 + <if test="null!=createTime">create_time,</if>
  48 + <if test="null!=updateBy">update_by,</if>
  49 + <if test="null!=updateTime">update_time,</if>
  50 + <if test="null!=nbbm">nbbm,</if>
  51 + </trim>
  52 + </sql>
  53 +
  54 + <sql id="insertSelectiveValue">
  55 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  56 + <if test="null!=id">#{id,jdbcType=INTEGER},</if>
  57 + <if test="null!=plateNum">#{plateNum,jdbcType=VARCHAR},</if>
  58 + <if test="null!=parkingNo">#{parkingNo,jdbcType=VARCHAR},</if>
  59 + <if test="null!=status">#{status,jdbcType=INTEGER},</if>
  60 + <if test="null!=createBy">#{createBy,jdbcType=VARCHAR},</if>
  61 + <if test="null!=createTime">#{createTime,jdbcType=TIMESTAMP},</if>
  62 + <if test="null!=updateBy">#{updateBy,jdbcType=VARCHAR},</if>
  63 + <if test="null!=updateTime">#{updateTime,jdbcType=TIMESTAMP},</if>
  64 + <if test="null!=nbbm">#{nbbm,jdbcType=VARCHAR},</if>
  65 + </trim>
  66 + </sql>
  67 +
  68 + <sql id="updateByPrimaryKeySelectiveSql">
  69 + <set>
  70 + <if test="null!=id">id = #{id,jdbcType=INTEGER},</if>
  71 + <if test="null!=plateNum">plate_Num = #{plateNum,jdbcType=VARCHAR},</if>
  72 + <if test="null!=parkingNo">parking_No = #{parkingNo,jdbcType=VARCHAR},</if>
  73 + <if test="null!=status">status = #{status,jdbcType=INTEGER},</if>
  74 + <if test="null!=createBy">create_By = #{createBy,jdbcType=VARCHAR},</if>
  75 + <if test="null!=createTime">create_time = #{createTime,jdbcType=TIMESTAMP},</if>
  76 + <if test="null!=updateBy">update_by = #{updateBy,jdbcType=VARCHAR},</if>
  77 + <if test="null!=updateTime">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
  78 + <if test="null!=nbbm">nbbm = #{nbbm,jdbcType=VARCHAR},</if>
  79 + </set>
  80 + </sql>
  81 +
  82 + <sql id="where">
  83 + <if test="null!=id">AND id = #{id,jdbcType=INTEGER},</if>
  84 + <if test="null!=plateNum">AND plate_Num = #{plateNum,jdbcType=VARCHAR},</if>
  85 + <if test="null!=parkingNo">AND parking_No = #{parkingNo,jdbcType=VARCHAR},</if>
  86 + <if test="null!=status">AND status = #{status,jdbcType=INTEGER},</if>
  87 + <if test="null!=createBy">AND create_By = #{createBy,jdbcType=VARCHAR},</if>
  88 + <if test="null!=createTime">AND create_time = #{createTime,jdbcType=TIMESTAMP},</if>
  89 + <if test="null!=updateBy">AND update_by = #{updateBy,jdbcType=VARCHAR},</if>
  90 + <if test="null!=updateTime">AND update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
  91 + <if test="null!=nbbm">AND nbbm = #{nbbm,jdbcType=VARCHAR},</if>
  92 + </sql>
  93 +</mapper>
0 94 \ No newline at end of file
... ...
Bsth-admin/src/main/resources/mapper/key/info/KeyInfoMapper.xml
... ... @@ -17,6 +17,13 @@
17 17 <insert id="insertSelective" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.ruoyi.domain.key.info.KeyInfo">
18 18 INSERT INTO key_info <include refid= "insertSelectiveColumn"></include> <include refid= "insertSelectiveValue"></include>
19 19 </insert>
  20 + <insert id="insertNotExists" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.ruoyi.domain.key.info.KeyInfo">
  21 + insert into key_info(name,del_flag,plate_Num,key_code)
  22 + select CONCAT('自编号为',#{nmmb},'的车辆钥匙') plate_Num,0 del_flag,#{plateNum} plate_Num,#{keyCode} key_code from(
  23 + select count(plate_Num) c from key_info ki where ki.plate_Num =#{plateNum}
  24 + )t where t.c=0
  25 +
  26 + </insert>
20 27  
21 28 <sql id="columns">
22 29 id , name , status , del_flag , create_By , create_Time , updateBy , update_Time , plate_Num , key_code
... ...
Bsth-admin/src/main/resources/mapper/scheduling/LinggangSchedulingMapper.xml
... ... @@ -49,6 +49,12 @@
49 49  
50 50 </where>
51 51 </select>
  52 + <select id="listNbbmByEntity" resultType="java.lang.String">
  53 + select nbbm
  54 + from scheduling
  55 + WHERE scheduling_type = #{type} and (qdzcode = #{czCode} OR zdzcode = #{czCode}) and schedule_date BETWEEN #{startScheduleDate} and #{endScheduleDate}
  56 + group by nbbm
  57 + </select>
52 58  
53 59 <sql id="columns">
54 60 id , schedule_date , line_name , job_code , name , posts , lp_name , nbbm , bc_type , fcsj_t , zdsj_t , sign_in_id , ex_type , sign_time , sign_type , alcohol_flag , alcohol_intake , remark , key_info_id , upDown , qdzCode , qdzName , zdzCode , zdzName
... ... @@ -62,6 +68,7 @@
62 68 #{id}, #{scheduleDate}, #{lineName}, #{jobCode}, #{name}, #{posts}, #{lpName}, #{nbbm}, #{bcType}, #{fcsjT}, #{zdsjT}, #{signInId}, #{exType}, #{signTime}, #{signType}, #{alcoholFlag}, #{alcoholIntake}, #{remark}, #{keyInfoId}, #{updown}, #{qdzcode}, #{qdzname}, #{zdzcode}, #{zdzname}
63 69 </sql>
64 70  
  71 +
65 72 <sql id="insertSelectiveColumn">
66 73 <trim prefix="(" suffix=")" suffixOverrides=",">
67 74 <if test="null!=id">id,</if>
... ...
Bsth-framework/pom.xml
... ... @@ -16,6 +16,25 @@
16 16 </description>
17 17  
18 18 <dependencies>
  19 + <dependency>
  20 + <groupId>commons-httpclient</groupId>
  21 + <artifactId>commons-httpclient</artifactId>
  22 + <version>3.1</version>
  23 + </dependency>
  24 +
  25 +
  26 +
  27 + <dependency>
  28 + <groupId>org.apache.httpcomponents</groupId>
  29 + <artifactId>httpclient</artifactId>
  30 + <version>4.5</version>
  31 + </dependency>
  32 +
  33 + <dependency>
  34 + <groupId>org.apache.httpcomponents</groupId>
  35 + <artifactId>httpcore</artifactId>
  36 + <version>4.4.1</version>
  37 + </dependency>
19 38  
20 39 <!-- SpringBoot Web容器 -->
21 40 <dependency>
... ...
Bsth-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java
1 1 package com.ruoyi.framework.security.filter;
2 2  
3 3 import cn.hutool.core.convert.Convert;
  4 +import com.alibaba.fastjson2.JSON;
  5 +import com.alibaba.fastjson2.JSONArray;
  6 +import com.alibaba.fastjson2.JSONObject;
  7 +import com.ruoyi.common.constant.Constants;
  8 +import com.ruoyi.common.core.domain.entity.SysRole;
  9 +import com.ruoyi.common.core.domain.entity.SysUser;
4 10 import com.ruoyi.common.core.domain.model.LoginUser;
  11 +import com.ruoyi.common.utils.MessageUtils;
5 12 import com.ruoyi.common.utils.SecurityUtils;
6 13 import com.ruoyi.common.utils.StringUtils;
  14 +import com.ruoyi.framework.manager.AsyncManager;
  15 +import com.ruoyi.framework.manager.factory.AsyncFactory;
  16 +import com.ruoyi.framework.security.util.HttpClientUtil;
  17 +import com.ruoyi.framework.security.util.UsLogin;
  18 +import com.ruoyi.framework.web.service.SysPermissionService;
7 19 import com.ruoyi.framework.web.service.TokenService;
  20 +import com.ruoyi.system.domain.SysUserRole;
  21 +import com.ruoyi.system.mapper.SysRoleMapper;
  22 +import com.ruoyi.system.mapper.SysUserRoleMapper;
  23 +import com.ruoyi.system.service.ISysRoleService;
  24 +import com.ruoyi.system.service.ISysUserService;
8 25 import org.slf4j.Logger;
9 26 import org.slf4j.LoggerFactory;
10 27 import org.slf4j.MDC;
... ... @@ -22,8 +39,7 @@ import javax.servlet.ServletException;
22 39 import javax.servlet.http.HttpServletRequest;
23 40 import javax.servlet.http.HttpServletResponse;
24 41 import java.io.IOException;
25   -import java.util.Objects;
26   -import java.util.UUID;
  42 +import java.util.*;
27 43  
28 44 /**
29 45 * token过滤器 验证token有效性
... ... @@ -34,6 +50,16 @@ import java.util.UUID;
34 50 public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
35 51 @Autowired
36 52 private TokenService tokenService;
  53 + @Autowired
  54 + private SysPermissionService permissionService;
  55 + @Autowired
  56 + private ISysUserService sysUserService;
  57 + @Autowired
  58 + private ISysRoleService roleService;
  59 + @Autowired
  60 + private SysRoleMapper roleMapper;
  61 + @Autowired
  62 + private SysUserRoleMapper userRoleMapper;
37 63  
38 64 private final static String USER_ID_KEY = "userId";
39 65 private final static String REQUEST_ID_KEY = "requestId";
... ... @@ -44,8 +70,104 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
44 70 protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
45 71 throws ServletException, IOException {
46 72 LoginUser loginUser = tokenService.getLoginUser(request);
47   - String userId = Objects.isNull(loginUser) ? getRandomValue() : Convert.toStr(loginUser.getUserId());
48   - putMDC(userId, getRandomValue());
  73 + String userId1 = Objects.isNull(loginUser) ? getRandomValue() : Convert.toStr(loginUser.getUserId());
  74 + putMDC(userId1, getRandomValue());
  75 +
  76 +// if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
  77 +// tokenService.verifyToken(loginUser);
  78 +// UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
  79 +// authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
  80 +// SecurityContextHolder.getContext().setAuthentication(authenticationToken);
  81 +// }
  82 +
  83 + Map<String, String[]> requestMap = request.getParameterMap();
  84 + logger.info("loginUser:"+Objects.isNull(loginUser)+";requestMap.containsKey(\"token\"):"+requestMap.containsKey("token"));
  85 + if (loginUser == null && requestMap.containsKey("token")) {
  86 + String token = requestMap.get("token")[0];
  87 + if(org.apache.commons.lang3.StringUtils.isEmpty(token) || org.apache.commons.lang3.StringUtils.equalsAnyIgnoreCase(token,"undefined")){
  88 + token = request.getHeader("Authorization");
  89 + if(token.startsWith("Bearer ")){
  90 + token= org.apache.commons.lang3.StringUtils.substringAfter(token,"Bearer ");
  91 + }
  92 + }
  93 + String sysCode = "SYSUS019";
  94 + String url = "http://10.10.200.142:9112/prod-api/system/utilitySystem/checkToken";
  95 + // String url = "http://58.247.254.118:9102/prod-api/system/utilitySystem/checkToken";
  96 + UsLogin usLogin = new UsLogin();
  97 + usLogin.setToken(token);
  98 + usLogin.setSysCode(sysCode);
  99 + String dataJsonStr = HttpClientUtil.httpRequest(url, "POST", usLogin);
  100 +
  101 + logger.info("[" + url + "] return values:[" + dataJsonStr + "]");
  102 + if(org.apache.commons.lang3.StringUtils.isNotEmpty(dataJsonStr)) {
  103 + JSONObject jsonObject = JSON.parseObject(dataJsonStr);
  104 + String code = jsonObject.getString("code");
  105 + JSONObject dataJson = jsonObject.getJSONObject("data");
  106 + String resCode = dataJson.getString("code");
  107 + /**
  108 + * 登陆校验失败
  109 + */
  110 + if ("9999".equals(resCode) || "9998".equals(resCode)) {
  111 + System.out.println(jsonObject.getString("msgUser"));
  112 + return;
  113 + }
  114 +
  115 + /**
  116 + * 回调数据
  117 + */
  118 + JSONObject resDataJson = dataJson.getJSONObject("data");
  119 + /**
  120 + * 用户名
  121 + */
  122 + String username = resDataJson.getString("userName");
  123 +
  124 + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
  125 + SysUser sysUser = sysUserService.selectUserByUserName(username);
  126 +
  127 +
  128 + /**
  129 + * 角色列表更新 开始
  130 + * 根据自己需求使用
  131 + * 1.校验角色
  132 + * 2.新增/更新角色
  133 + * 3.更新用户角色表
  134 + */
  135 + JSONArray data = resDataJson.getJSONArray("roleList");
  136 + List<SysRole> sysRoleList = data.toJavaList(SysRole.class);
  137 +
  138 + List<SysUserRole> sysUserRoleList = new ArrayList<>();
  139 + Long userId = sysUser.getUserId();
  140 + for (SysRole sysRole : sysRoleList) {
  141 + SysRole sysRoleSearch = new SysRole();
  142 + sysRoleSearch.setRoleKey(sysRole.getRoleKey());
  143 + SysRole roleRes = roleService.selectRoleByRoleKey(sysRoleSearch);
  144 + if (roleRes == null) {
  145 + sysRole.setMenuIds(new Long[0]);
  146 + roleService.insertRole(sysRole);
  147 + SysUserRole batchData = new SysUserRole();
  148 + batchData.setUserId(userId);
  149 + batchData.setRoleId(sysRole.getRoleId());
  150 + sysUserRoleList.add(batchData);
  151 + } else {
  152 + sysRole.setRoleId(roleRes.getRoleId());
  153 + roleMapper.updateRole(sysRole);
  154 + }
  155 + }
  156 + userRoleMapper.batchUserRole(sysUserRoleList);
  157 + /**
  158 + * 角色列表更新 结束
  159 + */
  160 +
  161 +
  162 + loginUser = new LoginUser();
  163 + loginUser.setToken(token);
  164 + loginUser.setPermissions(permissionService.getMenuPermission(sysUser));
  165 + loginUser.setUser(sysUser);
  166 +
  167 + tokenService.createUsToken(loginUser);
  168 + }
  169 + }
  170 +
49 171  
50 172 if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
51 173 tokenService.verifyToken(loginUser);
... ... @@ -58,21 +180,21 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
58 180  
59 181 public static String validateDevice(String device) {
60 182 LoginUser loginUser = SecurityUtils.getLoginUser();
61   - if(Objects.isNull(loginUser)){
62   - return "没有登陆信息";
  183 + if (Objects.isNull(loginUser)) {
  184 + return "没有登陆信息";
63 185 }
64 186  
65   - if(org.apache.commons.lang3.StringUtils.equals(device,Convert.toStr(loginUser.getDeviceId()))){
  187 + if (org.apache.commons.lang3.StringUtils.equals(device, Convert.toStr(loginUser.getDeviceId()))) {
66 188 return null;
67 189 }
68 190  
69 191 String authorization = null;
70 192 HttpServletRequest request = getRequest();
71   - if(Objects.nonNull(request)){
  193 + if (Objects.nonNull(request)) {
72 194 authorization = request.getHeader("Authorization");
73 195 }
74 196  
75   - LOGGER.warn("device:[{}],authorization:[{}],loginUser:[{}]",device,authorization,loginUser);
  197 + LOGGER.warn("device:[{}],authorization:[{}],loginUser:[{}]", device, authorization, loginUser);
76 198  
77 199 return "登陆的设备和token不匹配";
78 200 }
... ...
Bsth-framework/src/main/java/com/ruoyi/framework/security/util/HttpClientUtil.java 0 → 100644
  1 +package com.ruoyi.framework.security.util;
  2 +
  3 +
  4 +import com.alibaba.fastjson2.JSON;
  5 +import org.apache.commons.httpclient.HttpClient;
  6 +import org.apache.commons.httpclient.HttpStatus;
  7 +import org.apache.commons.httpclient.SimpleHttpConnectionManager;
  8 +import org.apache.commons.httpclient.methods.PostMethod;
  9 +import org.apache.commons.httpclient.methods.StringRequestEntity;
  10 +import org.apache.commons.lang3.StringUtils;
  11 +import org.apache.http.HttpEntity;
  12 +import org.apache.http.HttpResponse;
  13 +import org.apache.http.NameValuePair;
  14 +import org.apache.http.client.ClientProtocolException;
  15 +import org.apache.http.client.entity.UrlEncodedFormEntity;
  16 +import org.apache.http.client.methods.CloseableHttpResponse;
  17 +import org.apache.http.client.methods.HttpGet;
  18 +import org.apache.http.client.methods.HttpPost;
  19 +import org.apache.http.entity.StringEntity;
  20 +import org.apache.http.impl.client.CloseableHttpClient;
  21 +import org.apache.http.impl.client.HttpClientBuilder;
  22 +import org.apache.http.impl.client.HttpClients;
  23 +import org.apache.http.message.BasicNameValuePair;
  24 +import org.apache.http.protocol.HTTP;
  25 +import org.apache.http.util.EntityUtils;
  26 +
  27 +import java.io.*;
  28 +import java.lang.reflect.Field;
  29 +import java.net.ConnectException;
  30 +import java.net.HttpURLConnection;
  31 +import java.net.ProtocolException;
  32 +import java.net.URL;
  33 +import java.util.*;
  34 +
  35 +public class HttpClientUtil {
  36 +
  37 + public static String post(String url, Map<String, String> params) {
  38 + CloseableHttpClient httpclient = HttpClients.createDefault();
  39 + HttpPost post = postForm(url, params);
  40 + String body = null;
  41 + try {
  42 + CloseableHttpResponse response2 = httpclient.execute(post);
  43 + try {
  44 + HttpEntity entity2 = response2.getEntity();
  45 + body = EntityUtils.toString(entity2, "UTF-8");
  46 + EntityUtils.consume(entity2);
  47 + } finally {
  48 + response2.close();
  49 + }
  50 + } catch (ClientProtocolException e) {
  51 + // TODO Auto-generated catch block
  52 + e.printStackTrace();
  53 + } catch (IOException e) {
  54 + // TODO Auto-generated catch block
  55 + e.printStackTrace();
  56 + } finally {
  57 + try {
  58 + httpclient.close();
  59 + } catch (IOException e) {
  60 + e.printStackTrace();
  61 + }
  62 + }
  63 +
  64 +
  65 + return body;
  66 + }
  67 +
  68 + public static String get(String url) {
  69 + CloseableHttpClient httpclient = HttpClients.createDefault();
  70 + HttpGet httpGet = new HttpGet(url);
  71 + String body = null;
  72 + try {
  73 + CloseableHttpResponse response1 = httpclient.execute(httpGet);
  74 + try {
  75 + HttpEntity entity1 = response1.getEntity();
  76 + String charset = EntityUtils.getContentCharSet(entity1);
  77 + body = EntityUtils.toString(entity1);
  78 + EntityUtils.consume(entity1);
  79 + } finally {
  80 + response1.close();
  81 + }
  82 + } catch (ClientProtocolException e) {
  83 + // TODO Auto-generated catch block
  84 + e.printStackTrace();
  85 + } catch (IOException e) {
  86 + // TODO Auto-generated catch block
  87 + e.printStackTrace();
  88 + } finally {
  89 + try {
  90 + httpclient.close();
  91 + } catch (IOException e) {
  92 + e.printStackTrace();
  93 + }
  94 + }
  95 +
  96 + return body;
  97 + }
  98 +
  99 +
  100 + /**
  101 + * @param url
  102 + * @param params
  103 + * @return
  104 + */
  105 + private static HttpPost postForm(String url, Map<String, String> params) {
  106 +
  107 + HttpPost httpost = new HttpPost(url);
  108 + List<NameValuePair> nvps = new ArrayList<NameValuePair>();
  109 +
  110 + Set<String> keySet = params.keySet();
  111 + for (String key : keySet) {
  112 + nvps.add(new BasicNameValuePair(key, params.get(key)));
  113 + }
  114 +
  115 + try {
  116 + httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
  117 + } catch (UnsupportedEncodingException e) {
  118 + e.printStackTrace();
  119 + }
  120 +
  121 + return httpost;
  122 + }
  123 +
  124 + public static String post(String url, String inMessageXml) {
  125 +
  126 + System.out.println("url..." + url);
  127 + System.out.println("inMessageXml..." + inMessageXml);
  128 + //创建httpclient工具对象
  129 + HttpClient client = new HttpClient();
  130 + //创建post请求方法
  131 + PostMethod myPost = new PostMethod(url);
  132 + //设置请求超时时间
  133 + client.setConnectionTimeout(3000 * 1000);
  134 + String responseString = null;
  135 + try {
  136 + //设置请求头部类型
  137 + myPost.setRequestHeader("Content-Type", "text/xml");
  138 + myPost.setRequestHeader("charset", "utf-8");
  139 + //设置请求体,即xml文本内容,一种是直接获取xml内容字符串,一种是读取xml文件以流的形式
  140 + myPost.setRequestEntity(new StringRequestEntity(inMessageXml, "text/xml", "utf-8"));
  141 + int statusCode = client.executeMethod(myPost);
  142 + //只有请求成功200了,才做处理
  143 + if (statusCode == HttpStatus.SC_OK) {
  144 + InputStream inputStream = myPost.getResponseBodyAsStream();
  145 + BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "utf-8"));
  146 + StringBuffer stringBuffer = new StringBuffer();
  147 + String str = "";
  148 + while ((str = br.readLine()) != null) {
  149 + stringBuffer.append(str);
  150 + }
  151 + responseString = stringBuffer.toString();
  152 + }
  153 + } catch (Exception e) {
  154 + e.printStackTrace();
  155 + } finally {
  156 + myPost.releaseConnection();
  157 + ((SimpleHttpConnectionManager) client.getHttpConnectionManager()).shutdown();
  158 + }
  159 + return responseString;
  160 + }
  161 +
  162 +
  163 + public static String doPost(String url, Object data) {
  164 +
  165 + String jsonData = JSON.toJSONString(data);
  166 + //String jsonData = JSONUtils.toJson(data);
  167 + System.out.println("url..." + url);
  168 + System.out.println("inMessageXml..." + data);
  169 +
  170 + CloseableHttpClient httpclient = HttpClientBuilder.create().build();
  171 + HttpPost post = new HttpPost(url);
  172 + try {
  173 + StringEntity s = new StringEntity(jsonData, "utf-8");
  174 + s.setContentEncoding("UTF-8");
  175 + s.setContentType("application/json");//发送json数据需要设置contentType
  176 + post.setEntity(s);
  177 + HttpResponse res = httpclient.execute(post);
  178 + if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
  179 + return EntityUtils.toString(res.getEntity());
  180 + }
  181 + } catch (Exception e) {
  182 + throw new RuntimeException(e);
  183 + } finally {
  184 + try {
  185 + httpclient.close();
  186 + } catch (IOException e) {
  187 + e.printStackTrace();
  188 + }
  189 + }
  190 + return null;
  191 + }
  192 +
  193 +
  194 + /**
  195 + * HttpURLConnection方式 模拟Http Get请求
  196 + *
  197 + * @param urlStr 请求路径
  198 + * @param paramMap 请求参数
  199 + * @return
  200 + * @throws Exception
  201 + */
  202 + public static String get(String urlStr, Map<String, String> paramMap) throws Exception {
  203 + urlStr = urlStr + "?" + getParamString(paramMap);
  204 + HttpURLConnection conn = null;
  205 + try {
  206 + //创建URL对象
  207 + URL url = new URL(urlStr);
  208 + //获取URL连接
  209 + conn = (HttpURLConnection) url.openConnection();
  210 + //设置通用的请求属性
  211 + setHttpUrlConnection(conn, "GET");
  212 + //建立实际的连接
  213 + conn.connect();
  214 + //获取响应的内容
  215 + return readResponseContent(conn.getInputStream());
  216 + } finally {
  217 + if (null != conn)
  218 + conn.disconnect();
  219 + }
  220 + }
  221 +
  222 +
  223 + /**
  224 + * HttpURLConnection方式 模拟Http Post请求
  225 + *
  226 + * @param urlStr 请求路径
  227 + * @return
  228 + * @throws Exception
  229 + */
  230 + public static String postMap(String urlStr, Object object) throws Exception {
  231 + HttpURLConnection conn = null;
  232 + PrintWriter writer = null;
  233 +
  234 + try {
  235 + //创建URL对象
  236 + URL url = new URL(urlStr);
  237 + //获取请求参数
  238 + Map<String, String> params = objectToMap(object);
  239 + String param = getParamString(params);
  240 + //获取URL连接
  241 + System.out.println("requestUrl:" + urlStr);
  242 + System.out.println("outputStr:" + param);
  243 + conn = (HttpURLConnection) url.openConnection();
  244 + //设置通用请求属性
  245 + setHttpUrlConnection(conn, "POST");
  246 + //建立实际的连接
  247 + conn.connect();
  248 + //将请求参数写入请求字符流中
  249 + writer = new PrintWriter(conn.getOutputStream());
  250 + writer.print(param);
  251 + writer.flush();
  252 + //读取响应的内容
  253 + return readResponseContent(conn.getInputStream());
  254 + } finally {
  255 + if (null != conn)
  256 + conn.disconnect();
  257 + if (null != writer)
  258 + writer.close();
  259 + }
  260 + }
  261 +
  262 + /**
  263 + * HttpURLConnection方式 模拟Http Post请求
  264 + *
  265 + * @param urlStr 请求路径
  266 + * @return
  267 + * @throws Exception
  268 + */
  269 + public static String postByMap(String urlStr, Map<String, String> params) throws Exception {
  270 + HttpURLConnection conn = null;
  271 + PrintWriter writer = null;
  272 +
  273 + try {
  274 + //创建URL对象
  275 + URL url = new URL(urlStr);
  276 + //获取请求参数
  277 + String param = getParamString(params);
  278 + //获取URL连接
  279 + System.out.println("requestUrl:" + urlStr);
  280 + System.out.println("outputStr:" + param);
  281 + conn = (HttpURLConnection) url.openConnection();
  282 + //设置通用请求属性
  283 + setHttpUrlConnection(conn, "POST");
  284 + //建立实际的连接
  285 + conn.connect();
  286 + //将请求参数写入请求字符流中
  287 + writer = new PrintWriter(conn.getOutputStream());
  288 + writer.print(param);
  289 + writer.flush();
  290 + //读取响应的内容
  291 + return readResponseContent(conn.getInputStream());
  292 + } finally {
  293 + if (null != conn)
  294 + conn.disconnect();
  295 + if (null != writer)
  296 + writer.close();
  297 + }
  298 + }
  299 +
  300 +
  301 + /**
  302 + * 转换对象为map
  303 + *
  304 + * @param object
  305 + * @param ignore
  306 + * @return
  307 + */
  308 + public static Map<String, String> objectToMap(Object object, String... ignore) {
  309 + Map<String, String> tempMap = new LinkedHashMap<String, String>();
  310 + //获取本类的Fields
  311 + for (Field f : object.getClass().getDeclaredFields()) {
  312 + if (!f.isAccessible()) {
  313 + f.setAccessible(true);
  314 + }
  315 + boolean ig = false;
  316 + if (ignore != null && ignore.length > 0) {
  317 + for (String i : ignore) {
  318 + if (i.equals(f.getName())) {
  319 + ig = true;
  320 + break;
  321 + }
  322 + }
  323 + }
  324 + if (ig) {
  325 + continue;
  326 + } else {
  327 + Object o = null;
  328 + try {
  329 + o = f.get(object);
  330 + } catch (IllegalArgumentException e) {
  331 + e.printStackTrace();
  332 + } catch (IllegalAccessException e) {
  333 + e.printStackTrace();
  334 + }
  335 + tempMap.put(f.getName(), o == null ? "" : o.toString());
  336 + }
  337 + }
  338 + //获取基类的Fields
  339 + for (Field f : object.getClass().getFields()) {
  340 + if (!f.isAccessible()) {
  341 + f.setAccessible(true);
  342 + }
  343 + boolean ig = false;
  344 + if (ignore != null && ignore.length > 0) {
  345 + for (String i : ignore) {
  346 + if (i.equals(f.getName())) {
  347 + ig = true;
  348 + break;
  349 + }
  350 + }
  351 + }
  352 + if (ig) {
  353 + continue;
  354 + } else {
  355 + Object o = null;
  356 + try {
  357 + o = f.get(object);
  358 + } catch (IllegalArgumentException e) {
  359 + e.printStackTrace();
  360 + } catch (IllegalAccessException e) {
  361 + e.printStackTrace();
  362 + }
  363 + tempMap.put(f.getName(), o == null ? "" : o.toString());
  364 + }
  365 + }
  366 + return tempMap;
  367 + }
  368 +
  369 + /**
  370 + * 将参数转为路径字符串
  371 + *
  372 + * @param paramMap 参数
  373 + * @return
  374 + */
  375 + private static String getParamString(Map<String, String> paramMap) {
  376 + if (null == paramMap || paramMap.isEmpty()) {
  377 + return "";
  378 + }
  379 + StringBuilder builder = new StringBuilder();
  380 + for (String key : paramMap.keySet()) {
  381 + if (!key.equals("pd")) {
  382 + if (StringUtils.isNotEmpty(paramMap.get(key))) {
  383 + //传入值不为空 拼接字符串
  384 + builder.append("&").append(key).append("=").append(paramMap.get(key));
  385 + } else {
  386 + builder.append("&");
  387 + }
  388 + }
  389 +
  390 + }
  391 + return new String(builder.deleteCharAt(0).toString());
  392 + }
  393 +
  394 +
  395 + /**
  396 + * 读取响应字节流并将之转为字符串
  397 + *
  398 + * @param in 要读取的字节流
  399 + * @return
  400 + * @throws IOException
  401 + */
  402 + private static String readResponseContent(InputStream in) throws IOException {
  403 + Reader reader = null;
  404 + StringBuilder content = new StringBuilder();
  405 + try {
  406 + reader = new InputStreamReader(in, "utf-8");
  407 + char[] buffer = new char[1024];
  408 + int head = 0;
  409 + while ((head = reader.read(buffer)) > 0) {
  410 + content.append(new String(buffer, 0, head));
  411 + }
  412 + String result = content.toString();
  413 + System.out.println("readResponseContent.." + result);
  414 + return result;
  415 + } finally {
  416 + if (null != in) {
  417 + in.close();
  418 + }
  419 + if (null != reader) {
  420 + reader.close();
  421 + }
  422 + }
  423 + }
  424 +
  425 + /**
  426 + * 设置Http连接属性
  427 + *
  428 + * @param conn http连接
  429 + * @return
  430 + * @throws ProtocolException
  431 + * @throws Exception
  432 + */
  433 + private static void setHttpUrlConnection(HttpURLConnection conn,
  434 + String requestMethod) throws ProtocolException {
  435 + conn.setRequestMethod(requestMethod);
  436 + conn.setRequestProperty("content-encoding", "UTF-8");
  437 + conn.setRequestProperty("accept", "application/json");
  438 + conn.setRequestProperty("Accept-Charset", "UTF-8");
  439 + conn.setRequestProperty("Accept-Language", "zh-CN");
  440 +
  441 + conn.setRequestProperty("User-Agent",
  442 + "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");
  443 + conn.setRequestProperty("Proxy-Connection", "Keep-Alive");
  444 +
  445 + if (null != requestMethod && "POST".equals(requestMethod)) {
  446 + conn.setDoOutput(true);
  447 + conn.setDoInput(true);
  448 + }
  449 + }
  450 +
  451 +
  452 + /**
  453 + * 新http请求
  454 + *
  455 + * @param requestUrl
  456 + * @param requestMethod
  457 + * @param object
  458 + * @return
  459 + */
  460 + public static String httpRequest(String requestUrl, String requestMethod, Object object) {
  461 + //获取请求参数
  462 + Map<String, String> params = objectToMap(object);
  463 + String outputStr = getParamString(params);
  464 + System.out.println("requestUrl:" + requestUrl);
  465 + System.out.println("outputStr:" + outputStr);
  466 + StringBuffer buffer = new StringBuffer();
  467 + try {
  468 + URL url = new URL(requestUrl);
  469 + HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection();
  470 + httpUrlConn.setDoOutput(true);
  471 + httpUrlConn.setDoInput(true);
  472 + httpUrlConn.setUseCaches(false);
  473 + httpUrlConn.setConnectTimeout(15000);
  474 + httpUrlConn.setReadTimeout(15000);
  475 + // 设置请求方式(GET/POST)
  476 + httpUrlConn.setRequestMethod(requestMethod);
  477 + httpUrlConn.connect();
  478 + // 当有数据需要提交时
  479 + if (null != outputStr) {
  480 + OutputStream outputStream = httpUrlConn.getOutputStream();
  481 + // 注意编码格式,防止中文乱码
  482 + outputStream.write(outputStr.getBytes("UTF-8"));
  483 + outputStream.close();
  484 + }
  485 + // 将返回的输入流转换成字符串
  486 + InputStream inputStream = httpUrlConn.getInputStream();
  487 + InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
  488 + BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
  489 +
  490 + String str = null;
  491 + while ((str = bufferedReader.readLine()) != null) {
  492 + buffer.append(str);
  493 + }
  494 + bufferedReader.close();
  495 + inputStreamReader.close();
  496 + // 释放资源
  497 + inputStream.close();
  498 + inputStream = null;
  499 + httpUrlConn.disconnect();
  500 + } catch (ConnectException ce) {
  501 + } catch (Exception e) {
  502 + e.printStackTrace();
  503 + }
  504 + System.out.println("返回:" + buffer.toString());
  505 + return buffer.toString();
  506 + }
  507 +
  508 +
  509 +}
... ...
Bsth-framework/src/main/java/com/ruoyi/framework/security/util/UsLogin.java 0 → 100644
  1 +package com.ruoyi.framework.security.util;
  2 +
  3 +
  4 +import com.ruoyi.common.core.domain.BaseEntity;
  5 +import org.apache.commons.lang3.builder.ToStringBuilder;
  6 +import org.apache.commons.lang3.builder.ToStringStyle;
  7 +
  8 +/**
  9 + * 岗位表 sys_post
  10 + *
  11 + * @author bsth
  12 + */
  13 +public class UsLogin extends BaseEntity {
  14 + private static final long serialVersionUID = 1L;
  15 +
  16 + private String token;
  17 +
  18 + private String sysCode;
  19 +
  20 + public String getToken() {
  21 + return token;
  22 + }
  23 +
  24 + public void setToken(String token) {
  25 + this.token = token;
  26 + }
  27 +
  28 + public String getSysCode() {
  29 + return sysCode;
  30 + }
  31 +
  32 + public void setSysCode(String sysCode) {
  33 + this.sysCode = sysCode;
  34 + }
  35 +
  36 + @Override
  37 + public String toString() {
  38 + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
  39 + .append("token", getToken())
  40 + .append("sysCode", getSysCode())
  41 + .append("createBy", getCreateBy())
  42 + .append("createTime", getCreateTime())
  43 + .append("updateBy", getUpdateBy())
  44 + .append("updateTime", getUpdateTime())
  45 + .append("remark", getRemark())
  46 + .toString();
  47 + }
  48 +}
... ...
Bsth-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
... ... @@ -58,6 +58,22 @@ public class TokenService {
58 58 @Autowired
59 59 private RedisCache redisCache;
60 60  
  61 + public String createUsToken(LoginUser loginUser)
  62 + {
  63 + String tokenLong = loginUser.getToken();
  64 + Claims claimsGet = parseToken(tokenLong);
  65 + // 解析对应的权限以及用户信息
  66 + String token = (String) claimsGet.get(Constants.LOGIN_USER_KEY);
  67 + loginUser.setToken(token);
  68 + setUserAgent(loginUser);
  69 + refreshToken(loginUser);
  70 +
  71 + Map<String, Object> claims = new HashMap<>();
  72 + claims.put(Constants.LOGIN_USER_KEY, token);
  73 + return createToken(claims);
  74 + }
  75 +
  76 +
61 77 /**
62 78 * 获取用户身份信息
63 79 *
... ... @@ -183,6 +199,7 @@ public class TokenService {
183 199 // 根据uuid将loginUser缓存
184 200 String userKey = getTokenKey(loginUser.getToken());
185 201 redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
  202 + //setLoginUser(loginUser);
186 203 }
187 204  
188 205 /**
... ...
Bsth-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java
... ... @@ -49,6 +49,8 @@ public interface SysRoleMapper
49 49 */
50 50 public SysRole selectRoleById(Long roleId);
51 51  
  52 + SysRole selectRoleByRoleKey(SysRole sysRole);
  53 +
52 54 /**
53 55 * 根据用户ID查询角色
54 56 *
... ...
Bsth-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java
... ... @@ -59,6 +59,8 @@ public interface ISysRoleService
59 59 */
60 60 public SysRole selectRoleById(Long roleId);
61 61  
  62 + SysRole selectRoleByRoleKey(SysRole sysRole);
  63 +
62 64 /**
63 65 * 校验角色名称是否唯一
64 66 *
... ...
Bsth-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
... ... @@ -139,6 +139,11 @@ public class SysRoleServiceImpl implements ISysRoleService
139 139 return roleMapper.selectRoleById(roleId);
140 140 }
141 141  
  142 + @Override
  143 + public SysRole selectRoleByRoleKey(SysRole sysRole) {
  144 + return roleMapper.selectRoleByRoleKey(sysRole);
  145 + }
  146 +
142 147 /**
143 148 * 校验角色名称是否唯一
144 149 *
... ...
Bsth-system/src/main/resources/mapper/system/SysRoleMapper.xml
... ... @@ -92,8 +92,15 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
92 92 <include refid="selectRoleVo"/>
93 93 where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
94 94 </select>
95   -
96   - <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
  95 + <select id="selectRoleByRoleKey" parameterType="SysRole" resultMap="SysRoleResult">
  96 + <include refid="selectRoleVo"/>
  97 + where r.del_flag = '0'
  98 + <if test="roleKey != null and roleKey != ''">
  99 + AND r.role_key = #{roleKey}
  100 + </if>
  101 + </select>
  102 +
  103 + <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
97 104 insert into sys_role(
98 105 <if test="roleId != null and roleId != 0">role_id,</if>
99 106 <if test="roleName != null and roleName != ''">role_name,</if>
... ...