技术工具

This commit is contained in:
DB 2024-05-31 11:48:36 +08:00
parent 0528e1feaa
commit cc11addd6b
8 changed files with 116 additions and 93 deletions

3
.gitignore vendored
View File

@ -3,7 +3,8 @@ target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
**/src/main/resources/static/keyPair/*
**/src/main/resources/static/keypair/*
**/logs/*
### STS ###
.apt_generated

View File

@ -39,11 +39,12 @@ public class BackstageDutyController {
/**
* 查询值班列表(当月)
*
* @param bo 请求参数
* @return R<List<DutyListVo>>
* @return {@link R }<{@link List }<{@link DutyListVo }>>
* @author DB
* @since 2023/5/11 16:39
**/
*/
@Operation(summary = "查询值班列表(当月)")
@GetMapping("/getDutyList")
public R<List<DutyListVo>> getDutyList(DutyListBo bo) {
@ -53,11 +54,12 @@ public class BackstageDutyController {
/**
* 新增值班
*
* @param bo 请求参数
* @return R<Void>
* @return {@link R }<{@link Void }>
* @author DB
* @since 2023/5/18 9:50
**/
*/
@SaCheckPermission("dutyCalendar.duty.manage")
@Operation(summary = "新增值班")
@PostMapping("/insertDuty")
@ -68,10 +70,11 @@ public class BackstageDutyController {
/**
* 删除值班信息
*
* @param dutyDate 值班日期
* @return {@link R }<{@link Void }>
* @author DB
* @since 2023/09/14 18:16
* @param dutyDate 值班日期
* @return com.pupu.core.base.R<java.lang.Void>
*/
@Operation(summary = "删除值班信息")
@DeleteMapping("/removeDutyByDate/{dutyDate}")
@ -82,10 +85,11 @@ public class BackstageDutyController {
/**
* 查询服务员工列表
* @return R<List<OamStaffVo>>
*
* @return {@link R }<{@link List }<{@link StaffVo }>>
* @author DB
* @since 2023/5/11 17:49
**/
*/
@Operation(summary = "查询服务员工列表")
@GetMapping("/getServiceStaffList")
public R<List<StaffVo>> getServiceStaffList() {
@ -95,10 +99,11 @@ public class BackstageDutyController {
/**
* 查询技术员工列表
* @return R<PageVo<StaffPageVo>>
*
* @return {@link R }<{@link List }<{@link StaffVo }>>
* @author DB
* @since 2023/5/11 17:50
**/
*/
@Operation(summary = "查询技术员工列表")
@GetMapping("/getTechnologyStaffList")
public R<List<StaffVo>> getTechnologyStaffList() {

View File

@ -5,10 +5,10 @@ import com.cpop.oam.business.bo.TaskDemandBo;
import com.cpop.oam.business.bo.TaskDemandPageBo;
import com.cpop.oam.business.bo.TaskDemandUrgentBo;
import com.cpop.oam.business.service.TaskDemandService;
import com.cpop.oam.business.vo.BrandListVo;
import com.cpop.oam.business.vo.StoreListVo;
import com.cpop.oam.business.vo.TaskDemandPageVo;
import com.cpop.oam.business.vo.TaskDemandUrgentVo;
import com.cpop.oam.business.vo.BrandListVo;
import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.row.DbChain;
@ -20,7 +20,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import static com.cpop.oam.business.entity.table.BrandTableDef.BRAND;
import static com.cpop.oam.business.entity.table.StoreTableDef.STORE;
@ -100,15 +99,10 @@ public class BackstageTaskDemandController {
@Operation(summary = "工单模块-工单提交-获取品牌列表")
@GetMapping("/getBrandList")
public R<List<BrandListVo>> getBrandList(@Parameter(description = "品牌名") String brandName) {
AtomicReference<List<BrandListVo>> list = new AtomicReference<>();
try {
DataSourceKey.use("jambox", () -> {
list.set(DbChain.table(BRAND).and(BRAND.BRAND_NAME.like(brandName)).listAs(BrandListVo.class));
});
} finally {
DataSourceKey.clear();
}
return R.ok(list.get());
List<BrandListVo> list = DataSourceKey.use("jambox", () -> {
return DbChain.table(BRAND).and(BRAND.BRAND_NAME.like(brandName)).listAs(BrandListVo.class);
});
return R.ok(list);
}
/**
@ -120,15 +114,10 @@ public class BackstageTaskDemandController {
@Operation(summary = "工单模块-工单提交-获取校区/店铺列表")
@GetMapping("/getStoreList")
public R<List<StoreListVo>> getStoreList(@Parameter(description = "品牌id") String brandId) {
AtomicReference<List<StoreListVo>> list = new AtomicReference<>();
try {
DataSourceKey.use("jambox", () -> {
list.set(DbChain.table(STORE).and(STORE.BRAND_ID.like(brandId)).listAs(StoreListVo.class));
});
} finally {
DataSourceKey.clear();
}
return R.ok(list.get());
List<StoreListVo> list = DataSourceKey.use("jambox", () -> {
return DbChain.table(STORE).and(STORE.BRAND_ID.like(brandId)).listAs(StoreListVo.class);
});
return R.ok(list);
}
/**

View File

@ -17,36 +17,38 @@ import java.util.List;
public interface DutyService extends IService<Duty> {
/**
* @Description: 查询值班列表(当月)
* 获取值班列表
*
* @param bo 请求参数
* @return: R<List<DutyListVo>>
* @Author: DB
* @Date: 2023/5/11 16:39
**/
* @return {@link List }<{@link DutyListVo }>
* @author DB
* @since 2024/05/30
*/
List<DutyListVo> getDutyList(DutyListBo bo);
/**
* @Description: 新增值班
* 新增值班
*
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/18 9:50
**/
* @author DB
* @since 2024/05/30
*/
void insertDuty(DutyBo bo);
/**
* @descriptions 删除值班信息
* @author DB
* @date 2023/09/14 18:16
* 删除值班信息
*
* @param dutyDate 值班日期
* @author DB
* @since 2024/05/30
*/
void removeDutyByDate(String dutyDate);
/**
* @descriptions 每天9点通知值班人员
* 每天9点通知值班人员
*
* @author DB
* @date 2023/11/22 18:09
* @return: void
* @since 2024/05/30
*/
void dutyNotice();
}

View File

@ -45,12 +45,13 @@ public class DutyServiceImpl extends ServiceImpl<DutyMapper, Duty> implements Du
private WebHookSendHandler webHookSendHandler;
/**
* @Description: 查询值班列表(当月)
* 查询值班列表(当月)
*
* @param bo 请求参数
* @return: R<List<DutyListVo>>
* @Author: DB
* @Date: 2023/5/11 16:39
**/
* @return {@link List }<{@link DutyListVo }>
* @author DB
* @since 2024/05/30
*/
@Override
public List<DutyListVo> getDutyList(DutyListBo bo) {
//默认查询当月
@ -97,12 +98,12 @@ public class DutyServiceImpl extends ServiceImpl<DutyMapper, Duty> implements Du
}
/**
* @Description: 新增值班
* 新增值班
*
* @param bo 请求参数
* @return: R<Void>
* @Author: DB
* @Date: 2023/5/18 9:50
**/
* @author DB
* @since 2024/05/30
*/
@Override
public void insertDuty(DutyBo bo) {
//开始日期结束日期
@ -128,10 +129,11 @@ public class DutyServiceImpl extends ServiceImpl<DutyMapper, Duty> implements Du
}
/**
* @descriptions 删除值班信息
* @author DB
* @date 2023/09/14 18:16
* 删除值班信息
*
* @param dutyDate 值班日期
* @author DB
* @since 2024/05/30
*/
@Override
public void removeDutyByDate(String dutyDate) {
@ -139,10 +141,10 @@ public class DutyServiceImpl extends ServiceImpl<DutyMapper, Duty> implements Du
}
/**
* @descriptions 每天9点通知值班人员
* 每天9点通知值班人员
*
* @author DB
* @date 2023/11/22 18:10
* @return: void
* @since 2024/05/30
*/
@Override
public void dutyNotice() {

View File

@ -180,7 +180,17 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
//设置菜单名
if (StrUtil.isNotBlank(bo.getPath())){
String[] split = bo.getPath().split("/");
String name = StrUtil.upperFirst(split[split.length - 1].replace("/", ""));
String toUpperCaseString = split[split.length - 1];
if (toUpperCaseString.contains(":")) {
toUpperCaseString = split[split.length - 2];
}
if (toUpperCaseString.contains("-")){
toUpperCaseString = StrUtil.toCamelCase(toUpperCaseString, '-');
}
if (toUpperCaseString.contains("-")){
toUpperCaseString = StrUtil.toCamelCase(toUpperCaseString, '-');
}
String name = StrUtil.upperFirst(toUpperCaseString);
//名字不能重复
long count = this.count(QueryWrapper.create().where(MENU.NAME.eq(name)).and(MENU.USER_TYPE.eq(session.get("userType"))));
if (count > 0) {
@ -215,6 +225,9 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
if (toUpperCaseString.contains(":")) {
toUpperCaseString = split[split.length - 2];
}
if (toUpperCaseString.contains("-")){
toUpperCaseString = StrUtil.toCamelCase(toUpperCaseString, '-');
}
String name = StrUtil.upperFirst(toUpperCaseString.replace("/", ""));
//名字不能重复
long count = this.count(QueryWrapper.create().where(MENU.NAME.eq(name)).and(MENU.USER_TYPE.eq(StpUtil.getSession().get("userType"))));

View File

@ -7,7 +7,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
import com.cpop.core.base.entity.PageDomain;
import com.cpop.core.base.enums.UserType;
import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.base.table.Config;
import com.cpop.core.constant.Constants;
@ -28,8 +27,11 @@ import com.cpop.oam.business.vo.TaskDemandPageVo;
import com.cpop.oam.business.vo.TaskDemandUrgentVo;
import com.cpop.oam.framework.constant.WebHookKeyConstant;
import com.cpop.oam.framework.enums.OamConfigEnum;
import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.DbChain;
import com.mybatisflex.core.row.Row;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.stereotype.Service;
@ -66,43 +68,60 @@ public class TaskDemandServiceImpl extends ServiceImpl<TaskDemandMapper, TaskDem
public Page<TaskDemandPageVo> getTaskDemandPage(TaskDemandPageBo bo) {
// 分页主体应该是任务
QueryWrapper queryWrapper = QueryWrapper.create();
//任务状态
if (null != bo.getTaskStatus()) {
switch (bo.getTaskStatus()) {
case 10:
case 10 -> {
queryWrapper.and(TASK.TASK_STATUS.eq(10));
break;
}
// 待评估
case 0:
case 0 -> {
queryWrapper.and(TASK.TASK_STATUS.eq(0));
break;
}
// 待领取
case 1:
case 1 -> {
queryWrapper.and(TASK.TASK_STATUS.in(1));
break;
}
// 处理中
case 2:
case 2 -> {
queryWrapper.and(TASK.TASK_STATUS.in(2, 4));
break;
}
// 已完成
default:
default -> {
queryWrapper.and(TASK.TASK_STATUS.in(8, 9));
}
}
} else {
queryWrapper.and(TASK.TASK_STATUS.eq(0));
}
//如果品牌名或者校区名不为空
if (StrUtil.isNotBlank(bo.getBrandOrStore())){
List<String> brandOrStoreIds = new ArrayList<>();
DataSourceKey.use("jambox", () -> {
//查询品牌或校区id
List<Row> brandList = DbChain.table(BRAND).select(BRAND.ID).from(BRAND).where(BRAND.BRAND_NAME.likeLeft(bo.getBrandOrStore())).list();
if (!brandList.isEmpty()){
brandOrStoreIds.addAll(brandList.stream().map(row -> row.getString("id")).toList());
}
List<Row> storeList = DbChain.table(STORE).select(STORE.ID).from(STORE).where(STORE.STORE_NAME.likeLeft(bo.getBrandOrStore())).list();
if (!storeList.isEmpty()){
brandOrStoreIds.addAll(storeList.stream().map(row -> row.getString("id")).toList());
}
if (!brandOrStoreIds.isEmpty()){
queryWrapper.and(TASK_DEMAND.BRAND_ID.in(brandOrStoreIds).or(TASK_DEMAND.STORE_ID.in(brandOrStoreIds)));
}
});
}
// 重新定义列表
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
return this.mapper.paginateAs(Page.of(pageDomain.getPage(), pageDomain.getPageSize()), queryWrapper
//任务需求
.select(TASK_DEMAND.ID,
TASK_DEMAND.BRAND_ID,
TASK_DEMAND.STORE_ID,
TASK_DEMAND.CREATE_TIME,
TASK_DEMAND.UPDATE_USER_ID,
TASK_DEMAND.UPDATE_TIME)
// 品牌
.select(BRAND.BRAND_NAME)
// 校区
.select(STORE.STORE_NAME)
// 任务
.select(TASK.TASK_CONTENT,
TASK.RECORD_STAFF_ID,
@ -119,12 +138,6 @@ public class TaskDemandServiceImpl extends ServiceImpl<TaskDemandMapper, TaskDem
// 任务需求表
.leftJoin(TASK)
.on(TASK.ID.eq(TASK_DEMAND.TASK_ID))
// 校区表
.leftJoin(STORE)
.on(STORE.ID.eq(TASK_DEMAND.STORE_ID))
// 品牌表
.leftJoin(BRAND)
.on(BRAND.ID.eq(TASK_DEMAND.BRAND_ID))
.where(TASK.TASK_TYPE.eq(1))
.and(TASK.TASK_CONTENT.like(bo.getTaskContent()))
.and(STORE.STORE_NAME.like(bo.getBrandOrStore()).or(BRAND.BRAND_NAME.like(bo.getBrandOrStore()))),
@ -142,9 +155,7 @@ public class TaskDemandServiceImpl extends ServiceImpl<TaskDemandMapper, TaskDem
.from(STAFF)
.leftJoin(USER)
.on(USER.ID.eq(STAFF.USER_ID))
.where(USER.ID.eq(updateStaffName.getUpdateUserId()))
.and(USER.USER_TYPE.eq(UserType.OAM_USER.toString()))
.limit(1)),
.where(USER.ID.eq(updateStaffName.getUpdateUserId()))),
// 任务接收员工
item -> item.field(TaskDemandPageVo::getResponsibleStaffName).queryWrapper(responsibleStaffName -> {
if (StrUtil.isNotBlank(responsibleStaffName.getResponsibleStaffId())) {

View File

@ -824,15 +824,15 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
// 任务
.select(TASK.TASK_CONTENT, TASK.TASK_STATUS, TASK.TASK_RECEIPT_TIME, TASK.RECORD_STAFF_ID)
// 品牌
.select(BRAND.BRAND_NAME)
//.select(BRAND.BRAND_NAME)
// 校区
.select(STORE.STORE_NAME)
//.select(STORE.STORE_NAME)
.leftJoin(TASK)
.on(TASK.ID.eq(TASK_WORK_ORDER.TASK_ID))
.leftJoin(BRAND)
.on(BRAND.ID.eq(TASK_WORK_ORDER.BRAND_ID))
.leftJoin(STORE)
.on(STORE.ID.eq(TASK_WORK_ORDER.STORE_ID))
//.leftJoin(BRAND)
//.on(BRAND.ID.eq(TASK_WORK_ORDER.BRAND_ID))
//.leftJoin(STORE)
//.on(STORE.ID.eq(TASK_WORK_ORDER.STORE_ID))
.where(TASK.TASK_STATUS.in(1, 2, 4, 5, 7)),
TaskWorkOrderPersonVo.class,
// 提交人