Commit 2a1db5924744058ffd29480967f2ec9584fc87f7
1 parent
6e6d3fc9
优化
Showing
10 changed files
with
67 additions
and
57 deletions
trash-admin/src/main/resources/application-dev.yml
| ... | ... | @@ -9,8 +9,8 @@ trash: |
| 9 | 9 | # 实例演示开关 |
| 10 | 10 | demoEnabled: true |
| 11 | 11 | # 文件路径 示例( Windows配置D:/trash/uploadPath,Linux配置 /home/trash/uploadPath,存储桶 trash/uploadPath,nginx配置 /trash/upload) |
| 12 | - #profile: /home/trash/uploadPath | |
| 13 | - profile: E:/trash/uploadPath | |
| 12 | + profile: /home/trash/uploadPath | |
| 13 | +# profile: E:/trash/uploadPath | |
| 14 | 14 | # profile: F:/work/project/Documents/uploadPath/trash |
| 15 | 15 | # 获取ip地址开关 |
| 16 | 16 | addressEnabled: false |
| ... | ... | @@ -33,7 +33,7 @@ spring: |
| 33 | 33 | # 主库数据源 |
| 34 | 34 | master: |
| 35 | 35 | # url: jdbc:mysql://localhost:3306/trash?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true |
| 36 | - url: jdbc:mysql://localhost:3306/trash?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true | |
| 36 | + url: jdbc:mysql://192.168.168.141:3306/trash?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true | |
| 37 | 37 | username: root |
| 38 | 38 | password: root |
| 39 | 39 | # 从库数据源 | ... | ... |
trash-admin/src/main/resources/application-local.yml
trash-admin/src/main/resources/static/car_2.png
trash-admin/src/main/resources/static/car_2.png1
0 → 100644
No preview for this file type
trash-admin/src/main/resources/static/type-guide.1.png
0 → 100644
1.94 MB
trash-framework/src/main/java/com/trash/framework/web/service/SysLoginService.java
| 1 | 1 | package com.trash.framework.web.service; |
| 2 | 2 | |
| 3 | -import java.util.ArrayList; | |
| 4 | -import java.util.HashSet; | |
| 5 | -import java.util.List; | |
| 6 | -import java.util.Set; | |
| 7 | - | |
| 8 | -import javax.annotation.Resource; | |
| 9 | - | |
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | -import org.springframework.security.authentication.AuthenticationManager; | |
| 12 | -import org.springframework.security.authentication.BadCredentialsException; | |
| 13 | -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; | |
| 14 | -import org.springframework.security.core.Authentication; | |
| 15 | -import org.springframework.security.core.authority.SimpleGrantedAuthority; | |
| 16 | -import org.springframework.security.core.userdetails.UserDetailsService; | |
| 17 | -import org.springframework.stereotype.Component; | |
| 18 | - | |
| 19 | 3 | import com.alibaba.fastjson.JSON; |
| 20 | 4 | import com.alibaba.fastjson.JSONArray; |
| 21 | 5 | import com.alibaba.fastjson.JSONObject; |
| ... | ... | @@ -34,9 +18,22 @@ import com.trash.common.utils.RemoteServerUtils; |
| 34 | 18 | import com.trash.framework.manager.AsyncManager; |
| 35 | 19 | import com.trash.framework.manager.factory.AsyncFactory; |
| 36 | 20 | import com.trash.system.mapper.SysTempMapper; |
| 37 | - | |
| 38 | 21 | import okhttp3.OkHttpClient; |
| 39 | 22 | import okhttp3.Request; |
| 23 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 24 | +import org.springframework.security.authentication.AuthenticationManager; | |
| 25 | +import org.springframework.security.authentication.BadCredentialsException; | |
| 26 | +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; | |
| 27 | +import org.springframework.security.core.Authentication; | |
| 28 | +import org.springframework.security.core.authority.SimpleGrantedAuthority; | |
| 29 | +import org.springframework.security.core.userdetails.UserDetailsService; | |
| 30 | +import org.springframework.stereotype.Component; | |
| 31 | + | |
| 32 | +import javax.annotation.Resource; | |
| 33 | +import java.util.ArrayList; | |
| 34 | +import java.util.HashSet; | |
| 35 | +import java.util.List; | |
| 36 | +import java.util.Set; | |
| 40 | 37 | |
| 41 | 38 | /** |
| 42 | 39 | * 登录校验方法 |
| ... | ... | @@ -106,6 +103,7 @@ public class SysLoginService |
| 106 | 103 | throw new CustomException(e.getMessage()); |
| 107 | 104 | } |
| 108 | 105 | } |
| 106 | + | |
| 109 | 107 | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| 110 | 108 | LoginUser loginUser = (LoginUser) authentication.getPrincipal(); |
| 111 | 109 | // 生成token | ... | ... |
trash-unit/src/main/java/com/trash/carInfo/controller/CarInfoController.java
| 1 | 1 | package com.trash.carInfo.controller; |
| 2 | 2 | |
| 3 | -import java.io.IOException; | |
| 4 | -import java.util.List; | |
| 5 | - | |
| 3 | +import com.trash.carInfo.domain.CarInfo; | |
| 6 | 4 | import com.trash.carInfo.domain.vo.CarInfoVo; |
| 7 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 8 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | -import org.springframework.web.bind.annotation.*; | |
| 5 | +import com.trash.carInfo.service.ICarInfoService; | |
| 10 | 6 | import com.trash.common.annotation.Log; |
| 11 | 7 | import com.trash.common.core.controller.BaseController; |
| 12 | 8 | import com.trash.common.core.domain.AjaxResult; |
| 9 | +import com.trash.common.core.page.TableDataInfo; | |
| 13 | 10 | import com.trash.common.enums.BusinessType; |
| 14 | -import com.trash.carInfo.domain.CarInfo; | |
| 15 | -import com.trash.carInfo.service.ICarInfoService; | |
| 16 | 11 | import com.trash.common.utils.poi.ExcelUtil; |
| 17 | -import com.trash.common.core.page.TableDataInfo; | |
| 12 | +import org.apache.commons.collections4.CollectionUtils; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.web.bind.annotation.*; | |
| 18 | 16 | import org.springframework.web.multipart.MultipartFile; |
| 19 | 17 | |
| 18 | +import java.io.IOException; | |
| 19 | +import java.util.List; | |
| 20 | +import java.util.Objects; | |
| 21 | +import java.util.stream.Collectors; | |
| 22 | + | |
| 20 | 23 | /** |
| 21 | 24 | * 运输车辆管理Controller |
| 22 | 25 | * |
| ... | ... | @@ -38,8 +41,21 @@ public class CarInfoController extends BaseController |
| 38 | 41 | public TableDataInfo list(CarInfoVo carInfo) |
| 39 | 42 | { |
| 40 | 43 | startPage(); |
| 41 | - carInfo.setIsDel(1); | |
| 44 | + carInfo.setIsDel("1"); | |
| 42 | 45 | List<CarInfoVo> list = carInfoService.selectCarInfoList(carInfo); |
| 46 | + if(CollectionUtils.isNotEmpty(list)){ | |
| 47 | + list = list.stream().map(car->{ | |
| 48 | + if(Objects.equals(car.getCarType(),"轻型货车")){ | |
| 49 | + car.setCarLeft("car_1.png"); | |
| 50 | + }else if(Objects.equals(car.getCarType(),"中型货车")){ | |
| 51 | + car.setCarLeft("car_2.png"); | |
| 52 | + }else if(Objects.equals(car.getCarType(),"大中型货车")){ | |
| 53 | + car.setCarLeft("car_3.png"); | |
| 54 | + } | |
| 55 | + return car; | |
| 56 | + }).collect(Collectors.toList()); | |
| 57 | + } | |
| 58 | + | |
| 43 | 59 | return getDataTable(list); |
| 44 | 60 | } |
| 45 | 61 | |
| ... | ... | @@ -51,7 +67,6 @@ public class CarInfoController extends BaseController |
| 51 | 67 | @GetMapping("/export") |
| 52 | 68 | public AjaxResult export(CarInfoVo carInfo) |
| 53 | 69 | { |
| 54 | - carInfo.setIsDel(1); | |
| 55 | 70 | List<CarInfoVo> list = carInfoService.selectCarInfoList(carInfo); |
| 56 | 71 | ExcelUtil<CarInfoVo> util = new ExcelUtil<CarInfoVo>(CarInfoVo.class); |
| 57 | 72 | return util.exportExcel(list, "carInfo"); | ... | ... |
trash-unit/src/main/java/com/trash/carInfo/domain/CarInfo.java
| ... | ... | @@ -119,16 +119,6 @@ public class CarInfo extends BaseEntity |
| 119 | 119 | @Excel(name = "二维码") |
| 120 | 120 | private String qrCode; |
| 121 | 121 | |
| 122 | - private int isDel; | |
| 123 | - | |
| 124 | - public int getIsDel() { | |
| 125 | - return isDel; | |
| 126 | - } | |
| 127 | - | |
| 128 | - public void setIsDel(int isDel) { | |
| 129 | - this.isDel = isDel; | |
| 130 | - } | |
| 131 | - | |
| 132 | 122 | public String getLengthWidthHeight() { |
| 133 | 123 | return lengthWidthHeight; |
| 134 | 124 | } | ... | ... |
trash-unit/src/main/java/com/trash/carInfo/domain/vo/CarInfoVo.java
| ... | ... | @@ -7,6 +7,8 @@ public class CarInfoVo extends CarInfo { |
| 7 | 7 | |
| 8 | 8 | private String driversName; |
| 9 | 9 | |
| 10 | + private String isDel; | |
| 11 | + | |
| 10 | 12 | public String getCompanyName() { |
| 11 | 13 | return companyName; |
| 12 | 14 | } |
| ... | ... | @@ -22,4 +24,12 @@ public class CarInfoVo extends CarInfo { |
| 22 | 24 | public void setDriversName(String driversName) { |
| 23 | 25 | this.driversName = driversName; |
| 24 | 26 | } |
| 27 | + | |
| 28 | + public String getIsDel() { | |
| 29 | + return isDel; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setIsDel(String isDel) { | |
| 33 | + this.isDel = isDel; | |
| 34 | + } | |
| 25 | 35 | } | ... | ... |
trash-unit/src/main/resources/mapper/unit/CarInfoMapper.xml
| ... | ... | @@ -35,7 +35,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 35 | 35 | <result property="updateBy" column="update_by" /> |
| 36 | 36 | <result property="creditStatus" column="credit_status" /> |
| 37 | 37 | <result property="qrCode" column="qr_code" /> |
| 38 | - <result property="isDel" column="is_del" /> | |
| 39 | 38 | </resultMap> |
| 40 | 39 | |
| 41 | 40 | <resultMap type="CarInfoVo" id="CarInfoVoResult"> |
| ... | ... | @@ -71,10 +70,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 71 | 70 | <result property="qrCode" column="qr_code" /> |
| 72 | 71 | <result property="companyName" column="companyName" /> |
| 73 | 72 | <result property="driversName" column="driversName" /> |
| 73 | + <result property="is_del" column="isDel" /> | |
| 74 | 74 | </resultMap> |
| 75 | 75 | |
| 76 | 76 | <sql id="selectCarInfoVo"> |
| 77 | - select id, company_id, car_type, car_code, car_brank, emission_standard, road_transport_date, driving_license_date, enter_date, farme_number, car_identification, container_volume, car_color, car_equipment, remark, road_transport, driving_license, car_front, car_left, car_behind, car_right, drivers, status, create_time, create_by, update_time, update_by, credit_status, qr_code,is_del from car_info | |
| 77 | + select id, company_id, car_type, car_code, car_brank, emission_standard, road_transport_date, driving_license_date, enter_date, farme_number, car_identification, container_volume, car_color, car_equipment, remark, road_transport, driving_license, car_front, car_left, car_behind, car_right, drivers, status, create_time, create_by, update_time, update_by, credit_status, qr_code from car_info | |
| 78 | 78 | </sql> |
| 79 | 79 | |
| 80 | 80 | <sql id="selectCarInfoForCompanyVo"> |
| ... | ... | @@ -120,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 120 | 120 | |
| 121 | 121 | <select id="selectCarInfoList" parameterType="CarInfoVo" resultMap="CarInfoVoResult"> |
| 122 | 122 | <include refid="selectCarInfoForCompanyVo"/> |
| 123 | - <where> | |
| 123 | + <where> | |
| 124 | 124 | <if test="companyName != null and companyName != ''"> and c.name like concat('%',#{companyName},'%')</if> |
| 125 | 125 | <if test="carType != null and carType != ''"> and car_type = #{carType}</if> |
| 126 | 126 | <if test="carCode != null and carCode != ''"> and car_code like concat('%',#{carCode},'%')</if> |
| ... | ... | @@ -143,19 +143,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 143 | 143 | <if test="drivers != null and drivers != ''"> and drivers = #{drivers}</if> |
| 144 | 144 | <if test="status != null "> and car.status = #{status}</if> |
| 145 | 145 | <if test="creditStatus != null and creditStatus != ''"> and car.credit_status = #{creditStatus}</if> |
| 146 | - <if test="isDel != null and isDel != ''"> and car.is_del = #{isDel}</if> | |
| 146 | + <if test="isDel != null and isDel != ''"> and car.is_del = #{isDel}</if> | |
| 147 | 147 | </where> |
| 148 | 148 | </select> |
| 149 | 149 | |
| 150 | 150 | <select id="selectCarInfoById" parameterType="Long" resultMap="CarInfoResult"> |
| 151 | 151 | <include refid="selectCarInfoVo"/> |
| 152 | - where id = #{id} and is_del = 1 | |
| 152 | + where id = #{id} | |
| 153 | 153 | </select> |
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | <select id="selectByCompanyId" parameterType="Long" resultMap="CarInfoVoResult"> |
| 157 | 157 | <include refid="selectCarInfoForCompanyVo"/> |
| 158 | - where car.company_id=#{companyId} and is_del = 1 | |
| 158 | + where car.company_id=#{companyId} | |
| 159 | 159 | </select> |
| 160 | 160 | |
| 161 | 161 | |
| ... | ... | @@ -191,7 +191,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 191 | 191 | <if test="creditStatus != null">credit_status,</if> |
| 192 | 192 | <if test="qrCode != null">qr_code,</if> |
| 193 | 193 | <if test="lengthWidthHeight != null">length_width_height,</if> |
| 194 | - <if test="isDel != null">is_del,</if> | |
| 195 | 194 | </trim> |
| 196 | 195 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 197 | 196 | <if test="companyId != null">#{companyId},</if> |
| ... | ... | @@ -223,7 +222,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 223 | 222 | <if test="creditStatus != null">#{creditStatus},</if> |
| 224 | 223 | <if test="qrCode != null">#{qrCode},</if> |
| 225 | 224 | <if test="lengthWidthHeight != null">#{lengthWidthHeight},</if> |
| 226 | - <if test="isDel != null">#{isDel},</if> | |
| 227 | 225 | </trim> |
| 228 | 226 | </insert> |
| 229 | 227 | |
| ... | ... | @@ -259,21 +257,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 259 | 257 | <if test="creditStatus != null">credit_status = #{creditStatus},</if> |
| 260 | 258 | <if test="qrCode != null">qr_code = #{qrCode},</if> |
| 261 | 259 | <if test="lengthWidthHeight != null">length_width_height = #{lengthWidthHeight},</if> |
| 262 | - <if test="isDel != null">is_del = #{isDel},</if> | |
| 263 | 260 | </trim> |
| 264 | 261 | where id = #{id} |
| 265 | 262 | </update> |
| 266 | 263 | |
| 267 | - <update id="deleteCarInfoById" parameterType="Long"> | |
| 268 | - update car_info set is_del = 0 where id = #{id} | |
| 269 | - </update> | |
| 264 | + <delete id="deleteCarInfoById" parameterType="Long"> | |
| 265 | + delete from car_info where id = #{id} | |
| 266 | + </delete> | |
| 270 | 267 | |
| 271 | - <update id="deleteCarInfoByIds" parameterType="String"> | |
| 272 | - update car_info set is_del = 0 where id in | |
| 268 | + <delete id="deleteCarInfoByIds" parameterType="String"> | |
| 269 | + delete from car_info where id in | |
| 273 | 270 | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| 274 | 271 | #{id} |
| 275 | 272 | </foreach> |
| 276 | - </update> | |
| 273 | + </delete> | |
| 277 | 274 | |
| 278 | 275 | |
| 279 | 276 | <insert id="addCarDriverRelation" parameterType="CarDriverRelation"> | ... | ... |