Compare commits

...

14 Commits

Author SHA1 Message Date
xyc
02e276aade Merge branch 'insp' into driver
# Conflicts:
#	dl-module-base/src/main/java/cn/iocoder/yudao/module/company/service/impl/CompanyServiceImpl.java
2025-06-19 15:32:28 +08:00
xyc
85a2238148 更新 2025-06-19 15:29:45 +08:00
xyc
79ee3cc2b7 更新 2025-06-18 17:46:57 +08:00
xyc
09d46e1b02 更新 2025-06-18 14:58:27 +08:00
xyc
69aecb2693 更新 2025-06-17 17:41:23 +08:00
xyc
458c112b59 更新 2025-06-17 14:41:05 +08:00
xyc
15248e8680 更新 2025-06-16 17:00:56 +08:00
xyc
c22edb5c6d 更新 2025-06-13 17:06:48 +08:00
xyc
e65d3e4972 更新 2025-06-10 17:45:21 +08:00
xyc
4d8dee555f 更新 2025-06-06 15:56:02 +08:00
xyc
735f26ed3c 更新 2025-06-06 10:47:57 +08:00
xyc
e4346ad141 更新 2025-06-03 15:58:45 +08:00
xyc
b2ce977796 更新 2025-05-30 16:23:02 +08:00
xyc
b02a3b863a 更新 2025-05-29 17:40:23 +08:00
56 changed files with 1088 additions and 282 deletions

View File

