Commit c766e8072859c1bede1b2f73438c2b3fec9580a3

Authored by liujun001
1 parent 87a4f724

修改首页展示

trash-garbage/src/main/java/com/trash/garbage/controller/GarbageOrderController.java
1 package com.trash.garbage.controller; 1 package com.trash.garbage.controller;
2 2
3 3
4 -import java.io.IOException;  
5 -import java.util.HashMap;  
6 -import java.util.List;  
7 -import java.util.Map;  
8 -  
9 -import org.springframework.beans.factory.annotation.Autowired;  
10 -import org.springframework.security.access.prepost.PreAuthorize;  
11 -import org.springframework.validation.annotation.Validated;  
12 -import org.springframework.web.bind.annotation.GetMapping;  
13 -import org.springframework.web.bind.annotation.PathVariable;  
14 -import org.springframework.web.bind.annotation.PostMapping;  
15 -import org.springframework.web.bind.annotation.PutMapping;  
16 -import org.springframework.web.bind.annotation.RequestBody;  
17 -import org.springframework.web.bind.annotation.RequestMapping;  
18 -import org.springframework.web.bind.annotation.RequestParam;  
19 -import org.springframework.web.bind.annotation.RestController;  
20 -import org.springframework.web.multipart.MultipartFile;  
21 -  
22 import com.github.pagehelper.PageHelper; 4 import com.github.pagehelper.PageHelper;
23 import com.trash.common.annotation.Log; 5 import com.trash.common.annotation.Log;
24 import com.trash.common.config.trashConfig; 6 import com.trash.common.config.trashConfig;
25 import com.trash.common.core.domain.AjaxResult; 7 import com.trash.common.core.domain.AjaxResult;
  8 +import com.trash.common.core.domain.entity.SysUser;
  9 +import com.trash.common.core.domain.model.LoginUser;
26 import com.trash.common.core.page.PageDomain; 10 import com.trash.common.core.page.PageDomain;
27 import com.trash.common.core.page.TableSupport; 11 import com.trash.common.core.page.TableSupport;
28 import com.trash.common.enums.BusinessType; 12 import com.trash.common.enums.BusinessType;
  13 +import com.trash.common.utils.ServletUtils;
29 import com.trash.common.utils.StringUtils; 14 import com.trash.common.utils.StringUtils;
30 import com.trash.common.utils.file.FileUploadUtils; 15 import com.trash.common.utils.file.FileUploadUtils;
31 import com.trash.common.utils.poi.ExcelUtil; 16 import com.trash.common.utils.poi.ExcelUtil;
32 import com.trash.common.utils.sql.SqlUtil; 17 import com.trash.common.utils.sql.SqlUtil;
33 import com.trash.enterprise.domain.TransportationEnterprise; 18 import com.trash.enterprise.domain.TransportationEnterprise;
34 import com.trash.framework.config.ServerConfig; 19 import com.trash.framework.config.ServerConfig;
  20 +import com.trash.framework.web.service.TokenService;
35 import com.trash.garbage.custom.BizException; 21 import com.trash.garbage.custom.BizException;
36 import com.trash.garbage.global.Result; 22 import com.trash.garbage.global.Result;
37 import com.trash.garbage.global.ResultCode; 23 import com.trash.garbage.global.ResultCode;
38 import com.trash.garbage.pojo.domain.GarOrder; 24 import com.trash.garbage.pojo.domain.GarOrder;
39 -import com.trash.garbage.pojo.dto.AskTransportDto;  
40 -import com.trash.garbage.pojo.dto.DispatchDto;  
41 -import com.trash.garbage.pojo.dto.DisposalDispatchDto;  
42 -import com.trash.garbage.pojo.dto.EvaluateDto;  
43 -import com.trash.garbage.pojo.dto.OrderDto;  
44 -import com.trash.garbage.pojo.dto.OrderUpdateDto;  
45 -import com.trash.garbage.pojo.dto.OrderWebDto;  
46 -import com.trash.garbage.pojo.dto.UploadDto; 25 +import com.trash.garbage.pojo.dto.*;
47 import com.trash.garbage.pojo.vo.GarOrderMatchAskVo; 26 import com.trash.garbage.pojo.vo.GarOrderMatchAskVo;
48 import com.trash.garbage.pojo.vo.OrderDetailTransportVo; 27 import com.trash.garbage.pojo.vo.OrderDetailTransportVo;
49 import com.trash.garbage.pojo.vo.OrderDetailVo; 28 import com.trash.garbage.pojo.vo.OrderDetailVo;
50 import com.trash.garbage.pojo.vo.ScanDriverDetailVo; 29 import com.trash.garbage.pojo.vo.ScanDriverDetailVo;
51 import com.trash.garbage.service.GarOrderService; 30 import com.trash.garbage.service.GarOrderService;
  31 +import com.trash.garbage.service.GarUserService;
  32 +import org.apache.commons.lang3.ArrayUtils;
  33 +import org.springframework.beans.factory.annotation.Autowired;
  34 +import org.springframework.security.access.prepost.PreAuthorize;
  35 +import org.springframework.validation.annotation.Validated;
  36 +import org.springframework.web.bind.annotation.*;
  37 +import org.springframework.web.multipart.MultipartFile;
  38 +
  39 +import java.io.IOException;
  40 +import java.util.HashMap;
  41 +import java.util.List;
  42 +import java.util.Map;
  43 +import java.util.Objects;
