1、驾驶员白名单关联计划

2、增加分管领导审核
This commit is contained in:
hayu 2025-05-20 10:08:55 +08:00
parent d0805510da
commit 8d62c554c4
14 changed files with 200 additions and 61 deletions

View File

@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.bonus.gzcar.business.backstage.entity.CarCarVo;
import com.bonus.gzcar.business.backstage.entity.CarContractSupCarExportVo;
import com.bonus.gzcar.business.backstage.entity.CarDriverVo;
import com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo;
import com.bonus.gzcar.business.backstage.service.CarDriverService;
import com.bonus.gzcar.business.utils.ExportExcelUtil;
import com.bonus.gzcar.manager.annotation.DecryptAndVerify;
@ -66,6 +67,19 @@ public class CarDriverController {
return pageInfo;
}
/**
* 驾驶员关联需求计划
* @param dto
* @return
*/
@GetMapping("getRePlan")
@DecryptAndVerify(decryptedClass = CarNeedPlanVo.class)
public PageInfo<CarNeedPlanVo> getRePlan(EncryptedReq<CarNeedPlanVo> dto) {
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
List<CarNeedPlanVo> list = service.getRePlan(dto.getData());;
return new PageInfo<>(list);
}
/**
* 导出需求计划
* @param

View File

@ -67,4 +67,9 @@ public class CarDriverVo extends ParentVo {
*/
private String delTypes;
/**
* 数量
*/
private int num;
}

View File

@ -1,6 +1,7 @@
package com.bonus.gzcar.business.backstage.mapper;
import com.bonus.gzcar.business.backstage.entity.CarDriverVo;
import com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -59,4 +60,10 @@ public interface CarDriverMapper {
*/
List<CarDriverVo> getDriverListBySup(CarDriverVo data);
/**
* 驾驶员关联需求计划
* @param data
* @return
*/
List<CarNeedPlanVo> getRePlan(CarNeedPlanVo data);
}

View File

@ -164,4 +164,11 @@ public interface DispatchCarMapper {
* @param data
*/
void updatePlanData(CarNeedPlanVo data);
/**
* 查询审核记录
* @param data
* @return
*/
List<CarPlanOutVo> getAuditListNew(CarPlanOutVo data);
}

View File

@ -2,6 +2,7 @@ package com.bonus.gzcar.business.backstage.service;
import com.bonus.gzcar.business.backstage.entity.CarDriverVo;
import com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo;
import com.bonus.gzcar.manager.webResult.ServerResponse;
import org.springframework.web.multipart.MultipartFile;
@ -70,4 +71,10 @@ public interface CarDriverService {
*/
ServerResponse getDriverImageList(CarDriverVo data);
/**
* 驾驶员关联需求计划
* @param data
* @return
*/
List<CarNeedPlanVo> getRePlan(CarNeedPlanVo data);
}

View File

@ -4,6 +4,7 @@ import cn.afterturn.easypoi.cache.manager.IFileLoader;
import com.alibaba.fastjson.JSON;
import com.bonus.gzcar.business.backstage.entity.CarCarVo;
import com.bonus.gzcar.business.backstage.entity.CarDriverVo;
import com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo;
import com.bonus.gzcar.business.backstage.mapper.CarDriverMapper;
import com.bonus.gzcar.business.system.entity.FileUploadVo;
import com.bonus.gzcar.business.system.service.FileUploadService;
@ -362,5 +363,15 @@ public class CarDriverServiceImpl implements CarDriverService{
return ServerResponse.createSuccess(list);
}
@Override
public List<CarNeedPlanVo> getRePlan(CarNeedPlanVo data) {
try{
return mapper.getRePlan(data);
}catch (Exception e){
log.error(e.toString(),e);
}
return new ArrayList<>();
}
}

View File

