diff --git a/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/LargeScreenController.java b/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/LargeScreenController.java index fe74d88..24d5a46 100644 --- a/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/LargeScreenController.java +++ b/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/LargeScreenController.java @@ -276,30 +276,32 @@ public class LargeScreenController extends BaseController { LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); queryWrapper1.eq(BizCustomerRouteShop::getRouteId,bizCustomerRoute.getId()); List bizCustomerRouteShops = bizCustomerRouteShopMapper.selectList(queryWrapper1); - List shopIdList = bizCustomerRouteShops.stream().map(BizCustomerRouteShop::getShopId).collect(Collectors.toList()); - LambdaQueryWrapper queryWrapper2 = new LambdaQueryWrapper<>(); - queryWrapper2.in(BizCustomerShop::getId,shopIdList); - List bizCustomerShops = bizCustomerShopMapper.selectList(queryWrapper2); - for (BizCustomerShop bizCustomerShop : bizCustomerShops) { - LambdaQueryWrapper queryWrapper3 = new LambdaQueryWrapper<>(); - queryWrapper3.eq(BizCustomerShopState::getShopId,bizCustomerShop.getId()); - BizCustomerShopState bizCustomerShopState = bizCustomerShopStateMapper.selectOne(queryWrapper3); - if (bizCustomerShopState != null){ - bizCustomerShop.setIsFinish(bizCustomerShopState.getIsFinish()); - LambdaQueryWrapper queryWrapper4 = new LambdaQueryWrapper<>(); - queryWrapper4.eq(BizOrder::getOrderSn,bizCustomerShopState.getCurrentOrder()); - BizOrder bizOrder = bizOrderMapper.selectOne(queryWrapper4); - if (bizOrder != null){ - bizCustomerShop.setCurrentOrder(bizOrder.getOrderSn()); - bizCustomerShop.setCarNo(bizOrder.getCarNo()); - bizCustomerShop.setDriveName(bizOrder.getDriverName()); - bizCustomerShop.setCopilotName(bizOrder.getCopilotName()); - bizCustomerShop.setStartTime(bizOrder.getStartTime()); - bizCustomerShop.setArriveImg(bizOrder.getArriveImg()); + if (bizCustomerRouteShops.size() != 0){ + List shopIdList = bizCustomerRouteShops.stream().map(BizCustomerRouteShop::getShopId).collect(Collectors.toList()); + LambdaQueryWrapper queryWrapper2 = new LambdaQueryWrapper<>(); + queryWrapper2.in(BizCustomerShop::getId,shopIdList); + List bizCustomerShops = bizCustomerShopMapper.selectList(queryWrapper2); + for (BizCustomerShop bizCustomerShop : bizCustomerShops) { + LambdaQueryWrapper queryWrapper3 = new LambdaQueryWrapper<>(); + queryWrapper3.eq(BizCustomerShopState::getShopId,bizCustomerShop.getId()); + BizCustomerShopState bizCustomerShopState = bizCustomerShopStateMapper.selectOne(queryWrapper3); + if (bizCustomerShopState != null){ + bizCustomerShop.setIsFinish(bizCustomerShopState.getIsFinish()); + LambdaQueryWrapper queryWrapper4 = new LambdaQueryWrapper<>(); + queryWrapper4.eq(BizOrder::getOrderSn,bizCustomerShopState.getCurrentOrder()); + BizOrder bizOrder = bizOrderMapper.selectOne(queryWrapper4); + if (bizOrder != null){ + bizCustomerShop.setCurrentOrder(bizOrder.getOrderSn()); + bizCustomerShop.setCarNo(bizOrder.getCarNo()); + bizCustomerShop.setDriveName(bizOrder.getDriverName()); + bizCustomerShop.setCopilotName(bizOrder.getCopilotName()); + bizCustomerShop.setStartTime(bizOrder.getStartTime()); + bizCustomerShop.setArriveImg(bizOrder.getArriveImg()); + } } } + bizCustomerRoute.setShopList(bizCustomerShops); } - bizCustomerRoute.setShopList(bizCustomerShops); largeScreenEntity.setBizCustomerRoute(bizCustomerRoute); return AjaxResult.success(largeScreenEntity); } diff --git a/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/SysAreaController.java b/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/SysAreaController.java new file mode 100644 index 0000000..4ecf3f3 --- /dev/null +++ b/cpxt-admin/src/main/java/com/cpxt/web/controller/biz/SysAreaController.java @@ -0,0 +1,29 @@ +package com.cpxt.web.controller.biz; + +import com.cpxt.biz.service.SysAreaService; +import com.cpxt.common.core.controller.BaseController; +import com.cpxt.common.core.domain.AjaxResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 地区controller + * @author Luo.J + * @date 2024-1-16 + */ +@RestController +@RequestMapping("/system/area") +public class SysAreaController extends BaseController +{ + @Autowired + private SysAreaService sysAreaService; + + /** + * 获取车辆详细信息 + */ + @GetMapping("/getByParentId") + public AjaxResult getInfo(@RequestParam String parentId) + { + return success(sysAreaService.selectByParentId(parentId)); + } +} diff --git a/cpxt-admin/src/main/java/com/cpxt/web/controller/system/SysLoginController.java b/cpxt-admin/src/main/java/com/cpxt/web/controller/system/SysLoginController.java index 8ba0545..77bcae3 100644 --- a/cpxt-admin/src/main/java/com/cpxt/web/controller/system/SysLoginController.java +++ b/cpxt-admin/src/main/java/com/cpxt/web/controller/system/SysLoginController.java @@ -3,6 +3,10 @@ package com.cpxt.web.controller.system; import java.util.List; import java.util.Set; +import com.cpxt.biz.domain.BizCustomer; +import com.cpxt.biz.domain.BizDriver; +import com.cpxt.biz.mapper.BizCustomerMapper; +import com.cpxt.biz.mapper.BizDriverMapper; import com.cpxt.common.annotation.Anonymous; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -41,6 +45,12 @@ public class SysLoginController @Autowired private TokenService tokenService; + @Autowired + private BizDriverMapper bizDriverMapper; + + @Autowired + private BizCustomerMapper bizCustomerMapper; + /** * 登录方法 * @@ -85,6 +95,15 @@ public class SysLoginController { LoginUser loginUser = SecurityUtils.getLoginUser(); SysUser user = loginUser.getUser(); + if (user.getUserType().equals("1")){ // 司机 + BizDriver bizDriver = bizDriverMapper.selectByUserId(user.getUserId()); + user.setLinkId(bizDriver.getId()); + }else if (user.getUserType().equals("2")){ // 客户 + BizCustomer bizCustomer = bizCustomerMapper.selectByName(user.getNickName()); + user.setLinkId(bizCustomer.getId()); + }else { + user.setLinkId(user.getUserId()); + } // 角色集合 Set roles = permissionService.getRolePermission(user); // 权限集合 diff --git a/cpxt-common/src/main/java/com/cpxt/common/core/domain/entity/SysUser.java b/cpxt-common/src/main/java/com/cpxt/common/core/domain/entity/SysUser.java index 60a66da..ec4d1c7 100644 --- a/cpxt-common/src/main/java/com/cpxt/common/core/domain/entity/SysUser.java +++ b/cpxt-common/src/main/java/com/cpxt/common/core/domain/entity/SysUser.java @@ -93,6 +93,16 @@ public class SysUser extends BaseEntity /** 角色ID */ private Long roleId; + public Long getLinkId() { + return linkId; + } + + public void setLinkId(Long linkId) { + this.linkId = linkId; + } + + private Long linkId; + public SysUser() { diff --git a/cpxt-system/src/main/java/com/cpxt/biz/domain/BizCustomerShop.java b/cpxt-system/src/main/java/com/cpxt/biz/domain/BizCustomerShop.java index 08121b1..6244d67 100644 --- a/cpxt-system/src/main/java/com/cpxt/biz/domain/BizCustomerShop.java +++ b/cpxt-system/src/main/java/com/cpxt/biz/domain/BizCustomerShop.java @@ -121,7 +121,8 @@ public class BizCustomerShop @TableField(exist = false) private Integer isFinish; - + @TableField(exist = false) + private String areaFullName; } diff --git a/cpxt-system/src/main/java/com/cpxt/biz/domain/BizCustomerWarehouse.java b/cpxt-system/src/main/java/com/cpxt/biz/domain/BizCustomerWarehouse.java index 4be701a..952ace1 100644 --- a/cpxt-system/src/main/java/com/cpxt/biz/domain/BizCustomerWarehouse.java +++ b/cpxt-system/src/main/java/com/cpxt/biz/domain/BizCustomerWarehouse.java @@ -3,6 +3,7 @@ package com.cpxt.biz.domain; import java.math.BigDecimal; import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -76,4 +77,7 @@ public class BizCustomerWarehouse /** 备注 */ private String remark; + + @TableField(exist = false) + private String areaFullName; } diff --git a/cpxt-system/src/main/java/com/cpxt/biz/domain/SysArea.java b/cpxt-system/src/main/java/com/cpxt/biz/domain/SysArea.java new file mode 100644 index 0000000..4958452 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/domain/SysArea.java @@ -0,0 +1,115 @@ +package com.cpxt.biz.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import lombok.Data; + +/** + * 从统计局上抓取的数据,导入到当前表 + * @TableName sys_area + */ +@TableName(value ="sys_area") +@Data +public class SysArea implements Serializable { + /** + * 地址编码 + */ + @TableId + private String id; + + /** + * 地区名称 + */ + private String name; + + /** + * 地区全称 + */ + private String fullName; + + /** + * + */ + private String parentId; + + /** + * 首字母 + */ + private String spell; + + /** + * 类型:1是省会,2直辖市,3港澳台,4其它 + */ + private Integer areaType; + + /** + * 同级下排序 + */ + private Integer orderNo; + + /** + * 0全国、1省、2市区、3郊县、4街道、5居委会 + */ + private Integer areaLevel; + + /** + * 备注 + */ + private String remark; + + /** + * 城乡分类代码 + */ + private String villageType; + + /** + * 所属国家名 + */ + private String nation; + + /** + * 所属省名称 + */ + private String province; + + /** + * 所属市名称 + */ + private String city; + + /** + * 所属区县名称 + */ + private String county; + + /** + * 所属街道名称 + */ + private String town; + + /** + * 经度 + */ + private String lng; + + /** + * 纬度 + */ + private String lat; + + /** + * 来源地图,百度1,高德2 + */ + private Integer mapType; + + /** + * 是否有下级 + */ + private String isHaveChild; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/cpxt-system/src/main/java/com/cpxt/biz/mapper/SysAreaMapper.java b/cpxt-system/src/main/java/com/cpxt/biz/mapper/SysAreaMapper.java new file mode 100644 index 0000000..dd43616 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/mapper/SysAreaMapper.java @@ -0,0 +1,20 @@ +package com.cpxt.biz.mapper; + +import com.cpxt.biz.domain.SysArea; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** +* @author LuoJian +* @description 针对表【sys_area(从统计局上抓取的数据,导入到当前表)】的数据库操作Mapper +* @createDate 2025-01-16 14:22:17 +* @Entity com.cpxt.biz.domain.SysArea +*/ +@Mapper +public interface SysAreaMapper extends BaseMapper { + +} + + + + diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/SysAreaService.java b/cpxt-system/src/main/java/com/cpxt/biz/service/SysAreaService.java new file mode 100644 index 0000000..bdb573a --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/SysAreaService.java @@ -0,0 +1,17 @@ +package com.cpxt.biz.service; + +import com.cpxt.biz.domain.SysArea; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** +* @author LuoJian +* @description 针对表【sys_area(从统计局上抓取的数据,导入到当前表)】的数据库操作Service +* @createDate 2025-01-16 14:22:17 +*/ +public interface SysAreaService extends IService { + + List selectByParentId(String parentId); + +} diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCarStateServiceImpl.java b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCarStateServiceImpl.java index 36589c5..981c1a3 100644 --- a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCarStateServiceImpl.java +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCarStateServiceImpl.java @@ -53,6 +53,9 @@ public class BizCarStateServiceImpl implements IBizCarStateService if (ObjectUtil.isNotEmpty(bizCarState.getCarNo())){ queryWrapper.eq(BizCarState::getCarNo, bizCarState.getCarNo()); } + if (ObjectUtil.isNotEmpty(bizCarState.getCarId()) && bizCarState.getCarId() != 0){ + queryWrapper.eq(BizCarState::getCarId, bizCarState.getCarId()); + } return queryWrapper; } diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCustomerShopServiceImpl.java b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCustomerShopServiceImpl.java index 6b9fa07..218efe2 100644 --- a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCustomerShopServiceImpl.java +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCustomerShopServiceImpl.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.cpxt.biz.domain.BizCustomerRoute; +import com.cpxt.biz.domain.SysArea; +import com.cpxt.biz.mapper.SysAreaMapper; import com.cpxt.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -27,6 +29,9 @@ public class BizCustomerShopServiceImpl implements IBizCustomerShopService @Autowired private BizCustomerShopMapper bizCustomerShopMapper; + @Autowired + private SysAreaMapper sysAreaMapper; + /** * 查询门店 * @@ -36,7 +41,14 @@ public class BizCustomerShopServiceImpl implements IBizCustomerShopService @Override public BizCustomerShop selectBizCustomerShopById(Long id) { - return bizCustomerShopMapper.selectById(id); + BizCustomerShop bizCustomerShop = bizCustomerShopMapper.selectById(id); + if (ObjectUtil.isNotEmpty(bizCustomerShop.getArea())){ + SysArea sysArea = sysAreaMapper.selectById(bizCustomerShop.getArea()); + if (sysArea != null){ + bizCustomerShop.setAreaFullName(sysArea.getFullName()); + } + } + return bizCustomerShop; } /** diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCustomerWarehouseServiceImpl.java b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCustomerWarehouseServiceImpl.java index d99df91..9729ad6 100644 --- a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCustomerWarehouseServiceImpl.java +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizCustomerWarehouseServiceImpl.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.cpxt.biz.domain.BizCustomerUser; +import com.cpxt.biz.domain.SysArea; +import com.cpxt.biz.mapper.SysAreaMapper; import com.cpxt.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -27,6 +29,9 @@ public class BizCustomerWarehouseServiceImpl implements IBizCustomerWarehouseSer @Autowired private BizCustomerWarehouseMapper bizCustomerWarehouseMapper; + @Autowired + private SysAreaMapper sysAreaMapper; + /** * 查询仓库 * @@ -36,7 +41,14 @@ public class BizCustomerWarehouseServiceImpl implements IBizCustomerWarehouseSer @Override public BizCustomerWarehouse selectBizCustomerWarehouseById(Long id) { - return bizCustomerWarehouseMapper.selectById(id); + BizCustomerWarehouse bizCustomerWarehouse = bizCustomerWarehouseMapper.selectById(id); + if (ObjectUtil.isNotEmpty(bizCustomerWarehouse.getArea())){ + SysArea sysArea = sysAreaMapper.selectById(bizCustomerWarehouse.getArea()); + if (sysArea != null){ + bizCustomerWarehouse.setAreaFullName(sysArea.getFullName()); + } + } + return bizCustomerWarehouse; } /** diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizOrderServiceImpl.java b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizOrderServiceImpl.java index 96b003d..022e25a 100644 --- a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizOrderServiceImpl.java +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/BizOrderServiceImpl.java @@ -389,6 +389,10 @@ public class BizOrderServiceImpl implements IBizOrderService { */ @Override public int updateBizOrder(BizOrder bizOrder) { + BizOrder order = bizOrderMapper.selectById(bizOrder.getId()); + if (bizOrder.getIsCancel() == 1 && order.getCancelTime() == null){ + bizOrder.setCancelTime(new Date()); + } return bizOrderMapper.updateById(bizOrder); } diff --git a/cpxt-system/src/main/java/com/cpxt/biz/service/impl/SysAreaServiceImpl.java b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/SysAreaServiceImpl.java new file mode 100644 index 0000000..0994801 --- /dev/null +++ b/cpxt-system/src/main/java/com/cpxt/biz/service/impl/SysAreaServiceImpl.java @@ -0,0 +1,35 @@ +package com.cpxt.biz.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.cpxt.biz.domain.SysArea; +import com.cpxt.biz.service.SysAreaService; +import com.cpxt.biz.mapper.SysAreaMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* @author LuoJian +* @description 针对表【sys_area(从统计局上抓取的数据,导入到当前表)】的数据库操作Service实现 +* @createDate 2025-01-16 14:22:17 +*/ +@Service +public class SysAreaServiceImpl extends ServiceImpl + implements SysAreaService{ + + @Autowired + private SysAreaMapper sysAreaMapper; + + @Override + public List selectByParentId(String parentId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysArea::getParentId,parentId); + return sysAreaMapper.selectList(queryWrapper); + } +} + + + +