52 44
53 /** 45 /**
54 * 订单控制 46 * 订单控制
@@ -63,6 +55,12 @@ public class GarbageOrderController { @@ -63,6 +55,12 @@ public class GarbageOrderController {
63 private GarOrderService garOrderService; 55 private GarOrderService garOrderService;
64 @Autowired 56 @Autowired
65 private ServerConfig serverConfig; 57 private ServerConfig serverConfig;
  58 + @Autowired
  59 + private TokenService tokenService;
  60 + @Autowired
  61 + private GarUserService garUserService;
  62 +
  63 + private final static Integer[] USER_TYP_SELF_COMPANY = {2, 3};
66 64
67 @PostMapping("/add") 65 @PostMapping("/add")
68 @Log(title = "创建订单", businessType = BusinessType.INSERT) 66 @Log(title = "创建订单", businessType = BusinessType.INSERT)
@@ -217,6 +215,23 @@ public class GarbageOrderController { @@ -217,6 +215,23 @@ public class GarbageOrderController {
217 215
218 @GetMapping("/company") 216 @GetMapping("/company")
219 public Result<?> queryEnterpriseList(TransportationEnterprise dto) { 217 public Result<?> queryEnterpriseList(TransportationEnterprise dto) {
  218 + dto.setId(null);
  219 + if (ArrayUtils.contains(USER_TYP_SELF_COMPANY, dto.getUserTypeValue())) {
  220 + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  221 + if (Objects.nonNull(loginUser)) {
  222 + SysUser user = loginUser.getUser();
  223 + if (Objects.nonNull(user)) {
  224 + if (Objects.equals(dto.getUserTypeValue(), 2)) {
  225 + Long id = garOrderService.queryCarIdOfDriver(user.getPhonenumber());
  226 + dto.setId(id);
  227 + } else if (Objects.equals(dto.getUserTypeValue(), 3)) {
  228 + dto.setServicePhone(user.getPhonenumber());
  229 + }
  230 + }
  231 + }
  232 + }
  233 +
  234 +
220 return Result.OK(garOrderService.queryEnterpriseList(dto)); 235 return Result.OK(garOrderService.queryEnterpriseList(dto));
221 } 236 }
222 237
@@ -226,7 +241,7 @@ public class GarbageOrderController { @@ -226,7 +241,7 @@ public class GarbageOrderController {
226 } 241 }
227 242
228 @GetMapping("/queryBadgeByType/{type}") 243 @GetMapping("/queryBadgeByType/{type}")
229 - public Result<?> queryBadgeByType(@PathVariable("type")Integer type) { 244 + public Result<?> queryBadgeByType(@PathVariable("type") Integer type) {
230 return Result.OK(garOrderService.queryBadgeByType(type)); 245 return Result.OK(garOrderService.queryBadgeByType(type));
231 } 246 }
232 247
trash-garbage/src/main/java/com/trash/garbage/mapper/GarOrderMapper.java
@@ -37,6 +37,8 @@ public interface GarOrderMapper extends BaseMapper&lt;GarOrder&gt; { @@ -37,6 +37,8 @@ public interface GarOrderMapper extends BaseMapper&lt;GarOrder&gt; {
37 Integer queryDriverOrderListByTelWithTypeCount(@Param("garUserTel") String garUserTel, @Param("type") Integer type, @Param("cancelFlag") Integer cancelFlag); 37 Integer queryDriverOrderListByTelWithTypeCount(@Param("garUserTel") String garUserTel, @Param("type") Integer type, @Param("cancelFlag") Integer cancelFlag);
38 38
39 Integer queryDisposalOrderListByTelWithTypeCount(@Param("garUserTel") String garUserTel, @Param("type") Integer type, @Param("cancelFlag") Integer value); 39 Integer queryDisposalOrderListByTelWithTypeCount(@Param("garUserTel") String garUserTel, @Param("type") Integer type, @Param("cancelFlag") Integer value);
  40 +
  41 + Long queryCompanyIdByPhone(@Param("phone")String phone);
40 } 42 }
41 43
42 44
trash-garbage/src/main/java/com/trash/garbage/service/GarOrderService.java
@@ -102,4 +102,6 @@ public interface GarOrderService extends IService&lt;GarOrder&gt; { @@ -102,4 +102,6 @@ public interface GarOrderService extends IService&lt;GarOrder&gt; {
102 void updateTimeOutOrderStatus(List<GarOrder> timeOutList); 102 void updateTimeOutOrderStatus(List<GarOrder> timeOutList);
103 103
104 MyBargeVo queryBadgeByType(Integer type); 104 MyBargeVo queryBadgeByType(Integer type);
  105 +
  106 + Long queryCarIdOfDriver(String phone);
105 } 107 }
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
@@ -1118,6 +1118,13 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -1118,6 +1118,13 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1118 return vo; 1118 return vo;
1119 } 1119 }
1120 1120
  1121 + @Override
  1122 + public Long queryCarIdOfDriver(String phone) {
  1123 + return baseMapper.queryCompanyIdByPhone(phone);
  1124 + }
  1125 +
  1126 +
  1127 +
1121 private void handleCleanNumber(TransportationEnterpriseVo vo, List<GarOrder> orderList) { 1128 private void handleCleanNumber(TransportationEnterpriseVo vo, List<GarOrder> orderList) {
1122 Long cleanNumber = 0L; 1129 Long cleanNumber = 0L;
1123 for (GarOrder order : orderList) { 1130 for (GarOrder order : orderList) {
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
@@ -254,4 +254,8 @@ @@ -254,4 +254,8 @@
254 </where> 254 </where>
255 order by `disposal`.gar_create_time desc 255 order by `disposal`.gar_create_time desc
256 </select> 256 </select>
  257 +
  258 + <select id="queryCompanyIdByPhone" parameterType="java.lang.String" resultType="java.lang.Long">
  259 + select company_id from driver d where phoneNo=#{phone}
  260 + </select>
257 </mapper> 261 </mapper>
trash-unit/src/main/java/com/trash/enterprise/domain/TransportationEnterprise.java
1 package com.trash.enterprise.domain; 1 package com.trash.enterprise.domain;
2 2
3 -import java.math.BigDecimal;  
4 -import java.util.Date;  
5 import com.fasterxml.jackson.annotation.JsonFormat; 3 import com.fasterxml.jackson.annotation.JsonFormat;
6 -import org.apache.commons.lang3.builder.ToStringBuilder;  
7 -import org.apache.commons.lang3.builder.ToStringStyle;  
8 import com.trash.common.annotation.Excel; 4 import com.trash.common.annotation.Excel;
9 import com.trash.common.core.domain.BaseEntity; 5 import com.trash.common.core.domain.BaseEntity;
  6 +import org.apache.commons.lang3.builder.ToStringBuilder;
  7 +import org.apache.commons.lang3.builder.ToStringStyle;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.util.Date;
10 11
11 /** 12 /**
12 * 运输企业管理对象 transportation_enterprise 13 * 运输企业管理对象 transportation_enterprise
@@ -137,6 +138,12 @@ public class TransportationEnterprise extends BaseEntity @@ -137,6 +138,12 @@ public class TransportationEnterprise extends BaseEntity
137 * 公司logo,公司头像 138 * 公司logo,公司头像
138 */ 139 */
139 private String companyLogo; 140 private String companyLogo;
  141 + /***
  142 + * 1是用户,2是清运车辆驾驶员,3是企业负责人,4是处置场所负责人
  143 + */
  144 + private Integer userTypeValue;
  145 +
  146 + private String userType;