@ -11,6 +11,8 @@ import com.bonus.gzcar.business.utils.ListHelpUtil;
import com.bonus.gzcar.manager.common.util.DateTimeHelper;
import com.bonus.gzcar.manager.common.util.RedisService;
import com.bonus.gzcar.manager.common.util.StringHelper;
import com.bonus.gzcar.manager.common.util.UserUtil;
import com.bonus.gzcar.manager.security.entity.SelfUserEntity;
import com.bonus.gzcar.manager.webResult.ServerResponse;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
@ -239,54 +241,83 @@ public class DispatchCarServiceImpl implements DispatchCarService{
* 车辆配送=-审核
* @param data
* @return
* 2025-05-16增加分管领导审核
*/
@Override
public ServerResponse dispatchAudit(CarPlanOutVo data) {
try{
String status=data.getStatus();
String remark=data.getRemark();
CarPlanOutVo vo=mapper.getCarPlanOut(data);
if(!"0".equals(vo.getStatus())){
return ServerResponse.createErroe("该计划已被审核,请刷新后重试");
}
CarNeedPlanVo carNeedPlanVo=mapper.getPlanInfo(data);
//审核驳回
if("2".equals(status)){
int num= mapper.updateDispatchData(data);
if(num>0){
List<CarPlanOutVo> list=mapper.getAuditList(data);
if(ListHelpUtil.isEmpty(list)){
carNeedPlanVo.setStatus(2);
}else{
carNeedPlanVo.setStatus(0);
try {
//获取用户信息
SelfUserEntity loginUser = UserUtil.getLoginUser();
String status = data.getStatus();
String remark = data.getRemark();
CarPlanOutVo vo = mapper.getCarPlanOut(data);
CarNeedPlanVo carNeedPlanVo = mapper.getPlanInfo(data);
if ("娄强".equals(loginUser.getRoleName())) {
if (!"3".equals(vo.getStatus())) {
return ServerResponse.createErroe("还未到您审核,请刷新后重试");
} else {
if ("2".equals(status)) {
//驳回
int num = mapper.updateDispatchData(data);
if (num > 0) {
List<CarPlanOutVo> list = mapper.getAuditList(data);
if (ListHelpUtil.isEmpty(list)) {
carNeedPlanVo.setStatus(2);
} else {
carNeedPlanVo.setStatus(0);
}
//更新计划状态
mapper.updatePlanInfo(carNeedPlanVo);
}
} else {
//通过
int num = mapper.updateDispatchData(data);
if (num > 0) {
List<CarPlanOutVo> list = mapper.getAuditList(data);
int dispatchNum = carNeedPlanVo.getDispatchNum();
carNeedPlanVo.setDispatchDay(DateTimeHelper.getNowDay());
carNeedPlanVo.setDispatchNum(dispatchNum + vo.getDispatchNum());
if (ListHelpUtil.isEmpty(list)) {
carNeedPlanVo.setStatus(1);
} else {
carNeedPlanVo.setStatus(2);
}
//更新计划信息
mapper.updateCarPlanInfo(carNeedPlanVo);
}
}
//更新计划状态
mapper.updatePlanInfo(carNeedPlanVo);
}
}else{
int num= mapper.updateDispatchData(data);
if(num>0){
List<CarPlanOutVo> list=mapper.getAuditList(data);
int dispatchNum=carNeedPlanVo.getDispatchNum();
carNeedPlanVo.setDispatchDay(DateTimeHelper.getNowDay());
carNeedPlanVo.setDispatchNum(dispatchNum+vo.getDispatchNum());
if(ListHelpUtil.isEmpty(list)){
carNeedPlanVo.setStatus(1);
}else{
carNeedPlanVo.setStatus(2);
} else {
if (!"0".equals(vo.getStatus())) {
return ServerResponse.createErroe("待分管领导审核,请刷新后重试");
} else {
if ("2".equals(status)) {
//驳回
int num = mapper.updateDispatchData(data);
if (num > 0) {
List<CarPlanOutVo> list = mapper.getAuditList(data);
if (ListHelpUtil.isEmpty(list)) {
carNeedPlanVo.setStatus(2);
} else {
carNeedPlanVo.setStatus(0);
}
//更新计划状态
mapper.updatePlanInfo(carNeedPlanVo);
}
} else {
//通过,只修改状态
data.setStatus("3");
int num = mapper.updateDispatchData(data);
}
//更新计划信息
mapper.updateCarPlanInfo(carNeedPlanVo);
}
}
String uptime=recordService.getUpTimes("out-"+data.getId(),Integer.parseInt(status));
recordService.addRecord("out-"+data.getId(),status,"2","3",remark,uptime);
return ServerResponse.createBySuccessMsg("审核成功");
}catch (Exception e){
log.error(e.toString(),e);
String uptime = recordService.getUpTimes("out-" + data.getId(), Integer.parseInt(status));
recordService.addRecord("out-" + data.getId(), status, "2", "3", remark, uptime);
return ServerResponse.createBySuccessMsg("审核成功");
} catch (Exception e) {
log.error(e.toString(), e);
}
return ServerResponse.createErroe("审核失败,请稍后重试");
return ServerResponse.createErroe("审核失败,请稍后重试");
}
@ -297,7 +328,7 @@ public class DispatchCarServiceImpl implements DispatchCarService{
@Override
public ServerResponse getAuditList(CarPlanOutVo data) {
try{
List<CarPlanOutVo> list=mapper.getAuditList(data);
List<CarPlanOutVo> list=mapper.getAuditListNew(data);
return ServerResponse.createSuccess(list);
}catch (Exception e){
log.error(e.toString(),e);

View File

@ -43,6 +43,11 @@ public class SysUserEntity implements Serializable {
*/
private String roleId;
/**
* 角色名
*/
private String roleName;
private String companyId;
private String salt;

View File

@ -37,6 +37,11 @@ public class UserVo {
*/
private String roleId;
/**
* 角色名
*/
private String roleName;
/**
* 是否首次登录
*/

View File

@ -45,6 +45,11 @@ public class SelfUserEntity implements Serializable, UserDetails {
*/
private String roleId;
/**
* 角色名
*/
private String roleName;
/**
* 状态:NORMAL正常 PROHIBIT禁用
*/

View File

@ -41,6 +41,7 @@ public class UserLoginSuccessHandler implements AuthenticationSuccessHandler {
BeanUtils.copyProperties(loginUser, userVo);
userVo.setId(loginUser.getUserId());
userVo.setRoleId(loginUser.getRoleId());
userVo.setRoleName(loginUser.getRoleName());
userVo.setOrgId(loginUser.getOrgId());
userVo.setCompanyId(loginUser.getCompanyId());
Map<String, Object> map = new HashMap<>(2);

View File

@ -47,32 +47,41 @@
ORDER BY cdi.create_time desc
</select>
<select id="getDriverPageWhiteList" resultType="com.bonus.gzcar.business.backstage.entity.CarDriverVo">
select cdi.id, cdi.name, cdi.phone, cdi.sup_id supId,file1.num sfzNum,file2.num jszNum,file3.num otherNum,cs.name supName,cdi.is_white as isWhiteList
SELECT
a.*,
COUNT(DISTINCT cpod.apply_id) AS num
FROM
(
select cdi.id, cdi.name, cdi.phone, cdi.sup_id supId,file1.num sfzNum,file2.num jszNum,file3.num
otherNum,cs.name supName,cdi.is_white as isWhiteList
from car_driver_info cdi
left join car_supplier cs on cs.id=cdi.sup_id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_driver_info' AND type in(2,3)
GROUP BY own_id
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_driver_info' AND type in(2,3)
GROUP BY own_id
)file1 on file1.id=cdi.id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_driver_info' AND type in(4,5)
GROUP BY own_id
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_driver_info' AND type in(4,5)
GROUP BY own_id
)file2 on file2.id=cdi.id
left join(
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_driver_info' AND type=6
GROUP BY own_id
SELECT count(1) num ,own_id id,type from bm_file_upload
where model_table='car_driver_info' AND type=6
GROUP BY own_id
)file3 on file3.id=cdi.id
where cdi.is_active=1 and cdi.is_white=1
where cdi.is_active=1 and cdi.is_white=1
<if test="name!=null and name!=''">
and cdi.name like concat('%',#{name},'%')
and cdi.name like concat('%',#{name},'%')
</if>
<if test="supName!=null and supName!=''">
and cs.name like concat('%',#{supName},'%')
and cs.name like concat('%',#{supName},'%')
</if>
ORDER BY cdi.create_time desc
ORDER BY cdi.create_time desc
) a
LEFT JOIN car_plan_out_details cpod on cpod.driver_id=a.id
GROUP BY a.id
</select>
<select id="getDriverDetails" resultType="com.bonus.gzcar.business.backstage.entity.CarDriverVo">
select cdi.id, cdi.name, cdi.phone, cdi.sup_id supId,cs.name supName,cdi.is_white as isWhiteList
@ -97,4 +106,28 @@
</if>
</if>
</select>
<select id="getRePlan" resultType="com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo">
SELECT cpa.id,
cpa.`code`,
bp.ID as proId,
bp.`NAME` as proName,
CASE
cpa.type
WHEN 1 THEN
'运输车辆'
WHEN 2 THEN
'吊车'
ELSE ''
END typeName,
cpa.user_name userName,
DATE_FORMAT(cpa.create_time, '%Y-%m-%d') appLyTime,
cpa.remark
FROM (SELECT cpod.apply_id AS applyId
FROM car_plan_out_details cpod
WHERE cpod.driver_id = #{id}
GROUP BY cpod.apply_id) a
LEFT JOIN car_plan_apply cpa ON cpa.id = a.applyId
LEFT JOIN bm_project bp on bp.ID = cpa.pro_id
</select>
</mapper>

View File

@ -170,6 +170,11 @@
FROM car_plan_out
WHERE status=0 AND apply_id=#{planId}
</select>
<select id="getAuditListNew" resultType="com.bonus.gzcar.business.backstage.entity.CarPlanOutVo">
select id,status,type
FROM car_plan_out
WHERE apply_id=#{planId} AND (status=0 or status=3)
</select>
<select id="getPlanInfo" resultType="com.bonus.gzcar.business.backstage.entity.CarNeedPlanVo">
select dispatch_num dispatchNum,id,need_num needNum
FROM car_plan_apply
@ -241,5 +246,4 @@
where id=#{id}
</select>
</mapper>

View File

@ -4,14 +4,18 @@
<mapper namespace="com.bonus.gzcar.manager.core.dao.SysUserDao">
<!--查询用户-->
<select id="selectUserByName" resultType="com.bonus.gzcar.manager.core.entity.SysUserEntity">
SELECT t.ID AS userId,
t.NAME ,
t.SALT salt,
SELECT t.ID AS userId,
t.NAME,
t.SALT salt,
t.LOGIN_NAME username,
t.ORG_ID orgId,
t.ORG_ID orgId,
pr.`NAME` as roleName,
t.COMPANY_ID companyId,
t.PASSWD password
t.PASSWD password
FROM pm_user t
WHERE t.LOGIN_NAME = #{username} AND IS_ACTIVE = 1
LEFT JOIN pm_user_role pur on pur.USER_ID = t.ID
LEFT JOIN pm_role pr on pr.ID = pur.ROLE_ID and pr.IS_ACTIVE = 1
WHERE t.LOGIN_NAME = #{username}
AND t.IS_ACTIVE = 1
</select>
</mapper>