@ -63,16 +63,17 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
private ServicePackageApi servicePackageApi;
/**
* 获得企业信息表每个租户的下属企业信息分页
* @param pageReqVO 分页查询条件
* @param page 分页对象
* @author vinjor-M
*/
@Override
public IPage<Company> queryListPage(CompanyReqVO pageReqVO, Page<Company> page) {
return companyMapper.selectListPage(pageReqVO,page);
}
/**
* 获得企业信息表每个租户的下属企业信息分页
*
* @param pageReqVO 分页查询条件
* @param page 分页对象
* @author vinjor-M
*/
@Override
public IPage<Company> queryListPage(CompanyReqVO pageReqVO, Page<Company> page) {
return companyMapper.selectListPage(pageReqVO, page);
}
/**
* 新增企业信息
@ -98,16 +99,21 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
deptRespDTO.setCorpId(companyRespVO.getId());
Long deptId = deptApi.saveDept(deptRespDTO);
/*3.新增企业管理员用户信息并配置角色*/
UserDTO userDTO = new UserDTO();
userDTO.setUsername(companyRespVO.getLoginAccount());
userDTO.setNickname(companyRespVO.getContactName());
userDTO.setDeptId(deptId);
userDTO.setPassword(companyRespVO.getPassword());
userDTO.setMobile(companyRespVO.getMobilePhone());
userDTO.setUserType(USER_TYPE_STAFF);
Long userId = adminUserApi.createUser(userDTO);
Set<String> roleCodes = new HashSet<>(Arrays.asList(companyRespVO.getServiceCodes().split(StrUtil.COMMA)));
permissionApi.assignUserRole(userId, roleCodes);
// 查询账号是否存在
Long userId = null;
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUserByUsername(companyRespVO.getLoginAccount());
if (adminUserRespDTO == null) {
UserDTO userDTO = new UserDTO();
userDTO.setUsername(companyRespVO.getLoginAccount());
userDTO.setNickname(companyRespVO.getContactName());
userDTO.setDeptId(deptId);
userDTO.setPassword(companyRespVO.getPassword());
userDTO.setMobile(companyRespVO.getMobilePhone());
userDTO.setUserType(USER_TYPE_STAFF);
userId = adminUserApi.createUser(userDTO);
Set<String> roleCodes = new HashSet<>(Arrays.asList(companyRespVO.getServiceCodes().split(StrUtil.COMMA)));
permissionApi.assignUserRole(userId, roleCodes);
}
} catch (ServiceException e) {
throw exception(new ErrorCode(e.getCode(), e.getMessage()));
}
@ -126,16 +132,16 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
try {
//查出原有数据
Company oldCompany = this.getById(companyRespVO.getId());
if(!companyRespVO.getServiceCodes().equals(oldCompany.getServiceCodes())){
if (!companyRespVO.getServiceCodes().equals(oldCompany.getServiceCodes())) {
//服务发生变化变更企业管理员的角色权限
Set<String> roleCodes = new HashSet<>(Arrays.asList(companyRespVO.getServiceCodes().split(StrUtil.COMMA)));
//根据企业管理员登录账户查出userId
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUserByUsername(oldCompany.getLoginAccount());
permissionApi.assignUserRole(adminUserRespDTO.getId(),roleCodes);
permissionApi.assignUserRole(adminUserRespDTO.getId(), roleCodes);
}
//正常更新数据
this.updateById(companyRespVO);
}catch (ServiceException e) {
} catch (ServiceException e) {
throw exception(new ErrorCode(e.getCode(), e.getMessage()));
}
}
@ -154,52 +160,53 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
Company company = this.getById(id);
/*1.查出本租户下与本企业名称相同的二级部门,并取出下级所有部门 */
DeptRespDTO parentDept = deptApi.getDeptByParentId(0L);
DeptRespDTO thisDept = deptApi.getDeptByParentIdAndName(parentDept.getId(),company.getCorpName());
DeptRespDTO thisDept = deptApi.getDeptByParentIdAndName(parentDept.getId(), company.getCorpName());
List<DeptRespDTO> allChildDeptList = deptApi.getChildDeptList(thisDept.getId());
allChildDeptList.add(thisDept);
/*2.删除所有部门的用户和部门---这里挨个删除,为了记录日志和级联删除对应的权限 */
Set<Long> deptIds = convertSet(allChildDeptList, DeptRespDTO::getId);
List<AdminUserRespDTO> userRespDTOList = adminUserApi.getUserListByDeptIds(deptIds);
userRespDTOList.forEach(user->adminUserApi.deleteUser(user.getId()));
userRespDTOList.forEach(user -> adminUserApi.deleteUser(user.getId()));
deptApi.deleteDept(deptIds);
/*3.删除本企业 */
this.removeById(id);
}catch (ServiceException e) {
} catch (ServiceException e) {
throw exception(new ErrorCode(e.getCode(), e.getMessage()));
}
}
/**
* 获取所有企业及对应的管理信息
*
* @author 小李
* @date 10:15 2024/8/14
**/
@Override
public List<CompanyRespVO> getCompanyAndManager(){
public List<CompanyRespVO> getCompanyAndManager() {
return baseMapper.getCompanyAndManager();
}
/**
* 通过服务名称查能提供服务的企业 分页
*
* @param company 企业对象主要是serverCodes
* @author 小李
* @date 14:09 2024/9/23
* @param company 企业对象主要是serverCodes
**/
@Override
public IPage<Company> getCompanyPageByServer(Company company, Page<Company> page){
public IPage<Company> getCompanyPageByServer(Company company, Page<Company> page) {
return baseMapper.getCompanyPageByServer(company, page);
}
/**
* 查企业能提供的业务
*
* @param id 企业ID
* @author 小李
* @date 10:21 2024/9/24
* @param id 企业ID
**/
@Override
public CompanyToServerVO getCompanyServerById(String id){
public CompanyToServerVO getCompanyServerById(String id) {
// 查企业信息
Company company = baseMapper.selectById(id);
CompanyToServerVO result = BeanUtil.toBean(company, CompanyToServerVO.class);

View File

@ -27,6 +27,8 @@ import lombok.Getter;
@Getter
public enum InspectionRoleCommon {
TENANT_ADMIN("tenant_admin", 1),
/** 检测业务管理员 */
JIANCE("jiance", 1),

View File

@ -152,7 +152,7 @@ public class AppSwiperController extends BaseController {
Set<Long> userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId());
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
if (roles.contains("jcshop") || roles.contains("jiance")) {
if (roles.contains("jcshop") || roles.contains("jiance") || roles.contains("tenant_admin")) {
map.put("shop", true);
} else {
map.put("shop", false);

View File

@ -95,4 +95,9 @@ public class InspectionConstants {
*/
public static final String INSPECTION_NOTICE_TEMPLATE_ASSIGN_STAFF_MEET_CAR_NO_CAR_NO = "您有的新的接车订单需要处理 接车时间:%s 详细信息请前往接车列表";
/**
* 检测站内信模板-提示业务经理 接车订单已被创建
*/
public static final String INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_CREATE = "%s的工单已创建详细信息请前往列表查看";
}

View File

@ -51,10 +51,10 @@ public class InspectionEquInfoController extends BaseController {
public CommonResult list(Integer pageNum, Integer pageSize, InspectionEquInfo inspectionEquInfo) throws Exception {
Page page = new Page(pageNum, pageSize);
if (ObjectUtil.isNull(inspectionEquInfo.getPartnerId())) {
ShopMallPartners partners = partnerService.shopInfoByUserId();
inspectionEquInfo.setPartnerId(partners.getPartnerId());
}
// if (ObjectUtil.isNull(inspectionEquInfo.getPartnerId())) {
//// ShopMallPartners partners = partnerService.shopInfoByUserId();
//// inspectionEquInfo.setPartnerId(partners.getPartnerId());
// }
IPage<InspectionEquInfo> list = inspectionEquInfoService.selectInspectionEquInfoList(page, inspectionEquInfo);
return success(list);
}

View File

@ -125,6 +125,19 @@ public class InspectionInfoController extends BaseController {
return success(inspectionInfoService.geStelectInspection(page, inspectionInfo));
}
/**
* 根据当前登陆人获取可以选择的工单业务经理查询
*
* @return
*/
@GetMapping("geStelectInspectionByBusiness")
public CommonResult geStelectInspectionByBusiness(InspectionInfo inspectionInfo,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
return success(inspectionInfoService.geStelectInspectionByBusiness(page, inspectionInfo));
}
/**
* 获取工单详情
*
@ -376,6 +389,17 @@ public class InspectionInfoController extends BaseController {
return success(inspectionInfoService.getCountByType(partnerId));
}
/**
* 获得不同状态的数据的数量
*
* @author 小李
* @date 16:22 2024/12/18
**/
@GetMapping("/getBusinessCountByType")
public CommonResult<?> getBusinessCountByType(@RequestParam("partnerId") Integer partnerId) {
return success(inspectionInfoService.getBusinessCountByType(partnerId));
}
/**
* 接车拍照
*
@ -387,6 +411,17 @@ public class InspectionInfoController extends BaseController {
return success(inspectionInfoService.meetCarPhoto(inspectionWorkNode));
}
/**
* 还车拍照
*
* @param inspectionWorkNode
* @return
*/
@PostMapping("/returnCarPhoto")
public CommonResult<?> returnCarPhoto(@RequestBody InspectionWorkNode inspectionWorkNode) {
return success(inspectionInfoService.returnCarPhoto(inspectionWorkNode));
}
/**
* 修改异常工单
*

View File

@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.enums.DriverLicenseType;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.service.InspectionStaffService;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo;
@ -104,6 +105,17 @@ public class InspectionStaffController extends BaseController {
return success(inspectionStaffService.edit(inspectionStaff));
}
/**
* 删除检测员工
*
* @param id
* @return
*/
@DeleteMapping("/delete")
public CommonResult<?> delete(Long id) {
return success(inspectionStaffService.removeById(id));
}
/**
* 模板
*
@ -181,15 +193,15 @@ public class InspectionStaffController extends BaseController {
/**
* 获取已完成项目
* @param userId 用户id
* @param query 请求参数
* @return
*/
@GetMapping("/getFinishProjectByUserId")
public CommonResult<?> getFinishProjectByUserId(@RequestParam("userId") Long userId,
public CommonResult<?> getFinishProjectByUserId(InspectionListQuery query,
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<Map<String, Object>> page = new Page<>(pageNo, pageSize);
return success(inspectionStaffService.getFinishProjectByUserId(page, userId));
return success(inspectionStaffService.getFinishProjectByUserId(page, query));
}
/**

View File

@ -79,7 +79,7 @@ public class InspectionUtilController {
if (CollUtil.isEmpty(inspectionRoles)) {
return success(name);
}
Integer index = Integer.MAX_VALUE;
Integer index = Integer.MAX_VALUE;
for (RoleReqDTO inspectionRole : inspectionRoles) {
InspectionRoleCommon inspectionRoleCommon = InspectionRoleCommon.valueOf(inspectionRole.getCode().toUpperCase());
if (ObjectUtil.isEmpty(inspectionRoleCommon)) {
@ -130,7 +130,7 @@ public class InspectionUtilController {
@GetMapping("/getRoleNameByIds")
public CommonResult<?> getRoleNameByIds(@RequestParam("ids") List<Long> ids) {
Map<Long, List<Long>> idToRoleIds = ids.stream().collect(Collectors.toMap(id -> id, id -> permissionApi.getRoleIdsByUserId(id)));
if (CollUtil.isEmpty(idToRoleIds)){
if (CollUtil.isEmpty(idToRoleIds)) {
return null;
}
List<RoleReqDTO> roleList = roleApi.getRoleList();
@ -140,7 +140,7 @@ public class InspectionUtilController {
Map.Entry::getKey,
item -> {
String name = "未知岗位";
if (CollUtil.isEmpty(item.getValue())){
if (CollUtil.isEmpty(item.getValue())) {
return name;
}
List<RoleReqDTO> roles = roleList.stream().filter(i -> item.getValue().contains(i.getId())).collect(Collectors.toList());
@ -148,7 +148,7 @@ public class InspectionUtilController {
return name;
}
List<RoleReqDTO> inspectionRoles = roles.stream().filter(i -> codes.contains(i.getCode())).collect(Collectors.toList());
if (CollUtil.isEmpty(inspectionRoles)){
if (CollUtil.isEmpty(inspectionRoles)) {
return name;
}
Integer index = Integer.MAX_VALUE;

View File

@ -7,7 +7,9 @@ import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.inspection.query.FileByTypeQuery;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessChannelService;
import cn.iocoder.yudao.module.inspection.vo.*;
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
import cn.iocoder.yudao.module.partner.entity.PartnerBalanceDetail;
@ -29,6 +31,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import cn.iocoder.yudao.module.core.controller.BaseController;
@ -57,6 +60,8 @@ public class PartnerOwnController extends BaseController {
private RoleService roleService;
@Autowired
private PermissionApi permissionApi;
@Autowired
private InspectionBusinessChannelService businessChannelService;
/**
* 获取店铺详情
@ -250,10 +255,10 @@ public class PartnerOwnController extends BaseController {
@GetMapping("/canUsegoods")
public CommonResult canUseGoods(Long partnerId) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = partnerList.getById(partnerId);
if (!partners.getUserId().equals(user.getId())) {
return null;
}
// ShopMallPartners partners = partnerList.getById(partnerId);
// if (!partners.getUserId().equals(user.getId())) {
// return null;
// }
return success(partnerList.canUseGoods(partnerId));
}
@ -474,7 +479,7 @@ public class PartnerOwnController extends BaseController {
@GetMapping("/getAppointmentList")
public CommonResult getAppointmentList(Long partnerId, String phoneNum,
Integer pageSize, Integer pageNum,
String carNo,@RequestParam(required = false) String startTime,@RequestParam(required = false) String endTime) throws Exception {
String carNo, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) throws Exception {
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
// ShopMallPartners partnersTmp = partnerList.getById(partnerId);
// if (!partnersTmp.getUserId().equals(user.getId())){
@ -482,7 +487,7 @@ public class PartnerOwnController extends BaseController {
// }
Page<InspectionAppointment> page = new Page<>(pageNum, pageSize);
// ShopMallPartners shopMallPartners = partnerList.shopInfo();
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, null, phoneNum, carNo,startTime,endTime);
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, null, phoneNum, carNo, startTime, endTime);
return success(appointments);
}
@ -546,11 +551,11 @@ public class PartnerOwnController extends BaseController {
public CommonResult listCoupon(Long partnerId, String searchValue,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partnersTmp = partnerList.getById(partnerId);
if (!partnersTmp.getUserId().equals(user.getId())) {
return success(new ArrayList<>());
}
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
// ShopMallPartners partnersTmp = partnerList.getById(partnerId);
// if (!partnersTmp.getUserId().equals(user.getId())) {
// return success(new ArrayList<>());
// }
Page<ShopCouponTemplate> page = new Page<>(pageNum, pageSize);
IPage<ShopCouponTemplate> shopCouponTemplates = partnerList.listCoupon(page, partnerId, searchValue);
return success(shopCouponTemplates);
@ -591,27 +596,11 @@ public class PartnerOwnController extends BaseController {
//获取客户来源
@GetMapping("/getCustomerSource")
public CommonResult getCustomerSource(String searchValue) throws Exception {
ShopMallPartners partners = partnerList.shopInfoByUserId();
String dictStr = "customer_source-" + partners.getPartnerId();
DictTypeDO sysDictType = dictTypeService.getDictType(dictStr);
if (ObjectUtil.isEmpty(sysDictType)) {
//初始化
DictTypeSaveReqVO save = new DictTypeSaveReqVO();
save.setName("客户来源-" + partners.getPartnerName());
save.setStatus(0);
save.setType(dictStr);
dictTypeService.createDictType(save);
}
List<DictDataDO> dataList = dictDataService.getDictDataListByDictType(dictStr);
if (CollectionUtil.isEmpty(dataList)) {
dataList = new ArrayList<>();
}
if (StringUtils.isNotEmpty(searchValue)) {
dataList = dataList.stream().filter(it -> {
return it.getLabel().contains(searchValue);
}).collect(Collectors.toList());
}
return success(dataList);
// 查询渠道与来源表
List<InspectionBusinessChannel> list = businessChannelService.list(Wrappers.<InspectionBusinessChannel>lambdaQuery()
.eq(InspectionBusinessChannel::getType, 1)
.like(StrUtil.isNotEmpty(searchValue), InspectionBusinessChannel::getName, searchValue));
return success(list);
}
//新增客户来源
@ -662,13 +651,15 @@ public class PartnerOwnController extends BaseController {
//获取收款账号
@GetMapping("/getBankAccountList")
public CommonResult getBankAccountList(String searchValue) throws Exception {
ShopMallPartners partners = partnerList.shopInfoByUserId();
String dictStr = "partner_bankList-" + partners.getPartnerId();
// ShopMallPartners partners = partnerList.shopInfoByUserId();
// 获取当前租户id
Long tenantId = SecurityFrameworkUtils.getLoginUser().getTenantId();
String dictStr = "partner_bankList-" + tenantId;
DictTypeDO sysDictType = dictTypeService.getDictType(dictStr);
if (ObjectUtil.isEmpty(sysDictType)) {
//初始化
DictTypeSaveReqVO sysDictTypeSave = new DictTypeSaveReqVO();
sysDictTypeSave.setName("收款账户-" + partners.getPartnerName());
sysDictTypeSave.setName("收款账户-" + tenantId);
sysDictTypeSave.setStatus(0);
sysDictTypeSave.setType(dictStr);
dictTypeService.createDictType(sysDictTypeSave);
@ -739,8 +730,8 @@ public class PartnerOwnController extends BaseController {
//统计表格2
@GetMapping("/staticsTable2")
public CommonResult staticsTable2(String startTime, String endTime) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable2(partners.getPartnerId(), startTime, endTime));
// ShopMallPartners partners = partnerList.shopInfo();
return success(partnerList.staticsTable2(null, startTime, endTime));
}
//新统计表格2
@ -758,8 +749,9 @@ public class PartnerOwnController extends BaseController {
/**
* 客户来源统计
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime 结束时间
* @return
*/
@GetMapping("/customerSourceCount")
@ -830,8 +822,8 @@ public class PartnerOwnController extends BaseController {
* @date 14:52 2024/12/10
**/
@GetMapping("/getProjectBelowStandardByIds")
public CommonResult<?> getProjectBelowStandardByIds(@RequestParam(value = "ids") Long[] ids,@RequestParam(value = "status",required = false) String status,@RequestParam(value = "type",required = false) String type) {
return success(partnerList.getProjectBelowStandardByIds(ids,status,type));
public CommonResult<?> getProjectBelowStandardByIds(@RequestParam(value = "ids") Long[] ids, @RequestParam(value = "status", required = false) String status, @RequestParam(value = "type", required = false) String type) {
return success(partnerList.getProjectBelowStandardByIds(ids, status, type));
}
/**
@ -842,8 +834,8 @@ public class PartnerOwnController extends BaseController {
* @date 14:52 2024/12/10
**/
@GetMapping("/getProjectExceptionByIds")
public CommonResult<?> getProjectExceptionByIds(@RequestParam(value = "ids") Long[] ids,@RequestParam(value = "status",required = false) String status,@RequestParam(value = "type",required = false) String type) {
return success(partnerList.getProjectExceptionByIds(ids,status,type));
public CommonResult<?> getProjectExceptionByIds(@RequestParam(value = "ids") Long[] ids, @RequestParam(value = "status", required = false) String status, @RequestParam(value = "type", required = false) String type) {
return success(partnerList.getProjectExceptionByIds(ids, status, type));
}
/**
@ -913,13 +905,25 @@ public class PartnerOwnController extends BaseController {
/**
* 文件统计
* @param startTime 开始时间
* @param endTime 结束时间
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@GetMapping("/fileStatistics")
public CommonResult<?> fileStatistics(String servicePackageId,@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime){
return success(partnerList.fileStatistics(servicePackageId,startTime, endTime));
public CommonResult<?> fileStatistics(String servicePackageId, @RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime) {
return success(partnerList.fileStatistics(servicePackageId, startTime, endTime));
}
/**
* 文件统计
*
* @param fileByTypeQuery
* @return
*/
@GetMapping("/getFileByType")
public CommonResult<?> getFileByType(FileByTypeQuery fileByTypeQuery) {
return success(partnerList.fileStatisticsList(fileByTypeQuery.getServicePackageId(), fileByTypeQuery.getStartTime(), fileByTypeQuery.getEndTime()));
}
}

View File

@ -83,8 +83,8 @@ public class ShopInspectionGoodsController extends BaseController {
public CommonResult listPartnerGoods(ShopInspectionGoods shopInspectionGoods,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) throws Exception {
ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
shopInspectionGoods.setPartnerId(one.getPartnerId().intValue());
// ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
// shopInspectionGoods.setPartnerId(one.getPartnerId().intValue());
Page<ShopInspectionGoods> page = new Page<>(pageNum, pageSize);
IPage<ShopInspectionGoods> list = shopInspectionGoodsService.listPartnerGoods(page, shopInspectionGoods);
return success(list);
@ -190,25 +190,25 @@ public class ShopInspectionGoodsController extends BaseController {
List<RoleDO> roleList = roleService.getRoleList(userRoleIdListByUserId);
List<String> roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toList());
ShopMallPartners partner = new ShopMallPartners();
if (roles.contains("jcshop")) {
LambdaQueryWrapper<ShopMallPartners> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1");
partner = appInspectionPartnerService.getOne(queryWrapper);
if (ObjectUtil.isEmpty(partner)) {
return error();
}
} else if (roles.contains("jcworker")) {
LambdaQueryWrapper<PartnerWorker> queryWrapperWork = new LambdaQueryWrapper<>();
queryWrapperWork.eq(PartnerWorker::getUserId, user.getId());
queryWrapperWork.last("limit 1");
PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
if (ObjectUtil.isEmpty(worker)) {
return error();
}
partner.setPartnerId(worker.getPartnerId());
}
shopInspectionOrder.setPartnerId(partner.getPartnerId());
// ShopMallPartners partner = new ShopMallPartners();
// if (roles.contains("jcshop")) {
// LambdaQueryWrapper<ShopMallPartners> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.orderByAsc(ShopMallPartners::getPartnerId).eq(ShopMallPartners::getType, "jc").eq(ShopMallPartners::getIsBanned, "0").last("limit 1");
// partner = appInspectionPartnerService.getOne(queryWrapper);
// if (ObjectUtil.isEmpty(partner)) {
// return error();
// }
// } else if (roles.contains("jcworker")) {
// LambdaQueryWrapper<PartnerWorker> queryWrapperWork = new LambdaQueryWrapper<>();
// queryWrapperWork.eq(PartnerWorker::getUserId, user.getId());
// queryWrapperWork.last("limit 1");
// PartnerWorker worker = partnerWorkerService.getOne(queryWrapperWork);
// if (ObjectUtil.isEmpty(worker)) {
// return error();
// }
// partner.setPartnerId(worker.getPartnerId());
// }
// shopInspectionOrder.setPartnerId(partner.getPartnerId());
shopInspectionOrder.setValidationTime(new Date());
Page<OrderInfo> page = new Page<>(pageNo, pageSize);
return CommonResult.success(orderInfoService.queryListPage(shopInspectionOrder, page));
@ -335,8 +335,8 @@ public class ShopInspectionGoodsController extends BaseController {
*/
@GetMapping("/partnerGoodsListCol")
public CommonResult partnerGoodsListCol() throws Exception {
ShopMallPartners partners = appInspectionPartnerService.shopInfoByUserId();
return success(shopInspectionGoodsService.partnerGoodsListCol(partners.getPartnerId()));
// ShopMallPartners partners = appInspectionPartnerService.shopInfoByUserId();
return success(shopInspectionGoodsService.partnerGoodsListCol(19L));
}

View File

@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/channel")
@ -23,6 +25,7 @@ public class InspectionBusinessChannelController {
@GetMapping("/tree")
public CommonResult<List<InspectionBusinessChannel>> getChannelTree(InspectionBusinessChannel channel) {
return CommonResult.success(inspectionBusinessChannelService.list(Wrappers.<InspectionBusinessChannel>lambdaQuery()
.eq(ObjectUtil.isNotEmpty(channel.getType()), InspectionBusinessChannel::getType, channel.getType())
.like(ObjectUtil.isNotEmpty(channel.getName()), InspectionBusinessChannel::getName, channel.getName())));
}
@ -39,7 +42,18 @@ public class InspectionBusinessChannelController {
*/
@GetMapping("/{id}")
public CommonResult<InspectionBusinessChannel> getChannelById(@PathVariable("id") Long id) {
return CommonResult.success(inspectionBusinessChannelService.getById(id));
InspectionBusinessChannel info = inspectionBusinessChannelService.getById(id);
//将字符串转为集合
if (ObjectUtil.isNotEmpty(info.getUserIds())) {
List<Long> userIdList = Arrays.stream(info.getUserIds().split(","))
.filter(s -> s != null && !s.isEmpty()) // 可选避免空字符串
.map(Long::valueOf)
.collect(Collectors.toList());
info.setUserIdList(userIdList);
}
return CommonResult.success(info);
}
/**
@ -47,6 +61,13 @@ public class InspectionBusinessChannelController {
*/
@PutMapping("/update")
public CommonResult<?> updateChannel(@RequestBody InspectionBusinessChannel channel) {
if (ObjectUtil.isNotEmpty(channel.getUserIdList())) {
String userIds = channel.getUserIdList().stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
channel.setUserIds(userIds);
}
return CommonResult.success(inspectionBusinessChannelService.updateById(channel));
}
@ -60,10 +81,11 @@ public class InspectionBusinessChannelController {
/**
* 获取业务渠道或客户来源列表(app)
*
* @return
*/
@GetMapping("/list")
public CommonResult<?> list(){
public CommonResult<?> list() {
return CommonResult.success(inspectionBusinessChannelService.getChannelTree());
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.inspection.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessMeetAddressRecord;
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessMeetAddressRecordService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/inspection-business-meet-address-record")
@RequiredArgsConstructor
public class InspectionBusinessMeetAddressRecordController {
private final InspectionBusinessMeetAddressRecordService inspectionBusinessMeetAddressRecordService;
/**
* 获取地址列表
*
* @param userId 用户ID
* @return 列表
*/
@GetMapping("/list")
public CommonResult<?> list(Long userId) {
return CommonResult.success(inspectionBusinessMeetAddressRecordService.list(Wrappers.<InspectionBusinessMeetAddressRecord>lambdaQuery()
.eq(InspectionBusinessMeetAddressRecord::getUserId, userId)));
}
}

View File

@ -48,4 +48,7 @@ public class DlInspectionProject extends TenantBaseDO {
@TableField(exist = false)
private List<ProjectRoyalty> projectRoyaltyList;
}
@TableField(exist = false)
private List<String> datetimeRange;
}

View File

@ -17,7 +17,12 @@ public class InspectionBusinessChannel extends TenantBaseDO {
private Integer type; // 0-业务渠道 1-客户来源
private String userIds; // 绑定的用户ID
// 子节点
@TableField(exist = false)
private List<InspectionBusinessChannel> children;
@TableField(exist = false)
private List<Long> userIdList;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.inspection.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import lombok.Data;
@Data
public class InspectionBusinessMeetAddressRecord extends TenantBaseDO {
/**
* id
*/
private Long id;
/**
* 业务经理的userId
*/
private Long userId;
/**
* 上门接车地址
*/
private String address;
}

View File

@ -163,6 +163,11 @@ public class InspectionInfo extends TenantBaseDO
private String isPickCar;
/** 当前流程节点 */
private Integer nowOrderNum;
/** 还车人id */
private Long returnCarUserId;
/** 是否还车 */
private Integer isReturnCar;
private Integer returnType;
/** 开始检测时需要 传入 选择项目的id、角色id、排序 */
@TableField(exist = false)
@ -203,4 +208,8 @@ public class InspectionInfo extends TenantBaseDO
private String appointmentDay; // 经度
@TableField(exist = false)
private String appointmentTime; // 经度
@TableField(exist = false)
private Integer meetType;
@TableField(exist = false)
private String content;
}

View File

@ -99,4 +99,10 @@ public class InspectionStaff extends TenantBaseDO {
*/
@TableField("folder_id")
private Long folderId;
/**
* 唯一码
*/
@TableField("unique_code")
private String uniqueCode;
}

View File

@ -115,4 +115,7 @@ public class InspectionWorkNode extends TenantBaseDO {
private String meetCarId;
@TableField(exist = false)
private List<String> idList;
/** 退车时传的退车类型*/
@TableField(exist = false)
private Integer returnType;
}

View File

@ -0,0 +1,9 @@
package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessMeetAddressRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface InspectionBusinessMeetAddressRecordMapper extends BaseMapper<InspectionBusinessMeetAddressRecord> {
}

View File

@ -23,4 +23,6 @@ public interface InspectionFileRecordMapper extends BaseMapper<InspectionFileRec
List<InspectionFileRecord> getRecordList(Long id);
long queryCount(@Param("servicePackageId") String servicePackageId,@Param("startTime") String startTime, @Param("endTime") String endTime);
List<InspectionFileRecord> query(@Param("servicePackageId") String servicePackageId, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@ -94,4 +94,9 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
*/
IPage<InspectionInfo> selectByUser(@Param("page") IPage page, @Param("roleIds") List<Long> roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo);
Long countByUser(@Param("roleIds") List<Long> roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo);
IPage<InspectionInfo> geStelectInspectionByBusiness(@Param("page") Page<InspectionInfo> page,@Param("info") InspectionInfo inspectionInfo);
List<InspectionInfo> selectMeetCarList(@Param("datetimeRange") List<String> datetimeRange);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.vo.StaffProjectCountVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -50,5 +51,5 @@ public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode>
*/
List<Map<String, Object>> selectExceptionNodesByInspectionIds(@Param("ids") List<Long> idList);
IPage<Map<String, Object>> selectStaffProjectByUserId(@Param("page")Page<Map<String, Object>> page, @Param("userId") Long userId);
IPage<Map<String, Object>> selectStaffProjectByUserId(@Param("page")Page<Map<String, Object>> page, @Param("query") InspectionListQuery query);
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.inspection.query;
import lombok.Data;
@Data
public class FileByTypeQuery {
/**
* 服务包id
*/
private String servicePackageId;
/**
* 查询类型 add-新增 update-修改
*/
private String type;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.inspection.query;
import lombok.Data;
import java.util.List;
@Data
public class InspectionListQuery {
/**
* 用户id
*/
private Long userId;
/**
* 客户来源
*/
private String customerSource;
/**
* 时间范围
*/
private List<String> datetimeRange;
/**
* 客户来源
*/
private String customSource;
/**
* 业务
*/
private String bussiness;
/**
* 项目id
*/
private String projectId;
}

View File

@ -43,4 +43,7 @@ public class OrderTableQuery {
/** 检测时长 */
private String[] inspectionTime;
/** 时间范围 */
private String[] datetimeRange;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.query.FileByTypeQuery;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.label.vo.LabelPageReqVO;
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
@ -262,4 +263,13 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
* @return
*/
List<Map<String, Object>> customerSourceCount(String startTime, String endTime, Long businessId);
/**
* 文件统计列表
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 结果
*/
Map<String, Object> fileStatisticsList(String servicePackageId, String startTime, String endTime);
}

View File

@ -154,9 +154,27 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
*/
Boolean meetCarPhoto(InspectionWorkNode inspectionWorkNode);
/**
* 还车拍照
* @param inspectionWorkNode
*/
Boolean returnCarPhoto(InspectionWorkNode inspectionWorkNode);
/**
* 引车
* @param inspectionInfo
*/
void leadCar(InspectionInfo inspectionInfo);
/**
* 获取业务方工单
* @param page
* @param inspectionInfo
* @return
*/
IPage<InspectionInfo> geStelectInspectionByBusiness(Page<InspectionInfo> page, InspectionInfo inspectionInfo);
Map<String, Long> getBusinessCountByType(Integer partnerId);
List<InspectionInfo> selectMeetCarList(List<String> datetimeRange);
}

View File

@ -0,0 +1,7 @@
package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessMeetAddressRecord;
import com.baomidou.mybatisplus.extension.service.IService;
public interface InspectionBusinessMeetAddressRecordService extends IService<InspectionBusinessMeetAddressRecord> {
}

View File

@ -21,4 +21,6 @@ public interface InspectionFileRecordService extends IService<InspectionFileReco
List<InspectionFileRecord> getRecordList(Long id);
long queryCount(String servicePackageId, String startTime, String endTime);
List<InspectionFileRecord> query(String servicePackageId, String startTime, String endTime);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.entity.*;
import cn.iocoder.yudao.module.inspection.query.GoodsQuery;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -81,6 +82,6 @@ public interface InspectionStaffService extends IService<InspectionStaff> {
* @param userId
* @return
*/
IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, Long userId);
IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, InspectionListQuery query);
}

View File

@ -1024,10 +1024,10 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
@Transactional(rollbackFor = Exception.class)
public void addGoods(ShopInspectionGoods goods) throws Exception {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = baseMapper.selectById(goods.getPartnerId());
if (!partners.getUserId().equals(user.getId())) {
return;
}
// ShopMallPartners partners = baseMapper.selectById(goods.getPartnerId());
// if (!partners.getUserId().equals(user.getId())) {
// return;
// }
//判断当前分类 是否已经存在商品
LambdaQueryWrapper<ShopInspectionGoods> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShopInspectionGoods::getGoodsCategoryId, goods.getGoodsCategoryId()).eq(ShopInspectionGoods::getPartnerId, goods.getPartnerId());
@ -1079,7 +1079,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
@Override
public IPage<GoodsVo> goodsList(Page<GoodsVo> page, Long partnerId, String isListing, String goodsTitle) {
return baseMapper.manageGoodsList(page, partnerId, isListing, goodsTitle);
return baseMapper.manageGoodsList(page, null, isListing, goodsTitle);
}
@Override
@ -1170,10 +1170,10 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
throw new Exception("不可重复上架!");
}
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = baseMapper.selectById(goods.getPartnerId());
if (!partners.getUserId().equals(user.getId())) {
return;
}
// ShopMallPartners partners = baseMapper.selectById(goods.getPartnerId());
// if (!partners.getUserId().equals(user.getId())) {
// return;
// }
goods.setIsListing(goods.getIsListing().equals("0") ? "1" : "0");
if (goods.getIsListing().equals("1")) {
@ -1549,11 +1549,12 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
Set<Long> userIds = new HashSet<>();
userIds.add(info.getUserId());
userIds.add(info.getWorkId());
userIds.add(info.getReturnCarUserId());
if (info.getLeadManId() != null) userIds.add(info.getLeadManId());
if (info.getMeetManId() != null) userIds.add(info.getMeetManId());
List<AdminUserDO> userList = userService.list(Wrappers.<AdminUserDO>lambdaQuery()
.in(AdminUserDO::getId,userIds)); // 你需新增 getUsers(Collection<Long> ids)
.in(AdminUserDO::getId, userIds)); // 你需新增 getUsers(Collection<Long> ids)
//转为map
Map<Long, AdminUserDO> userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, Function.identity()));
@ -1564,11 +1565,13 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
AdminUserDO meetMan = userMap.get(info.getMeetManId());
InspectionInfoVo res = new InspectionInfoVo();
BeanUtils.copyProperties(order, res); // 建议手动复制必要字段
BeanUtils.copyProperties(order, res); // 建议手动复制必要字段
res.setInspectionId(info.getId());
res.setBuyUserName(buyUser != null ? buyUser.getNickname() : "");
res.setBuyUserPhone(buyUser != null ? buyUser.getMobile() : "");
res.setReturnCarUserId(info.getReturnCarUserId());
res.setReturnCarUserName(userMap.get(info.getReturnCarUserId()) != null ? userMap.get(info.getReturnCarUserId()).getNickname() : "");
if (worker != null) {
res.setWorkerAvatar(worker.getAvatar());
@ -1597,7 +1600,6 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
if (leadMan != null) {
res.setLeadManName(leadMan.getNickname());
res.setLeadManId(leadMan.getId());
@ -1673,7 +1675,6 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
@Override
public List<InspectionInfo> workerInspectionList(Long workerId, String status, String searchValue) {
return baseMapper.workerInspectionList(workerId, status, searchValue);
@ -1791,10 +1792,10 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
@Override
public void sendCoupon(ShopCouponTemplate template) throws Exception {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partnersTmp = baseMapper.selectById(template.getPartnerId());
if (!partnersTmp.getUserId().equals(user.getId())) {
return;
}
// ShopMallPartners partnersTmp = baseMapper.selectById(template.getPartnerId());
// if (!partnersTmp.getUserId().equals(user.getId())) {
// return;
// }
if (StringUtils.isEmpty(template.getRoleKey())) {
throw new Exception("请选择角色信息");
}
@ -1823,7 +1824,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
@Override
public IPage<ShopCouponTemplate> listCoupon(Page<ShopCouponTemplate> page, Long partnerId, String searchValue) {
LambdaQueryWrapper<ShopCouponTemplate> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShopCouponTemplate::getPartnerId, partnerId).eq(ShopCouponTemplate::getBindMoudle, "检测项目现金券")
queryWrapper.eq(ShopCouponTemplate::getBindMoudle, "检测项目现金券")
.eq(StringUtils.isNotEmpty(searchValue), ShopCouponTemplate::getTitle, searchValue).orderByDesc(TenantBaseDO::getCreateTime);
return templateService.listCoupon(page, partnerId, searchValue);
@ -1924,7 +1925,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
OrderInfo orderInfo = orderService.getById(inspectionInfo.getInspectionOrderId());
AdminUserDO buyUser = userService.getUser(inspectionInfo.getUserId());
PartnerWorker worker = partnerWorkerService.getById(inspectionInfo.getWorkId());
ShopMallPartners partner = this.getById(orderInfo.getPartnerId());
// ShopMallPartners partner = this.getById(orderInfo.getPartnerId());
AdminUserDO workerUser = userService.getUser(inspectionInfo.getWorkId());
String inspection_work_order = configService.selectConfigByKey("inspection_work_order");
String payType = "未知";
@ -1932,7 +1933,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
DictDataDO payType1 = dictDataService.getDictData("pay_type", orderInfo.getPayType());
payType = payType1.getLabel();
}
inspection_work_order = inspection_work_order.replaceAll("title", Optional.ofNullable(partner.getPartnerName()).orElse(""));
// inspection_work_order = inspection_work_order.replaceAll("title", Optional.ofNullable(partner.getPartnerName()).orElse(""));
inspection_work_order = inspection_work_order.replaceAll("buyAdress", Optional.ofNullable(inspectionInfo.getUserAddress()).orElse(""));
inspection_work_order = inspection_work_order.replaceAll("buyName", Optional.ofNullable(buyUser.getNickname()).orElse("未知"));
inspection_work_order = inspection_work_order.replaceAll("buyPhone", Optional.ofNullable(buyUser.getMobile()).orElse("未知"));
@ -2027,7 +2028,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59";
// List<Map<String, Object>> res = baseMapper.staticsTable3(partnerId, startTime, endTime);
List<Map<String, Object>> res = baseMapper.selectBusinessStatistics( startTime, endTime);
List<Map<String, Object>> res = baseMapper.selectBusinessStatistics(startTime, endTime);
return res;
}
@ -2301,22 +2302,99 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
public List<Map<String, Object>> getStaffCount(DlInspectionProject dlInspectionProject) {
List<Map<String, Object>> staffCount = inspectionWorkNodeService.getStaffCount(dlInspectionProject);
// 根据userId查询检测工单表 接车人
List<InspectionInfo> list = inspectionInfoService.list(Wrappers.<InspectionInfo>lambdaQuery()
.eq(InspectionInfo::getIsMeetCar, 1));
List<InspectionInfo> list = inspectionInfoService.selectMeetCarList(dlInspectionProject.getDatetimeRange());
// 统计每个 meetManId 的数量避免 null key 异常
Map<Long, Long> meetManIdCountMap = list.stream()
Map<Long, List<InspectionInfo>> meetManIdCountMap = list.stream()
.filter(info -> info.getMeetManId() != null) // 过滤 null
.collect(Collectors.groupingBy(InspectionInfo::getMeetManId, Collectors.counting()));
.collect(Collectors.groupingBy(InspectionInfo::getMeetManId));
// 根据userId查询还车人
List<InspectionInfo> returnCarList = inspectionInfoService.list(Wrappers.<InspectionInfo>lambdaQuery()
.eq(InspectionInfo::getIsReturnCar, 1)
.between(CollUtil.isNotEmpty(dlInspectionProject.getDatetimeRange()), InspectionInfo::getEndTime, dlInspectionProject.getDatetimeRange().get(0), dlInspectionProject.getDatetimeRange().get(1)));
// 统计每个 returnCarUserId 的数量避免 null key 异常
Map<Long, List<InspectionInfo>> returnCarUserIdCountMap = returnCarList.stream()
.filter(info -> info.getReturnCarUserId() != null) // 过滤 null
.collect(Collectors.groupingBy(InspectionInfo::getReturnCarUserId));
for (Map<String, Object> stringObjectMap : staffCount) {
Set<Long> inspectionInfoIds = new HashSet<>();
Long userId = (Long) stringObjectMap.get("userId");
List<Map<String, Object>> children = (List<Map<String, Object>>) stringObjectMap.get("children");
stringObjectMap.put("meetCarCount", meetManIdCountMap.get(userId));
inspectionInfoIds.addAll(
children.stream()
.map(map -> (String) map.get("inspectionInfoId")) // 获取逗号分隔的字符串
.flatMap(idsStr -> Arrays.stream(idsStr.split(","))) // 拆分成单个ID字符串
.map(String::trim) // 去除前后空格
.filter(idStr -> !idStr.isEmpty()) // 过滤空字符串
.map(Long::valueOf) // 转换为Long类型
.collect(Collectors.toList())
);
// 获取所有接车信息
List<InspectionInfo> inspectionInfos = meetManIdCountMap.get(userId);
long meetCount = 0;
long meetGoCount = 0;
if (CollUtil.isNotEmpty(inspectionInfos)) {
meetCount = inspectionInfos.stream().filter(inspectionInfo -> Integer.valueOf(0).equals(inspectionInfo.getMeetType())).count();
meetGoCount = inspectionInfos.stream().filter(inspectionInfo -> Integer.valueOf(1).equals(inspectionInfo.getMeetType())).count();
inspectionInfoIds.addAll(inspectionInfos.stream().map(InspectionInfo::getId).collect(Collectors.toList()));
}
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("count", meetManIdCountMap.get(userId) == null ? 0 : meetManIdCountMap.get(userId));
objectObjectHashMap.put("projectName", "接车");
objectObjectHashMap.put("count", meetCount);
objectObjectHashMap.put("projectName", "接车拍照");
children.add(objectObjectHashMap);
HashMap<String, Object> meetCarHashMap = new HashMap<>();
meetCarHashMap.put("count", meetGoCount);
meetCarHashMap.put("projectName", "上门接车");
children.add(meetCarHashMap);
//还车
//设置totalCount
List<InspectionInfo> returnCarInfoList = returnCarUserIdCountMap.get(userId);
long returnCount = 0;
long returnGoCount = 0;
if (CollUtil.isNotEmpty(returnCarInfoList)) {
inspectionInfoIds.addAll(returnCarInfoList.stream().map(InspectionInfo::getId).collect(Collectors.toList()));
returnCount = Optional.ofNullable(returnCarInfoList)
.orElse(Collections.emptyList())
.stream()
.filter(Objects::nonNull)
.filter(i -> i.getReturnType() != null && i.getReturnType() == 0)
.count();
returnGoCount = Optional.ofNullable(returnCarInfoList)
.orElse(Collections.emptyList())
.stream()
.filter(Objects::nonNull)
.filter(i -> i.getReturnType() != null && i.getReturnType() == 1)
.count();
}
stringObjectMap.put("totalCount", Long.parseLong(String.valueOf(inspectionInfoIds.size())));
Map<String, Object> objectObjectHashMap1 = new HashMap<>();
objectObjectHashMap1.put("count", returnCount);
objectObjectHashMap1.put("projectName", "还车拍照");
children.add(objectObjectHashMap1);
Map<String, Object> returnCarHashMap = new HashMap<>();
returnCarHashMap.put("count", returnGoCount);
returnCarHashMap.put("projectName", "上门还车");
children.add(returnCarHashMap);
}
// meetCarCount 降序排序员工
staffCount.sort(Comparator.comparingLong(
(Map<String, Object> staff) -> (Long) staff.getOrDefault("totalCount", 0L)
).reversed());
// 对每个员工的 children count 降序排序
staffCount.forEach(staff -> {
List<Map<String, Object>> children = (List<Map<String, Object>>) staff.get("children");
if (children != null) {
children.sort(Comparator.comparingLong(
(Map<String, Object> child) -> (Long) child.getOrDefault("count", 0L)
).reversed());
}
});
return staffCount;
}
@ -2328,7 +2406,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
* @return 结果
*/
@Override
public Map<String, Object> fileStatistics(String servicePackageId,String startTime, String endTime) {
public Map<String, Object> fileStatistics(String servicePackageId, String startTime, String endTime) {
// 判断开始时间与结束时间如果为空 默认查询本月
if (StringUtils.isEmpty(startTime)) {
startTime = DateUtil.format(DateUtil.beginOfMonth(new Date()), "yyyy-MM-dd");
@ -2337,7 +2415,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
endTime = DateUtil.format(DateUtil.endOfMonth(new Date()), "yyyy-MM-dd");
}
long addCount = inspectionFileService.count(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getServicePackageId, servicePackageId)
.eq(InspectionFile::getServicePackageId, servicePackageId)
.between(InspectionFile::getCreateTime, startTime, endTime));
// 查询文件记录表
@ -2370,4 +2448,35 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
maps.sort(Comparator.comparingInt(map -> -Integer.parseInt(map.get("theNum").toString())));
return maps;
}
/**
* 文件统计列表
*
* @param servicePackageId
* @param startTime 开始时间
* @param endTime 结束时间
* @return 结果
*/
@Override
public Map<String, Object> fileStatisticsList(String servicePackageId, String startTime, String endTime) {
Map<String, Object> result = new HashMap<>();
// 根据开始时间与结束时间查询新增文件
if (StringUtils.isEmpty(startTime)) {
startTime = DateUtil.format(DateUtil.beginOfMonth(new Date()), "yyyy-MM-dd");
}
if (StringUtils.isEmpty(endTime)) {
endTime = DateUtil.format(DateUtil.endOfMonth(new Date()), "yyyy-MM-dd");
}
List<InspectionFile> insertFile = inspectionFileService.list(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getServicePackageId, servicePackageId)
.between(InspectionFile::getCreateTime, startTime, endTime));
result.put("insertFile", insertFile);
// 根据开始时间与结束时间查询修改文件
List<InspectionFileRecord> query = inspectionFileRecordService.query(servicePackageId, startTime, endTime);
result.put("updateFile", query);
return result;
}
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.inspection.service.impl;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessMeetAddressRecord;
import cn.iocoder.yudao.module.inspection.mapper.InspectionBusinessMeetAddressRecordMapper;
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessMeetAddressRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class InspectionBusinessMeetAddressRecordServiceImpl extends ServiceImpl<InspectionBusinessMeetAddressRecordMapper, InspectionBusinessMeetAddressRecord> implements InspectionBusinessMeetAddressRecordService {
}

View File

@ -39,4 +39,15 @@ public class InspectionFileRecordServiceImpl extends ServiceImpl<InspectionFileR
public long queryCount(String servicePackageId, String startTime, String endTime) {
return baseMapper.queryCount(servicePackageId, startTime, endTime);
}
/**
* @param servicePackageId
* @param startTime
* @param endTime
* @return
*/
@Override
public List<InspectionFileRecord> query(String servicePackageId, String startTime, String endTime) {
return baseMapper.query(servicePackageId, startTime, endTime);
}
}

View File

@ -113,7 +113,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
@Autowired
private InspectionStepInfoService inspectionStepInfoService;
@Autowired
private InspectionNoticeService noticeService;
private InspectionNoticeService noticeService;
@Resource
private CustomerMainService customerMainService;
@Autowired
@ -166,7 +166,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
@Transactional(rollbackFor = Exception.class)
public int insertInspectionInfo(InspectionInfo inspectionInfo) throws Exception {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partners = appInspectionPartnerService.shopInfoByUserId();
// ShopMallPartners partners = appInspectionPartnerService.shopInfoByUserId();
if (ObjectUtils.isEmpty(inspectionInfo.getInspectionWorkNodes())) {
throw new RuntimeException("请选择检测项目");
@ -197,7 +197,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
}
InspectionGoodsSku sku = skuService.getById(inspectionInfo.getSkuId());
ShopInspectionGoods goods = goodsService.getById(sku.getGoodsId());
ShopMallPartners partner = appInspectionPartnerService.getById(goods.getPartnerId());
// ShopMallPartners partner = appInspectionPartnerService.getById(goods.getPartnerId());
OrderInfo orderInfo = new OrderInfo();
@ -210,7 +210,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
// 查询订单
orderInfo = orderInfoService.getById(appointment1.getOrderId());
} else {
orderInfo.setPartnerId(partners.getPartnerId());
// orderInfo.setPartnerId(partners.getPartnerId());
orderInfo.setGoodsId(Long.parseLong(goods.getId().toString()));
orderInfo.setGoodsTitle(goods.getTitle());
orderInfo.setGoodsType("jc");
@ -225,7 +225,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
orderInfo.setRealName(user.getNickname());
orderInfo.setIsOnline("0");
orderInfo.setPhonenumber(user.getMobile());
orderInfo.setPartnerName(partner.getPartnerName());
// orderInfo.setPartnerName(partner.getPartnerName());
orderInfo.setOrderNo("线下订单-" + System.currentTimeMillis());
//赊账的情况
orderInfo.setOrderStatus("0");
@ -244,7 +244,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
.eq(OrderInfo::getId, orderInfo.getId())
.set(OrderInfo::getValidationTime, new Date()));
} else {
orderInfo.setPartnerId(partners.getPartnerId());
// orderInfo.setPartnerId(partners.getPartnerId());
orderInfo.setGoodsId(Long.parseLong(goods.getId().toString()));
orderInfo.setGoodsTitle(goods.getTitle());
orderInfo.setGoodsType("jc");
@ -259,7 +259,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
orderInfo.setRealName(user.getNickname());
orderInfo.setIsOnline("0");
orderInfo.setPhonenumber(user.getMobile());
orderInfo.setPartnerName(partner.getPartnerName());
// orderInfo.setPartnerName(partner.getPartnerName());
orderInfo.setOrderNo("线下订单-" + System.currentTimeMillis());
//赊账的情况
orderInfo.setOrderStatus("0");
@ -273,7 +273,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
.set(InspectionAppointment::getOrderId, orderInfo.getId()));
}
inspectionInfo.setInspectionOrderId(orderInfo.getId());
inspectionInfo.setPartnerId(partners.getPartnerId());
// inspectionInfo.setPartnerId(partners.getPartnerId());
inspectionInfo.setWorkerName(workerUser.getNickname());
inspectionInfo.setWorkerPhone(workerUser.getMobile());
if (ObjectUtil.isNull(inspectionInfo.getStartTime())) {
@ -419,6 +419,15 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
update(Wrappers.<InspectionInfo>lambdaUpdate()
.eq(InspectionInfo::getId, inspectionInfo.getId())
.set(InspectionInfo::getIsMeetCar, 1));
// 查询接车标
InspectionMeetCarOrder inspectionMeetCarOrder = inspectionMeetCarOrderService.getById(inspectionInfo.getMeetCarId());
// 判断接车类型是否是业务接车
if (inspectionMeetCarOrder.getMeetType() == 2) {
// 给对应的业务经理发送消息
String message = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_CREATE, inspectionInfo.getBuyName() == null ? inspectionInfo.getBuyPhone() : inspectionInfo.getBuyName());
noticeService.sentMessage(inspectionMeetCarOrder.getMeetManId(), message);
}
}
workNodeService.saveBatch(inspectionWorkNodes);
@ -537,7 +546,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
// 查询接车订单信息
InspectionMeetCarOrder order = inspectionMeetCarOrderService.getById(inspectionInfo.getId());
info.put("meetManId", order.getMeetManId());
info.put("day",order.getAppointmentDay());
info.put("day", order.getAppointmentDay());
info.put("carNo", order.getCarNum());
} else {
@ -552,7 +561,6 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
saveLeadRecord(inspectionInfo.getId(), inspectionInfo.getMeetManId());
// // 发送站内信
// String msg = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_ASSIGN_STAFF_MEET_CAR, info.get("day"), inspectionInfo.getCarNum());
// noticeService.sentMessage(inspectionInfo.getLeadManId(), msg);
@ -830,7 +838,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
@Override
public Map<String, Long> getCountByType(Integer partnerId) {
// 创建线程池
ExecutorService executor = Executors.newFixedThreadPool(6);
ExecutorService executor = Executors.newFixedThreadPool(10);
try {
InspectionInfo inspectionInfo = new InspectionInfo();
@ -850,9 +858,9 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
Map<String, Long> result = new ConcurrentHashMap<>(); // 线程安全
// 这里 `5` 而不是 `6`因为 i `0` 开始
CompletableFuture<Void>[] futures = new CompletableFuture[9];
CompletableFuture<Void>[] futures = new CompletableFuture[10];
for (int i = 0; i < 9; i++) { // 改为 `0~4`
for (int i = 0; i < 10; i++) { // 改为 `0~4`
final String status = String.valueOf(i + 1);
// 深拷贝对象防止多线程修改冲突
@ -927,6 +935,45 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
return true;
}
/**
* 还车拍照
*
* @param inspectionWorkNode
*/
@Override
public Boolean returnCarPhoto(InspectionWorkNode inspectionWorkNode) {
//图片和描述
String remark = StrUtil.isNotEmpty(inspectionWorkNode.getRemark()) ? inspectionWorkNode.getRemark() : "";
String dealImages = StrUtil.isNotEmpty(inspectionWorkNode.getDealImages()) ? inspectionWorkNode.getDealImages() : "";
//存入步骤表
InspectionStepInfo stepInfo = new InspectionStepInfo();
stepInfo.setInspectionInfoId(inspectionWorkNode.getInspectionInfoId());
String title = "还车拍照";
if (inspectionWorkNode.getReturnType() == 0 ){
title = "还车拍照";
} else if (inspectionWorkNode.getReturnType() == 1) {
title = "上门还车";
}
stepInfo.setTitle(title);
stepInfo.setContent(remark);
stepInfo.setImages(dealImages);
stepInfo.setCreator(Math.toIntExact(SecurityFrameworkUtils.getLoginUserId()));
stepInfo.setUpdater(Math.toIntExact(SecurityFrameworkUtils.getLoginUserId()));
stepInfo.setCreateTime(new Date());
stepInfo.setUpdateTime(new Date());
inspectionStepInfoService.save(stepInfo);
// 修改主表为已还车
int update = baseMapper.update(Wrappers.<InspectionInfo>lambdaUpdate()
.eq(InspectionInfo::getId, inspectionWorkNode.getInspectionInfoId())
.set(InspectionInfo::getIsReturnCar, InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_YES)
.set(InspectionInfo::getReturnType, inspectionWorkNode.getReturnType())
.set(InspectionInfo::getReturnCarUserId, SecurityFrameworkUtils.getLoginUserId()));
return true;
}
/**
* 引车
*
@ -942,6 +989,91 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
saveLeadRecord(inspectionInfo.getId(), loginUser.getId());
}
/**
* 获取业务方工单
*
* @param page
* @param inspectionInfo
* @return
*/
@Override
public IPage<InspectionInfo> geStelectInspectionByBusiness(Page<InspectionInfo> page, InspectionInfo inspectionInfo) {
return baseMapper.geStelectInspectionByBusiness(page, inspectionInfo);
}
/**
* @param partnerId
* @return
*/
@Override
public Map<String, Long> getBusinessCountByType(Integer partnerId) {
// 创建线程池
ExecutorService executor = Executors.newFixedThreadPool(10);
try {
InspectionInfo inspectionInfo = new InspectionInfo();
inspectionInfo.setPartnerId(partnerId.longValue());
// 获取当前登录人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// 获取当前登陆人的角色
// List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
// inspectionInfo.setLeadManId(loginUser.getId());
// List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
inspectionInfo.setUserId(loginUser.getId());
if (!"1".equals(inspectionInfo.getStatus())) {
inspectionInfo.setDealUserId(loginUser.getId());
}
Map<String, Long> result = new ConcurrentHashMap<>(); // 线程安全
// 这里 `5` 而不是 `6`因为 i `0` 开始
CompletableFuture<Void>[] futures = new CompletableFuture[3];
for (int i = 0; i < 3; i++) { // 改为 `0~4`
final String status = String.valueOf(i + 1);
// 深拷贝对象防止多线程修改冲突
InspectionInfo infoCopy = JSON.parseObject(JSON.toJSONString(inspectionInfo), InspectionInfo.class);
infoCopy.setStatus(status);
Page<InspectionInfo> page = new Page<>(1, 1);
futures[i] = CompletableFuture.runAsync(() -> {
IPage<InspectionInfo> inspectionInfoIPage = baseMapper.geStelectInspectionByBusiness(page, infoCopy);
Long count = inspectionInfoIPage.getTotal();
result.put(status, count);
}, executor);
}
// 等待所有任务完成
CompletableFuture.allOf(futures).join();
return result;
} catch (Exception e) {
throw new RuntimeException("Failed to execute tasks in parallel", e);
} finally {
executor.shutdown();
try {
if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
}
}
}
/**
* @return
*/
@Override
public List<InspectionInfo> selectMeetCarList(List<String> datetimeRange) {
return baseMapper.selectMeetCarList(datetimeRange);
}
/**
* 保存引车员记录
*

View File

@ -121,13 +121,19 @@ public class InspectionMeetCarOrderServiceImpl extends ServiceImpl<InspectionMee
}
if (StrUtil.isNotEmpty(order.getContent()) || StrUtil.isNotEmpty(order.getImages())) {
String title = "接车拍照";
if (order.getMeetType() == 0) {
title = "接车拍照";
} else if (order.getMeetType() == 1) {
title = "上门接车";
}
// 在步骤表里添加一条记录
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
inspectionStepInfo.setInspectionInfoId(order.getId());
//设置开始时间
inspectionStepInfo.setCreateTime(DateUtil.date());
inspectionStepInfo.setCreator(Integer.parseInt(SecurityFrameworkUtils.getLoginUserId() + ""));
inspectionStepInfo.setTitle("接车拍照");
inspectionStepInfo.setTitle(title);
inspectionStepInfo.setContent(order.getContent());
inspectionStepInfo.setImages(order.getImages());
inspectionStepInfo.setStepNum(1);

View File

@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.inspection.entity.InspectionPickCar;
import cn.iocoder.yudao.module.inspection.entity.InspectionStaff;
import cn.iocoder.yudao.module.inspection.mapper.InspectionStaffMapper;
import cn.iocoder.yudao.module.inspection.mapper.InspectionWorkNodeMapper;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
import cn.iocoder.yudao.module.inspection.service.InspectionStaffService;
@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.inspection.vo.ImportStaffVo;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo;
import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO;
import cn.iocoder.yudao.module.staff.service.UniqueCodeService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
@ -38,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ -68,6 +71,9 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
@Autowired
private InspectionWorkNodeMapper inspectionWorkNodeMapper;
@Resource
private UniqueCodeService uniqueCodeService;
/**
* 获取检测员工分页
*
@ -137,6 +143,15 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
@Override
public InspectionStaffSaveVo get(Long id) {
InspectionStaffSaveVo inspectionStaffSaveVo = baseMapper.get(id);
if (inspectionStaffSaveVo == null) {
// 创建子表
inspectionStaffSaveVo = new InspectionStaffSaveVo();
inspectionStaffSaveVo.setUserId(id);
baseMapper.insert(inspectionStaffSaveVo);
}
if (inspectionStaffSaveVo == null) {
return null;
}
// 查询用户角色集合
List<UserRoleDTO> userRoleDTOS = permissionService.userRoleDTOList(Collections.singletonList(id));
inspectionStaffSaveVo.setRoleIds(userRoleDTOS.stream()
@ -145,6 +160,8 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
.map(UserRoleDTO::getRoleId)
.collect(Collectors.toList()));
inspectionStaffSaveVo.setUserRoles(userRoleDTOS);
//将驾驶证类型转为数组
if (ObjectUtil.isNotEmpty(inspectionStaffSaveVo.getDriverLicenseType())) {
inspectionStaffSaveVo.setDriverLicenseTypeArr(Arrays.asList(inspectionStaffSaveVo.getDriverLicenseType().split(",")));
@ -156,6 +173,12 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
inspectionStaffSaveVo.setFolderId(null);
}
}
// 生成唯一推广码
if (inspectionStaffSaveVo.getUniqueCode() == null) {
inspectionStaffSaveVo.setUniqueCode(uniqueCodeService.createUniqueCode());
baseMapper.update(Wrappers.<InspectionStaff>lambdaUpdate().eq(InspectionStaff::getUserId, inspectionStaffSaveVo.getId()).set(InspectionStaff::getUniqueCode, inspectionStaffSaveVo.getUniqueCode()));
}
return inspectionStaffSaveVo;
}
@ -169,12 +192,19 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
@Transactional(rollbackFor = Exception.class)
public Long saveInspectionStaff(InspectionStaffSaveVo inspectionStaffVo) {
//新增system_users主表
UserSaveReqVO userDTO = BeanUtil.copyProperties(inspectionStaffVo, UserSaveReqVO.class);
userDTO.setId(inspectionStaffVo.getUserId());
//获取当前人的租户id
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
userDTO.setTenantId(loginUser.getTenantId());
Long userId = userService.createUser(userDTO);
// 判断账号是否存在
AdminUserDO one = userService.getOne(Wrappers.<AdminUserDO>lambdaQuery().eq(AdminUserDO::getUsername, inspectionStaffVo.getUsername()).last("LIMIT 1"));
Long userId = null;
if (one == null) {
UserSaveReqVO userDTO = BeanUtil.copyProperties(inspectionStaffVo, UserSaveReqVO.class);
userDTO.setId(inspectionStaffVo.getUserId());
//获取当前人的租户id
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
userDTO.setTenantId(loginUser.getTenantId());
userId = userService.createUser(userDTO);
} else {
userId = one.getId();
}
// //查询检测基础员工角色
// List<RoleDO> role = roleService.getRoleListByCodesTenant(Collections.singletonList(InspectionConstants.INSPECTION_BASE_STAFF_ROLE));
@ -187,14 +217,22 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
// //设置角色为检测基础员工
// permissionService.assignUserRole(userId, roleIds);
InspectionStaff inspectionStaff = BeanUtil.copyProperties(inspectionStaffVo, InspectionStaff.class);
inspectionStaff.setUserId(userId);
//新增检测员工子表
this.save(inspectionStaff);
if (ObjectUtil.isNotEmpty(inspectionStaffVo.getFileList())) {
addFile(inspectionStaffVo.getFileList(), inspectionStaffVo.getNickname(), null, inspectionStaff.getUserId());
// 查询子表中是否存在
InspectionStaff staff = this.getOne(Wrappers.<InspectionStaff>lambdaQuery().eq(InspectionStaff::getUserId, userId));
if (ObjectUtil.isNull(staff)) {
InspectionStaff inspectionStaff = BeanUtil.copyProperties(inspectionStaffVo, InspectionStaff.class);
inspectionStaff.setUserId(userId);
//新增检测员工子表
this.save(inspectionStaff);
if (ObjectUtil.isNotEmpty(inspectionStaffVo.getFileList())) {
addFile(inspectionStaffVo.getFileList(), inspectionStaffVo.getNickname(), null, inspectionStaff.getUserId());
}
return inspectionStaff.getUserId();
}else {
throw new RuntimeException("该员工已存在");
}
return inspectionStaff.getUserId();
}
/**
@ -259,8 +297,8 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
* @return
*/
@Override
public IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, Long userId) {
return inspectionWorkNodeMapper.selectStaffProjectByUserId(page,userId);
public IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, InspectionListQuery query) {
return inspectionWorkNodeMapper.selectStaffProjectByUserId(page,query);
}
/**

View File

@ -445,6 +445,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
public List<Map<String, Object>> getStaffCount(DlInspectionProject dlInspectionProject) {
Map<Long, Map<String, Object>> tempMap = new LinkedHashMap<>();
List<StaffProjectCountVO> staffCount = baseMapper.getStaffCount(dlInspectionProject);
for (StaffProjectCountVO vo : staffCount) {
Map<String, Object> userEntry = tempMap.computeIfAbsent(vo.getUserId(), k -> {
Map<String, Object> m = new HashMap<>();
@ -457,10 +458,14 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
// 添加项目
List<Map<String, Object>> children = (List<Map<String, Object>>) userEntry.get("children");
if (vo.getCount() == 0) {
continue;
}
Map<String, Object> project = new HashMap<>();
project.put("projectName", vo.getProjectName());
project.put("count", vo.getCount());
project.put("id", vo.getId());
project.put("inspectionInfoId", vo.getInspectionInfoIds());
children.add(project);
// 累加总数
@ -477,7 +482,6 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
})
.sorted((a, b) -> Long.compare((Long) b.get("totalCount"), (Long) a.get("totalCount")))
.collect(Collectors.toList());
}
/**

View File

@ -70,8 +70,8 @@ public class ProjectRoyaltyServiceImpl extends ServiceImpl<ProjectRoyaltyMapper,
@Override
public List<ProjectRoyalty> getProjectRoyaltyList(String projectId) {
try {
ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
return baseMapper.selectListByProjrctId(projectId, one.getPartnerId().toString());
// ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
return baseMapper.selectListByProjrctId(projectId, null);
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -111,4 +111,4 @@ public class ProjectRoyaltyServiceImpl extends ServiceImpl<ProjectRoyaltyMapper,
// }
}
}

View File

@ -268,8 +268,8 @@ public class ShopInspectionGoodsServiceImpl extends ServiceImpl<ShopInspectionGo
@Override
public List<ShopInspectionCategory> categoryList() throws Exception {
ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
List<ShopInspectionCategory> shopInspectionCategories = appInspectionPartnerService.categoryList(one.getPartnerId());
// ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
List<ShopInspectionCategory> shopInspectionCategories = appInspectionPartnerService.categoryList(null);
if (CollectionUtil.isNotEmpty(shopInspectionCategories)) {
for (ShopInspectionCategory shopInspectionCategory : shopInspectionCategories) {
LambdaQueryWrapper<InspectionCategoryTemplate> templateLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -286,11 +286,11 @@ public class ShopInspectionGoodsServiceImpl extends ServiceImpl<ShopInspectionGo
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
LambdaQueryWrapper<ShopMallPartners> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(ShopMallPartners::getUserId,loginUser.getId()).eq(ShopMallPartners::getType,"jc").last("limit 1");
ShopMallPartners one = partnersService.getOne(queryWrapper);
if (ObjectUtils.isEmpty(one)){
throw new Exception("您不是商户");
}
shopInspectionGoods.setPartnerId(one.getPartnerId().intValue());
// ShopMallPartners one = partnersService.getOne(queryWrapper);
// if (ObjectUtils.isEmpty(one)){
// throw new Exception("您不是商户");
// }
// shopInspectionGoods.setPartnerId(one.getPartnerId().intValue());
appInspectionPartnerService.addGoods(shopInspectionGoods);
}
@ -300,7 +300,7 @@ public class ShopInspectionGoodsServiceImpl extends ServiceImpl<ShopInspectionGo
JSONObject res =new JSONObject();
List<JSONObject> listGoods = new ArrayList<>();
LambdaQueryWrapper<ShopInspectionGoods> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(ShopInspectionGoods::getPartnerId,partnerId).eq(ShopInspectionGoods::getIsListing,"1").orderByAsc(ShopInspectionGoods::getOrderNum);
queryWrapper.eq(ObjectUtil.isNotEmpty(partnerId),ShopInspectionGoods::getPartnerId,partnerId).eq(ShopInspectionGoods::getIsListing,"1").orderByAsc(ShopInspectionGoods::getOrderNum);
List<ShopInspectionGoods> list = this.list(queryWrapper);
if (CollectionUtil.isNotEmpty(list)){
listGoods = list.stream().map(it -> {

View File

@ -112,4 +112,9 @@ public class InspectionInfoVo {
private String isMeetCar;
private String otherName;
private String otherPhone;
/** 还车人id */
private Long returnCarUserId;
private String returnCarUserName;
/** 是否还车 */
private Integer isReturnCar;
}

View File

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.inspection.vo;
import cn.iocoder.yudao.annotation.Excel;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.inspection.entity.InspectionStaff;
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@ -106,7 +108,12 @@ public class InspectionStaffSaveVo extends InspectionStaff {
private List<FileDO> fileList;
/**
* 角色集合
* 角色ID集合
*/
private List<Long> roleIds;
/**
* 角色集合
*/
private List<UserRoleDTO> userRoles;
}

View File

@ -9,4 +9,7 @@ public class StaffProjectCountVO {
private Long count;
private String nickname;
private String projectName;
private Long nodeCount;
// private Long inspectionInfoId;
private String inspectionInfoIds;
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.util;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
public class ListUtil {
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Set<Object> seen = ConcurrentHashMap.newKeySet();
return t -> {
Object key = keyExtractor.apply(t);
return key != null && seen.add(key); // 关键是这一行
};
}
}

View File

@ -241,23 +241,60 @@
<!-- </select>-->
<select id="getStaffCount" resultType="cn.iocoder.yudao.module.inspection.vo.StaffProjectCountVO"
parameterType="cn.iocoder.yudao.module.inspection.entity.DlInspectionProject">
SELECT
ip.id,ip.project_name, count(iwn.id) as count,is2.user_id,su.nickname
FROM inspection_staff is2
LEFT JOIN inspection_work_node iwn ON is2.user_id = iwn.deal_user_id
LEFT JOIN inspection_project ip ON iwn.project_id = ip.id
LEFT JOIN system_users su on su.id = is2.user_id
WHERE
ip.id in (
SELECT
ip2.id
FROM
inspection_project ip2
WHERE
ip2.deleted = 0
)
group by is2.user_id,ip.project_name
SELECT
staff.user_id,
iwn.id,
ip.project_name,
ip.id AS project_id,
GROUP_CONCAT(iwn.inspection_info_id) AS inspectionInfoIds,
su.nickname,
SUM(IF(iwn.node_count = 0,1,iwn.node_count)) count
FROM
inspection_staff staff
LEFT JOIN inspection_work_node iwn ON iwn.deal_user_id = staff.user_id
LEFT JOIN inspection_project ip ON ip.id = iwn.project_id
LEFT JOIN (
SELECT DISTINCT sur.user_id
FROM system_user_role sur
JOIN system_role sr ON sur.role_id = sr.id
WHERE sr.service_package_id = 'jiance'
AND sr.CODE NOT IN ('jcyh', 'jcywjl')
) valid_roles ON staff.user_id = valid_roles.user_id
LEFT JOIN system_users su ON su.id = staff.user_id
<where>
staff.deleted = 0
AND (valid_roles.user_id IS NOT NULL) -- 只保留有合格角色的用户
<if test="datetimeRange != null">
AND iwn.create_time BETWEEN #{datetimeRange[0]} AND #{datetimeRange[1]}
</if>
</where>
GROUP BY staff.user_id ,ip.id
<!--SELECT
ip.id AS project_id,
ip.project_name,
is2.user_id,
su.nickname,
iwn.inspection_info_id,
COUNT(iwn.id) AS count,
SUM(iwn.node_count) AS nodeCount
FROM inspection_staff is2
CROSS JOIN inspection_project ip
LEFT JOIN system_users su ON su.id = is2.user_id
left join system_user_role sr on su.id = sr.user_id
left join system_role sr2 on sr.role_id = sr2.id
INNER JOIN inspection_work_node iwn ON
iwn.deal_user_id = is2.user_id
AND iwn.project_id = ip.id
<if test="datetimeRange != null">
AND iwn.create_time BETWEEN #{datetimeRange[0]} AND #{datetimeRange[1]}
</if>
WHERE
is2.deleted = 0
AND su.deleted = 0 and sr2.service_package_id = 'jiance' and sr2.code != 'jcyh' and sr2.code != 'jcywjl'
GROUP BY is2.user_id, ip.id-->
</select>
<select id="selectExceptionNodesByInspectionIds" resultType="java.util.Map">
SELECT
w.inspection_info_id AS inspectionInfoId,
@ -285,36 +322,54 @@
</select>
<select id="selectStaffProjectByUserId" resultType="java.util.Map">
SELECT
ii.id AS inspectionInfoId,
ii.user_id AS userId,
ii.user_name AS userName,
ii.buy_name AS buyName,
ii.buy_phone AS buyPhone,
ii.car_num AS carNum,
ii.car_model AS carModel,
ii.car_status AS carStatus,
ii.start_time AS startTime,
ii.end_time AS endTime,
ii.unit_name AS unitName,
ii.partner_id,
ii.work_id AS workId,
ii.worker_name AS workerName,
ii.worker_phone AS workerPhone,
ii.worker_avatar AS workerAvatar,
CASE
WHEN ii.is_pass = '0' THEN '不通过'
WHEN ii.is_pass = '1' THEN '通过'
WHEN ii.is_pass IS NULL THEN '进行中'
ELSE '未知'
END AS status,
GROUP_CONCAT(ip.project_name ORDER BY iwn.order_num SEPARATOR ',') AS projectName
ii.id AS inspectionInfoId,
ii.user_id AS userId,
ii.user_name AS userName,
ii.buy_name AS buyName,
ii.buy_phone AS buyPhone,
ii.car_num AS carNum,
ii.car_model AS carModel,
ii.car_status AS carStatus,
ii.start_time AS startTime,
ii.end_time AS endTime,
ii.unit_name AS unitName,
ii.partner_id,
ii.work_id AS workId,
ii.worker_name AS workerName,
ii.worker_phone AS workerPhone,
ii.worker_avatar AS workerAvatar,
CASE
WHEN ii.is_pass = '0' THEN '不通过'
WHEN ii.is_pass = '1' THEN '通过'
WHEN ii.is_pass IS NULL THEN '进行中'
ELSE '未知'
END AS status,
GROUP_CONCAT(ip.project_name ORDER BY iwn.order_num SEPARATOR ',') AS projectName
FROM inspection_work_node iwn
LEFT JOIN inspection_info ii ON iwn.inspection_info_id = ii.id
LEFT JOIN inspection_project ip ON ip.id = iwn.project_id
WHERE
iwn.deal_user_id = #{userId}
AND iwn.status = '2'
AND iwn.deleted = b'0'
LEFT JOIN inspection_info ii ON iwn.inspection_info_id = ii.id
LEFT JOIN inspection_project ip ON ip.id = iwn.project_id
<where>
<if test="query.userId != null">
AND iwn.deal_user_id = #{query.userId}
</if>
<if test="query.customerSource != null">
AND ii.customer_source = #{query.customerSource}
</if>
<if test="query.datetimeRange != null">
AND ii.create_time BETWEEN #{query.datetimeRange[0]} AND #{query.datetimeRange[1]}
</if>
<if test="query.customSource != null">
AND ii.customer_source = #{query.customSource}
</if>
<if test="query.bussiness != null">
AND ii.business_channel = #{query.bussiness}
</if>
<if test="query.projectId != null">
AND ip.id = #{query.projectId}
</if>
AND iwn.status = '2'
AND iwn.deleted = b'0'
</where>
GROUP BY ii.id
ORDER BY ii.start_time DESC;
</select>

View File

@ -127,21 +127,42 @@
FROM order_info oi
WHERE oi.deleted = 0
</select>
<select id="allAmount" resultType="java.lang.Integer">
<select id="manageGoodsList" resultType="cn.iocoder.yudao.module.inspection.vo.GoodsVo">
SELECT
sig.id as goodsId,sig.title as goodsTitle,sig.image as goodsImage,sig.price,count(oi.id) as
salesNum,sig.listing_status,sig.reject_reason
FROM
shop_inspection_goods sig
LEFT JOIN order_info oi ON sig.id = oi.goods_id and oi.pay_time is not null
<where>
<if test="partnerId !=null and partnerId!=''">
sig.partner_id =#{partnerId}
</if>
<if test="isListing !=null and isListing!=''">
and sig.is_listing = #{isListing}
</if>
<if test="goodsTitle !=null and goodsTitle!=''">
and sig.title like concat('%',#{goodsTitle},'%')
</if>
</where>
group by sig.id
order by sig.order_num,sig.create_time desc
</select>
<select id="allAmount" resultType="java.lang.Integer">
SELECT
IfNULL(sum(oi.pay_money+oi.balance),0) as allAmount
FROM
order_info oi
WHERE oi.partner_id = #{partnerId} and validation_time is not null
</select>
<select id="todayAmount" resultType="java.lang.Integer">
<select id="todayAmount" resultType="java.lang.Integer">
SELECT
IfNULL(sum(oi.pay_money+oi.balance),0) as allAmount
FROM
order_info oi
WHERE oi.partner_id = #{partnerId} and validation_time like CONCAT(#{timeStr},'%')
</select>
<select id="hotGoodsList" resultType="cn.iocoder.yudao.module.inspection.vo.HotGoodsVo">
<select id="hotGoodsList" resultType="cn.iocoder.yudao.module.inspection.vo.HotGoodsVo">
SELECT
goods.title AS goodsName,
ROUND(
@ -165,7 +186,7 @@ GROUP BY
goods.id
order by salesNum desc
</select>
<select id="newHotGoodsList" resultType="cn.iocoder.yudao.module.inspection.vo.HotGoodsVo">
<select id="newHotGoodsList" resultType="cn.iocoder.yudao.module.inspection.vo.HotGoodsVo">
SELECT
goods.title AS goodsName,
SUM( case when (ii.`status`='1' and ii.is_pass = '1') or (ii.`status`='0') then oi.goods_price else 0 end ) AS salesAmount,
@ -179,22 +200,6 @@ GROUP BY
goods.id
order by salesNum desc
</select>
<select id="manageGoodsList" resultType="cn.iocoder.yudao.module.inspection.vo.GoodsVo">
SELECT
sig.id as goodsId,sig.title as goodsTitle,sig.image as goodsImage,sig.price,count(oi.id) as salesNum,sig.listing_status,sig.reject_reason
FROM
shop_inspection_goods sig
LEFT JOIN order_info oi ON sig.id = oi.goods_id and oi.pay_time is not null
where sig.partner_id =#{partnerId}
<if test="isListing !=null and isListing!=''">
and sig.is_listing = #{isListing}
</if>
<if test="goodsTitle !=null and goodsTitle!=''">
and sig.title like concat('%',#{goodsTitle},'%')
</if>
group by sig.id
order by sig.order_num,sig.create_time desc
</select>
<select id="orderList" resultType="cn.iocoder.yudao.module.inspection.vo.OrderAppDetail">
SELECT
*
@ -265,7 +270,7 @@ where sig.partner_id =#{partnerId}
<!-- 待复检 -->
<if test="status == 4">
AND iwn.status = '3'
AND iwn.type = '0'
AND info.status != '1'
</if>
@ -476,6 +481,7 @@ FROM
count(1) allNum,
IFNULL(SUM(ii.status='0'),0) jxzNum,
IFNULL(SUM(ii.status='1'),0) ywcNum,
IFNULL(SUM(ii.status='1' and ii.is_pass='0'),0) tblNum,
IFNULL(SUM(oi.sku_name LIKE '%年审%'),0) nsNum,
IFNULL(SUM(oi.sku_name LIKE '%上户%'),0) shNum,
IFNULL(SUM(oi.sku_name LIKE '%非定检%'),0) fdjNum,
@ -487,7 +493,10 @@ FROM
inspection_info ii
LEFT JOIN order_info oi on oi.id = ii.inspection_order_id
<where>
ii.partner_id =#{partnerId} and ii.deleted = 0 and oi.deleted = 0
ii.deleted = 0 and oi.deleted = 0
<if test="partnerId != null">
and ii.partner_id = #{partnerId}
</if>
<if test="startTime != null and endTime != null">
and ii.create_time BETWEEN #{startTime} and #{endTime}
</if>
@ -710,7 +719,16 @@ FROM
AND TIMESTAMPDIFF(MINUTE, ii.start_time, ii.end_time)
BETWEEN #{query.inspectionTime[0]} AND #{query.inspectionTime[1]}
</if>
<if test="query.chooseStatus == '5'.toString()">
AND ii.reinspect_count != 0 AND ii.reinspect_count IS NOT NULL
</if>
<if test="query.chooseStatus == '6'.toString()">
AND ii.recheck_count != 0 AND ii.recheck_count IS NOT NULL
</if>
<if test="query.datetimeRange != null">
AND ii.create_time
BETWEEN CONCAT(#{query.datetimeRange[0]},' 00:00:00') AND CONCAT(#{query.datetimeRange[1]},' 23:59:59')
</if>
<if test="query.inspectionTime[0] !=null and query.inspectionTime.length == 1">
AND ii.start_time IS NOT NULL AND ii.end_time IS NOT NULL
AND TIMESTAMPDIFF(MINUTE, ii.start_time, ii.end_time) >= #{query.inspectionTime[0]}

View File

@ -20,4 +20,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND record.create_time between #{startTime} and #{endTime}
</if>
</select>
<select id="query" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionFileRecord">
select record.*
from inspection_file_record record
INNER JOIN inspection_file file on record.file_id = file.id
where record.deleted = 0
AND file.service_package_id = #{servicePackageId}
<if test="startTime != null">
AND record.create_time between #{startTime} and #{endTime}
</if>
order by record.create_time desc
</select>
</mapper>

View File

@ -375,6 +375,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ii.status = '0'
ORDER BY ii.update_time DESC
</if>
<!-- 还车 -->
<if test="inspectionInfo.status == 10">
AND ii.is_return_car != 1
AND ii.status = '1'
ORDER BY ii.update_time DESC
</if>
</where>
) AS subquery
WHERE rn = 1;
@ -438,8 +444,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<!-- 接车订单转工单 -->
<if test="inspectionInfo.status == 8">
SELECT imco.*
SELECT imco.*,iisi.content
FROM inspection_meet_car_order imco
LEFT JOIN inspection_step_info iisi ON imco.id = iisi.inspection_info_id
WHERE imco.deleted = 0 AND imco.inspection_info_id IS NULL AND imco.is_meet = '1'
<!-- 车牌号模糊查询 -->
<if test="inspectionInfo.carNum != null">
@ -566,6 +573,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ii.lead_man_id IS NULL
AND ii.status = '0'
</if>
<!-- 还车 -->
<if test="inspectionInfo.status == 10">
AND ii.is_return_car != 1
AND ii.status = '1'
ORDER BY ii.update_time DESC
</if>
</where>
</if>
<if test="inspectionInfo.status == 6">
@ -605,4 +618,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</if>
</select>
<select id="geStelectInspectionByBusiness"
resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT imco.meet_man_id,imco.buy_name,imco.buy_phone, imco.car_num,imco.other_phone
<if test="info.status != 1">
,ii.id AS id,imco.id AS meetCarId,oi.sku_name AS skuName,oi.goods_title,ii.*
</if>
<if test="info.status == 1">
,imco.id AS id
</if>
FROM inspection_meet_car_order imco
JOIN inspection_business_channel ibc
ON imco.customer_source_id = ibc.id
<if test="info.status != 1">
INNER JOIN inspection_info ii ON imco.inspection_info_id = ii.id AND ii.deleted = 0
LEFT JOIN order_info oi ON ii.inspection_order_id = oi.id AND oi.deleted = 0
</if>
<where>
ibc.deleted = 0
AND imco.deleted = 0
<if test="info.userId != null and info.userId != ''">
AND FIND_IN_SET(#{info.userId}, ibc.user_ids)
AND imco.creator = #{info.userId}
</if>
<if test="info.carNum != null and info.carNum != ''">
AND imco.car_num LIKE CONCAT('%', #{info.carNum}, '%')
</if>
<if test="info.status == 2">
AND ii.status = '0'
</if>
<if test="info.status == 3">
AND ii.status = '1'
</if>
</where>
</select>
<select id="selectMeetCarList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT ii.*, imco.meet_type
FROM inspection_info ii
LEFT JOIN inspection_meet_car_order imco ON ii.id = imco.inspection_info_id
<where>
ii.deleted = 0 AND imco.deleted = 0 AND imco.is_meet = '1'
<if test="datetimeRange != null">
AND imco.create_time BETWEEN #{datetimeRange[0]} AND #{datetimeRange[1]}
</if>
</where>
</select>
</mapper>

View File

@ -27,12 +27,10 @@
iss.emergency_contact_name,
iss.emergency_contact_phone,
iss.driver_license_type
FROM system_users su
left join system_user_role sur on su.id = sur.user_id
left join system_role sr on sur.role_id = sr.id
left join inspection_staff iss on iss.user_id = su.id
FROM inspection_staff iss
Inner join system_users su on iss.user_id = su.id
<where>
sr.service_package_id = 'jiance' and sr.code != 'jcyh' and su.deleted = 0
su.deleted = 0
<if test="query.nickname != null and query.nickname != ''">
and su.nickname like concat('%', #{query.nickname}, '%')
</if>
@ -68,14 +66,12 @@
iss.emergency_contact_name,
iss.emergency_contact_phone,
iss.driver_license_type,
iss.folder_id
FROM system_users su
left join system_user_role sur on su.id = sur.user_id
left join system_role sr on sur.role_id = sr.id
left join inspection_staff iss on iss.user_id = su.id
iss.folder_id,
iss.unique_code
FROM inspection_staff iss
inner join system_users su on iss.user_id = su.id
<where>
sr.service_package_id = 'jiance' and sr.code != 'jcyh'
and su.id = #{id}
su.id = #{id}
</where>
</select>
<select id="getAll" resultType="cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo"

View File

@ -42,8 +42,11 @@
ON g.id = r.goods_id
AND r.deleted = 0
AND r.project_id = #{projectId}
WHERE g.deleted = 0
AND g.partner_id = #{parentId}
<where> g.deleted = 0
<if test="parentId != null">
AND g.partner_id = #{parentId}
</if>
</where>
</select>
</mapper>
</mapper>

View File

@ -50,10 +50,13 @@
<select id="listCoupon" resultType="cn.iocoder.yudao.module.shop.entity.ShopCouponTemplate">
select template.*,goods.title as bindGoodsName from shop_coupon_template template
left join shop_inspection_goods goods on goods.id = template.bind_goods_ids
where template.partner_id = #{partnerId} and bind_moudle = '检测项目现金券'
where bind_moudle = '检测项目现金券'
<if test="searchValue!=null and searchValue!=''">
and title like concat('%',#{searchValue},'%')
</if>
<if test="partnerId!=null">
and template.partner_id = #{partnerId}
</if>
order by create_time desc
</select>

View File

@ -45,17 +45,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="listPartnerGoods" parameterType="cn.iocoder.yudao.module.inspection.entity.ShopInspectionGoods" resultType="cn.iocoder.yudao.module.inspection.entity.ShopInspectionGoods">
SELECT
sig.* ,smp.partner_name,sic.category_name
sig.* ,sic.category_name
FROM
shop_inspection_goods sig
INNER JOIN shop_mall_partners smp ON smp.partner_id = sig.partner_id AND smp.is_banned = '0'
INNER JOIN shop_inspection_category sic ON sic.id = sig.goods_category_id
<where>
and sig.deleted = '0' and smp.deleted = '0' and sic.deleted = '0'
and sig.deleted = '0' and sic.deleted = '0'
<if test="vo.id != null "> and sig.id = #{vo.id}</if>
<if test="vo.title != null and vo.title != ''"> and sig.title like concat('%', #{vo.title}, '%')</if>
<if test="vo.goodsCategoryId!= null "> and sig.goods_category_id = #{vo.goodsCategoryId}</if>
<if test="vo.partnerName!= null "> and smp.partner_name like concat('%',#{vo.partnerName},'%')</if>
<if test="vo.partnerId!= null "> and sig.partner_id = #{vo.partnerId}</if>
<if test="vo.isListing != null and vo.isListing != ''">and sig.is_listing = #{vo.isListing}</if>
</where>

View File

@ -180,7 +180,7 @@ public class SysLoginController {
* @return 结果
*/
@PostMapping("/loginJcApp")
@TenantIgnore
// @TenantIgnore
public CommonResult loginJcApp(@RequestBody LoginBody loginBody) throws Exception {
String userName = loginBody.getUsername();
AdminUserDO user = userService.getUserByUsername(userName);
@ -589,6 +589,9 @@ public class SysLoginController {
Map<String, Object> map = new HashMap<>();
map.put("partnerId", user.getTenantId());
map.put("user", user);
// 查询用户表信息
AdminUserDO selectUser = userService.getUser(user.getId());
map.put("userInfo", selectUser);
return CommonResult.success(map);
}

View File

@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.system.convert.auth.AuthConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.service.ServicePackageDO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
@ -28,6 +29,7 @@ import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.service.ServicePackageService;
import cn.iocoder.yudao.module.system.service.social.SocialClientService;
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -82,6 +84,9 @@ public class AuthController {
@Resource
private ServicePackageService servicePackageService;
@Resource
private TenantService tenantService;
@PostMapping("/login")
@PermitAll
@ -273,4 +278,23 @@ public class AuthController {
return success(authService.socialLogin(reqVO));
}
/**
* 根据用户手机号查询所在的所有租户--员工登录
* @author vinjor-M
* @date 14:51 2024/10/16
* @param phone 手机号
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/getListByPhone")
@PermitAll
@Operation(summary = "根据用户手机号查询所在的所有租户--员工登录", description = "根据用户手机号查询所在的所有租户--员工登录")
public CommonResult<?> getListByPhone(@RequestParam("phone") String phone) {
List<AdminUserDO> list = userService.selectListByPhoneStaff(phone);
List<TenantDO> tenants = new ArrayList<>();
if(!list.isEmpty()){
tenants = tenantService.listByIds(list.stream().map(AdminUserDO::getTenantId).collect(Collectors.toList()));
}
return success(tenants);
}
}

View File

@ -44,4 +44,7 @@ public interface RoleMapper extends BaseMapperX<RoleDO> {
return selectList(new LambdaQueryWrapperX<RoleDO>().in(RoleDO::getCode, codes));
}
default List<RoleDO> selectListByPackageIds(@Nullable Collection<String> packageIds){
return selectList(new LambdaQueryWrapperX<RoleDO>().in(RoleDO::getServicePackageId, packageIds).eq(RoleDO::getTenantId, CommonStr.TENANT_ID));
}
}

View File

@ -259,7 +259,8 @@ public class RoleServiceImpl implements RoleService {
if (CollectionUtil.isEmpty(codes)) {
return Collections.emptyList();
}
return roleMapper.selectListByCodes(codes);
// return roleMapper.selectListByCodes(codes);
return roleMapper.selectListByPackageIds(codes);
}
/**

View File

@ -130,6 +130,8 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
// 创建租户
TenantDO tenant = BeanUtils.toBean(createReqVO, TenantDO.class);
tenantMapper.insert(tenant);
// 设置本次请求的租户id
TenantUtils.execute(tenant.getId(), () -> {});
// 创建租户的管理员
TenantUtils.execute(tenant.getId(), () -> {
// 创建角色
@ -162,7 +164,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantDO> imple
Set<Long> menuIds = permissionService.getRoleMenuListByRoleIdCus(roleDO.getId());
// 创建角色
RoleSaveReqVO reqVO = new RoleSaveReqVO();
reqVO.setName(roleDO.getName()).setCode(roleDO.getCode())
reqVO.setName(roleDO.getName()).setCode(roleDO.getCode()).setServicePackageId(roleDO.getServicePackageId())
.setSort(0).setRemark("系统自动生成");
Long roleId = roleService.createRole(reqVO, RoleTypeEnum.SYSTEM.getType());
// 分配权限