140 147
141 148
142 public String getCompanyLogo() { 149 public String getCompanyLogo() {
@@ -425,6 +432,22 @@ public class TransportationEnterprise extends BaseEntity @@ -425,6 +432,22 @@ public class TransportationEnterprise extends BaseEntity
425 return qrCode; 432 return qrCode;
426 } 433 }
427 434
  435 + public Integer getUserTypeValue() {
  436 + return userTypeValue;
  437 + }
  438 +
  439 + public void setUserTypeValue(Integer userTypeValue) {
  440 + this.userTypeValue = userTypeValue;
  441 + }
  442 +
  443 + public String getUserType() {
  444 + return userType;
  445 + }
  446 +
  447 + public void setUserType(String userType) {
  448 + this.userType = userType;
  449 + }
  450 +
428 @Override 451 @Override
429 public String toString() { 452 public String toString() {
430 return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 453 return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
trash-unit/src/main/java/com/trash/enterprise/mapper/TransportationEnterpriseMapper.java
1 package com.trash.enterprise.mapper; 1 package com.trash.enterprise.mapper;
2 2
3 -import java.util.List;  
4 import com.trash.enterprise.domain.TransportationEnterprise; 3 import com.trash.enterprise.domain.TransportationEnterprise;
5 4
  5 +import java.util.List;
  6 +
6 /** 7 /**
7 * 运输企业管理Mapper接口 8 * 运输企业管理Mapper接口
8 * 9 *