Compare commits
No commits in common. "dev" and "dev-erp" have entirely different histories.
@ -8,7 +8,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@ -32,25 +34,8 @@ public class BpmOAEvectionApiImpl implements BpmOAEvectionApi {
|
||||
List<BpmOAEvectionDO> evectionOff = evectionService.getEvectionListByEndTime(now.minusDays(1));
|
||||
|
||||
Map<String, List<Long>> result = new HashMap<>();
|
||||
result.put("on", evectionOn.stream().flatMap(item -> {
|
||||
Set<Long> togetherUserIds = item.getTogetherUserIds();
|
||||
List<Long> ids = new ArrayList<>();
|
||||
ids.add(item.getUserId());
|
||||
if (togetherUserIds != null) {
|
||||
ids.addAll(togetherUserIds); // 将 Set 转换为 List 并添加进去
|
||||
}
|
||||
return ids.stream();
|
||||
}).distinct().collect(Collectors.toList()));
|
||||
result.put("off", evectionOff.stream().flatMap(item -> {
|
||||
Set<Long> togetherUserIds = item.getTogetherUserIds();
|
||||
List<Long> ids = new ArrayList<>();
|
||||
ids.add(item.getUserId());
|
||||
if (togetherUserIds != null) {
|
||||
ids.addAll(togetherUserIds); // 将 Set 转换为 List 并添加进去
|
||||
}
|
||||
return ids.stream();
|
||||
}).distinct().collect(Collectors.toList()));
|
||||
|
||||
result.put("on", evectionOn.stream().map(BpmOAEvectionDO::getUserId).distinct().collect(Collectors.toList()));
|
||||
result.put("off", evectionOff.stream().map(BpmOAEvectionDO::getUserId).distinct().collect(Collectors.toList()));
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
|
@ -75,8 +75,8 @@ public class BpmOAContractController {
|
||||
Map<Long, AdminUserRespDTO> userMap = userApi.getUserMap(userIds);
|
||||
if (CollectionUtil.isNotEmpty(userMap)) {
|
||||
// 设置创建人、签约人名称
|
||||
respVO.setSignatoryName(userMap.get(contract.getSignatoryId()) != null ? userMap.get(contract.getSignatoryId()).getNickname() : null);
|
||||
respVO.setCreateName(userMap.get(contract.getUserId()) != null ? userMap.get(contract.getUserId()).getNickname() : null);
|
||||
respVO.setSignatoryName(userMap.get(contract.getSignatoryId()).getNickname());
|
||||
respVO.setCreateName(userMap.get(contract.getUserId()).getNickname());
|
||||
}
|
||||
|
||||
// 获取公司信息
|
||||
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.evection.BpmOAEvectionCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.evection.BpmOAEvectionRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAEvectionConvert;
|
||||
@ -66,15 +65,6 @@ public class BpmOAEvectionController {
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/get-list")
|
||||
@Operation(summary = "获得我的出差申请")
|
||||
public CommonResult<List<BpmOAEvectionRespVO>> getEvectionList() {
|
||||
|
||||
List<BpmOAEvectionDO> evections = evectionService.getEvectionList();
|
||||
|
||||
return success(BeanUtils.toBean(evections, BpmOAEvectionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@Operation(summary = "获得出差申请")
|
||||
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
|
||||
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.expenses.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAExpensesDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAExpensesService;
|
||||
@ -63,7 +62,6 @@ public class BpmOAExpensesController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产开支申请分页")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<PageResult<BpmOAExpensesPageRespVO>> getExpensesPage(BpmOAExpensesPageReqVO pageReqVO) {
|
||||
|
||||
PageResult<BpmOAExpensesPageRespVO> respVO = expensesService.getExpensesPage(pageReqVO);
|
||||
@ -72,7 +70,6 @@ public class BpmOAExpensesController {
|
||||
|
||||
@GetMapping("/total")
|
||||
@Operation(summary = "获得开支金额统计")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<BpmOAExpensesTotal> getExpensesTotal(BpmOAExpensesPageReqVO pageReqVO) {
|
||||
|
||||
return success(expensesService.getExpensesTotal(pageReqVO));
|
||||
@ -101,7 +98,6 @@ public class BpmOAExpensesController {
|
||||
@GetMapping("/oneClickPayment")
|
||||
@Operation(summary = "一键支付")
|
||||
@Parameter(name = "month", description = "月份", required = true, example = "2025-04")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<Boolean> oneClickPayment(String month) {
|
||||
|
||||
expensesService.oneClickPayment(month);
|
||||
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOARei
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAReimbursementService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -38,9 +37,6 @@ public class BpmOAReimbursementController {
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
// @PreAuthorize("@ss.hasPermission('bpm:oa-reimbursement:create')")
|
||||
@Operation(summary = "创建请求申请")
|
||||
@ -56,17 +52,11 @@ public class BpmOAReimbursementController {
|
||||
|
||||
BpmOAReimbursementDO reimbursement = service.getReimbursement(id);
|
||||
BpmOAReimbursementRespVO respVO = service.convert(reimbursement);
|
||||
if (respVO != null) {
|
||||
if (StringUtil.isNotEmpty(respVO.getProjectNo())) {
|
||||
if (respVO != null && StringUtil.isNotEmpty(respVO.getProjectNo())) {
|
||||
// 设置项目名称
|
||||
ProjectDTO projectDTO = projectApi.getProject(respVO.getProjectNo()).getCheckedData();
|
||||
respVO.setProjectName(projectDTO.getName());
|
||||
}
|
||||
if (respVO.getPaymentCompany() != null) {
|
||||
// 设置付款公司名称
|
||||
respVO.setPaymentCompanyName(deptApi.getDept(respVO.getPaymentCompany()).getCheckedData().getName());
|
||||
}
|
||||
}
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@ -92,17 +82,11 @@ public class BpmOAReimbursementController {
|
||||
|
||||
BpmOAReimbursementDO reimbursement = service.getByProcessInstanceId(processInstanceId);
|
||||
BpmOAReimbursementRespVO respVO = service.convert(reimbursement);
|
||||
if (respVO != null) {
|
||||
if (StringUtil.isNotEmpty(respVO.getProjectNo())) {
|
||||
if (respVO != null && StringUtil.isNotEmpty(respVO.getProjectNo())) {
|
||||
// 设置项目名称
|
||||
ProjectDTO projectDTO = projectApi.getProject(respVO.getProjectNo()).getCheckedData();
|
||||
respVO.setProjectName(projectDTO.getName());
|
||||
}
|
||||
if (respVO.getPaymentCompany() != null) {
|
||||
// 设置付款公司名称
|
||||
respVO.setPaymentCompanyName(deptApi.getDept(respVO.getPaymentCompany()).getCheckedData().getName());
|
||||
}
|
||||
}
|
||||
return success(respVO);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.salary.BpmOASalaryCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.salary.BpmOASalaryRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOASalaryConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOASalaryDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOASalaryService;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -18,10 +16,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
@ -44,9 +38,6 @@ public class BpmOASalaryController {
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
private FactoryInfoApi factoryInfoApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建请求申请")
|
||||
public CommonResult<Long> createSalary(@Valid @RequestBody BpmOASalaryCreateReqVO createReqVO) {
|
||||
@ -68,24 +59,12 @@ public class BpmOASalaryController {
|
||||
return success(new BpmOASalaryRespVO());
|
||||
}
|
||||
|
||||
BpmOASalaryRespVO respVO = BeanUtils.toBean(salary, BpmOASalaryRespVO.class);
|
||||
if (salary.getCompanyDeptId() != null) {
|
||||
// 获取部门详情
|
||||
DeptRespDTO dto = getDept(salary.getCompanyDeptId());
|
||||
|
||||
respVO.setCompanyName(dto.getName());
|
||||
}else {
|
||||
// 获取工厂信息
|
||||
Set<Long> factoryIds = salary.getFactoryDeptId();
|
||||
List<FactoryInfoDTO> factoryInfoDTOS = factoryInfoApi.getFactoryInfoList(factoryIds).getCheckedData();
|
||||
|
||||
String factoryNames = factoryInfoDTOS.stream()
|
||||
.map(FactoryInfoDTO::getShortName)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
respVO.setCompanyName(factoryNames);
|
||||
}
|
||||
BpmOASalaryRespVO respVO = BpmOASalaryConvert.INSTANCE.convert(salary)
|
||||
.setCompanyName(dto.getName())
|
||||
.setFactoryId(dto.getFactoryId());
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
@ -97,28 +76,12 @@ public class BpmOASalaryController {
|
||||
|
||||
BpmOASalaryDO salary = salaryService.getByProcessInstanceId(processInstanceId);
|
||||
|
||||
if (salary == null) {
|
||||
return success(new BpmOASalaryRespVO());
|
||||
}
|
||||
|
||||
BpmOASalaryRespVO respVO = BeanUtils.toBean(salary, BpmOASalaryRespVO.class);
|
||||
if (salary.getCompanyDeptId() != null) {
|
||||
// 获取部门详情
|
||||
DeptRespDTO dto = getDept(salary.getCompanyDeptId());
|
||||
|
||||
respVO.setCompanyName(dto.getName());
|
||||
}else {
|
||||
// 获取工厂信息
|
||||
Set<Long> factoryIds = salary.getFactoryDeptId();
|
||||
List<FactoryInfoDTO> factoryInfoDTOS = factoryInfoApi.getFactoryInfoList(factoryIds).getCheckedData();
|
||||
|
||||
String factoryNames = factoryInfoDTOS.stream()
|
||||
.map(FactoryInfoDTO::getShortName)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
respVO.setCompanyName(factoryNames);
|
||||
}
|
||||
BpmOASalaryRespVO respVO = BpmOASalaryConvert.INSTANCE.convert(salary)
|
||||
.setCompanyName(dto.getName())
|
||||
.setFactoryId(dto.getFactoryId());
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
@ -26,7 +26,4 @@ public class BpmOAPaymentPageReqVO extends PageParam {
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] createTime;
|
||||
|
||||
@Schema(description = "申请人用户编号")
|
||||
private Long userId;
|
||||
}
|
||||
|
@ -24,9 +24,6 @@ public class BpmOAReimbursementCreateReqVO {
|
||||
@Schema(description = "开户行信息")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "付款公司")
|
||||
private Long paymentCompany;
|
||||
|
||||
@Schema(description = "报销项目明细", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销项目不能为空")
|
||||
private List<Reimbursement> reimbursements;
|
||||
@ -52,9 +49,6 @@ public class BpmOAReimbursementCreateReqVO {
|
||||
@Schema(description = "备用金差额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal difference ;
|
||||
|
||||
@Schema(description = "业务表编号")
|
||||
private Long objectId;
|
||||
|
||||
@Schema(description = "报销发票总数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销发票总数不能为空")
|
||||
private Integer totalQuantity ;
|
||||
|
@ -27,12 +27,6 @@ public class BpmOAReimbursementRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "收款人卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "付款公司")
|
||||
private Long paymentCompany;
|
||||
|
||||
@Schema(description = "付款公司名称")
|
||||
private String paymentCompanyName;
|
||||
|
||||
@Schema(description = "报销项目明细", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销项目不能为空")
|
||||
private List<ReimbursementDTO> reimbursements;
|
||||
|
@ -38,7 +38,4 @@ public class Reimbursement {
|
||||
|
||||
@Schema(description = "采购计划编号", example = "1")
|
||||
private Long procureId;
|
||||
|
||||
@Schema(description = "业务表编号")
|
||||
private Long objectId;
|
||||
}
|
||||
|
@ -36,7 +36,4 @@ public class ReimbursementDTO {
|
||||
|
||||
@Schema(description = "采购计划编号", example = "1")
|
||||
private Long procureId;
|
||||
|
||||
@Schema(description = "业务表编号")
|
||||
private Long objectId;
|
||||
}
|
||||
|
@ -64,7 +64,4 @@ public class BpmOASalaryCreateReqVO {
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "附件不能为空")
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
||||
@Schema(description = "员工薪资id集合")
|
||||
private Set<Long> staffSalaryIds;
|
||||
}
|
||||
|
@ -66,7 +66,4 @@ public class BpmOASalaryRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "上传文件")
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
||||
@Schema(description = "员工薪资id集合")
|
||||
private Set<Long> staffSalaryIds;
|
||||
}
|
||||
|
@ -39,6 +39,4 @@ public class BpmTaskDonePageReqVO extends PageParam {
|
||||
@Schema(description = "部门编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "任务状态")
|
||||
private Integer result ;
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.Reimbursement;
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@ -63,11 +64,6 @@ public class BpmOAReimbursementDO extends BaseDO {
|
||||
*/
|
||||
private String bankName;
|
||||
|
||||
/**
|
||||
* 付款公司编号
|
||||
*/
|
||||
private Long paymentCompany;
|
||||
|
||||
// /**
|
||||
// * 报销明细数据JSON
|
||||
// */
|
||||
|
@ -68,9 +68,4 @@ public class BpmOAReimbursementItemDO extends BaseDO {
|
||||
* 采购申请编号
|
||||
*/
|
||||
private Long procureId;
|
||||
|
||||
/**
|
||||
* 业务表编号
|
||||
*/
|
||||
private Long objectId;
|
||||
}
|
||||
|
@ -68,12 +68,6 @@ public class BpmOASalaryDO extends BaseDO {
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> factoryDeptId;
|
||||
|
||||
/**
|
||||
* 员工薪资id集合
|
||||
*/
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> staffSalaryIds;
|
||||
|
||||
/**
|
||||
* 付款总额
|
||||
*/
|
||||
|
@ -6,10 +6,8 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.evection.BpmOAEvection
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEvectionDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出差申请 Mapper
|
||||
@ -28,6 +26,4 @@ public interface BpmOAEvectionMapper extends BaseMapperX<BpmOAEvectionDO> {
|
||||
.geIfPresent(BpmOAEvectionDO::getEndTime, createReqVO.getStartTime())
|
||||
.in(BpmOAEvectionDO::getResult, Arrays.asList(BpmProcessInstanceResultEnum.PROCESS.getResult(), BpmProcessInstanceResultEnum.APPROVE.getResult())));
|
||||
}
|
||||
|
||||
List<BpmOAEvectionDO> selectEvectionList(@Param("userId") Long userId);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ public interface BpmOAPaymentMapper extends BaseMapperX<BpmOAPaymentDO> {
|
||||
.eq(BpmOAPaymentDO::getIsTickets, 1)
|
||||
.eqIfPresent(BpmOAPaymentDO::getStatus, pageReqVO.getStatus())
|
||||
.betweenIfPresent(BpmOAPaymentDO::getCreateTime, pageReqVO.getCreateTime())
|
||||
.eqIfPresent(BpmOAPaymentDO::getUserId, pageReqVO.getUserId())
|
||||
.eq(pageReqVO.getIsMy(), BpmOAPaymentDO::getUserId, userId)
|
||||
.orderByAsc(BpmOAPaymentDO::getStatus)
|
||||
.orderByDesc(BpmOAPaymentDO::getId));
|
||||
|
@ -93,7 +93,7 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> {
|
||||
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getStartUserId, BpmTaskDonePageRespVO::getStartUserId);
|
||||
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getProcessDefinitionId, BpmTaskDonePageRespVO::getProcessDefinitionId);
|
||||
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getCcids, BpmTaskDonePageRespVO::getCcUserIds);
|
||||
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getStatus, BpmTaskDonePageRespVO::getStatus ) ;
|
||||
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getResult, BpmTaskDonePageRespVO::getStatus ) ;
|
||||
|
||||
queryWrapperX.innerJoin(BpmProcessInstanceExtDO.class, on -> on
|
||||
.eq(BpmTaskExtDO::getProcessInstanceId, BpmProcessInstanceExtDO::getProcessInstanceId)
|
||||
@ -102,10 +102,7 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> {
|
||||
queryWrapperX.likeRight(BpmProcessInstanceExtDO::getProcessDefinitionId, "oa_");
|
||||
queryWrapperX.eq(BpmTaskExtDO::getAssigneeUserId, userId);
|
||||
queryWrapperX.ne(BpmTaskExtDO::getReason, BpmConstants.AUTO_APPRAVAL);
|
||||
// queryWrapperX.ne(BpmTaskExtDO::getResult,4); //还未开始审批,发起人主动撤销的流程,不显示
|
||||
if (pageVO.getResult() != null) {
|
||||
queryWrapperX.eq(BpmTaskExtDO::getResult,pageVO.getResult());
|
||||
}
|
||||
queryWrapperX.ne(BpmTaskExtDO::getResult,4); //还未开始审批,发起人主动撤销的流程,不显示
|
||||
queryWrapperX.betweenIfPresent(BpmTaskExtDO::getCreateTime, pageVO.getCreateTime());
|
||||
queryWrapperX.orderByDesc(BpmTaskExtDO::getEndTime);
|
||||
|
||||
|
@ -19,7 +19,6 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ -94,14 +93,9 @@ public class BpmTaskFactoryLeaderScript extends BpmTaskAssignLeaderAbstractScrip
|
||||
if (salaryDO != null) {
|
||||
|
||||
// 获取申请部门信息
|
||||
DeptRespDTO deptRespDTO = null;
|
||||
if (salaryDO.getCompanyDeptId() != null) {
|
||||
deptRespDTO = deptApi.getDept(salaryDO.getCompanyDeptId()).getCheckedData();
|
||||
}else if (CollUtil.isNotEmpty(salaryDO.getFactoryDeptId())) {
|
||||
deptRespDTO = deptApi.getDeptByFactoryId(new ArrayList<>(salaryDO.getFactoryDeptId()).get(0)).getCheckedData();
|
||||
}
|
||||
DeptRespDTO deptRespDTO = deptApi.getDept(salaryDO.getCompanyDeptId()).getCheckedData();
|
||||
// 判断是否是属于工厂部门
|
||||
if (deptRespDTO != null) {
|
||||
if (deptRespDTO != null && deptRespDTO.getFactoryId() != null) {
|
||||
dept = deptApi.getDept(deptRespDTO.getParentId()).getCheckedData();
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import cn.iocoder.yudao.module.product.api.storeproduct.StoreProductApi;
|
||||
import cn.iocoder.yudao.module.product.api.storeproductattrvalue.StoreProductAttrValueApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.staff.StaffApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.staffSalary.StaffSalaryApi;
|
||||
import cn.iocoder.yudao.module.system.api.assetreceive.AssetReceiveApi;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsApi;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsTypeApi;
|
||||
@ -46,8 +45,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
SubscribeMessageSendApi.class, SocialClientApi.class, UsersExtApi.class, AttendanceApi.class, BankApi.class, ConfigApi.class, PositionApi.class, SupplierApi.class, AssetsApi.class,
|
||||
AssetsTypeApi.class, AssetReceiveApi.class, AttendanceApi.class, AttendanceGroupApi.class, WorkOvertimeApi.class, HolidayApi.class,
|
||||
RentalOrderApi.class, RentalDepositRecordApi.class, ProjectApi.class, RentalItemsRecordApi.class,AdminOauthUserOtherInfoApi.class, StoreProductAttrValueApi.class, StoreProductApi.class,
|
||||
ContractApi.class, BusinessApi.class, CrmCustomerApi.class, StaffApi.class, LoanApi.class, FactoryInfoApi.class, UserLiveTreeApi.class, SalesPerformanceSettlementApi.class,
|
||||
StaffSalaryApi.class
|
||||
ContractApi.class, BusinessApi.class, CrmCustomerApi.class, StaffApi.class, LoanApi.class, FactoryInfoApi.class, UserLiveTreeApi.class, SalesPerformanceSettlementApi.class
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -54,10 +54,4 @@ public interface BpmOAEvectionService {
|
||||
* @return 出差申请列表
|
||||
*/
|
||||
List<BpmOAEvectionDO> getEvectionListByEndTime(LocalDate date);
|
||||
|
||||
/**
|
||||
* 获得我的出差申请列表
|
||||
* @return 出差申请列表
|
||||
*/
|
||||
List<BpmOAEvectionDO> getEvectionList();
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EVECTION_IS_EXISTS;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EVECTION_NOT_EXISTS;
|
||||
|
||||
@ -151,10 +150,4 @@ public class BpmOAEvectionServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
.eq(BpmOAEvectionDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult())
|
||||
.likeIfPresent(BpmOAEvectionDO::getEndTime, date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmOAEvectionDO> getEvectionList() {
|
||||
|
||||
return evectionMapper.selectEvectionList(getLoginUserId());
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,6 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.staff.StaffApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.staff.dto.StaffDTO;
|
||||
import cn.iocoder.yudao.module.system.api.bank.BankApi;
|
||||
@ -79,9 +77,6 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
||||
@Resource
|
||||
private BankApi bankApi;
|
||||
|
||||
@Resource
|
||||
private FactoryInfoApi factoryInfoApi;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ -102,19 +97,8 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
loanMapper.insert(loan);
|
||||
|
||||
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
// 提交是费用借支时
|
||||
if (vo.getLoanType() == 2) {
|
||||
|
||||
// 获取借支人所属厂区信息
|
||||
FactoryInfoDTO factoryInfoDTO = factoryInfoApi.getFactoryInfo(loan.getFactoryId()).getCheckedData();
|
||||
processInstanceVariables.put("factoryType", factoryInfoDTO.getType());
|
||||
}
|
||||
|
||||
processInstanceVariables.put("loanType", loan.getLoanType());
|
||||
String processInstanceId = processInstanceService.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(loan.getId())));
|
||||
|
@ -276,9 +276,9 @@ public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPa
|
||||
// 获取银行卡信息
|
||||
BankRespDTO bankResp = bankApi.getBank(payment.getBankId()).getCheckedData();
|
||||
// 设置银行卡信息
|
||||
respVO.setBankName(bankResp != null ? bankResp.getBankName() : null);
|
||||
respVO.setBankNo(bankResp != null ? bankResp.getBankNo() : null);
|
||||
respVO.setNickname(bankResp != null ? bankResp.getNickname() : null);
|
||||
respVO.setBankName(bankResp.getBankName());
|
||||
respVO.setBankNo(bankResp.getBankNo());
|
||||
respVO.setNickname(bankResp.getNickname());
|
||||
}
|
||||
}
|
||||
return respVO;
|
||||
|
@ -25,6 +25,7 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
@ -100,7 +101,6 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createReimbursement(Long userId, BpmOAReimbursementCreateReqVO createReqVO) {
|
||||
BpmOAReimbursementDO reimbursement = BpmOAReimbursementConvert.INSTANCE.convert(createReqVO).setUserId(userId)
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
@ -120,8 +120,6 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
createDO.forEach(item -> item.setReimbursementId(reimbursement.getId()));
|
||||
reimbursementItemMapper.insertBatch(createDO);
|
||||
|
||||
// 同步更新
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(userId,
|
||||
|
@ -13,7 +13,7 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.staffSalary.StaffSalaryApi;
|
||||
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
@ -62,9 +62,6 @@ public class BpmOASalaryServiceImpl extends BpmOABaseService implements BpmOASal
|
||||
@Resource
|
||||
private FinancialPaymentService financialPaymentService;
|
||||
|
||||
@Resource
|
||||
private StaffSalaryApi staffSalaryApi;
|
||||
|
||||
@Override
|
||||
public Long createSalary(Long userId, BpmOASalaryCreateReqVO createReqVO) {
|
||||
|
||||
@ -100,18 +97,12 @@ public class BpmOASalaryServiceImpl extends BpmOABaseService implements BpmOASal
|
||||
if (fileItems != null && !fileItems.isEmpty()) {
|
||||
uploadBpmFileProcessInstanceId(processInstanceId,fileItems) ;
|
||||
}
|
||||
|
||||
// 同步更新 员工薪资表已发放工资状态
|
||||
staffSalaryApi.updateIsGrant(salary.getStaffSalaryIds(), 1);
|
||||
|
||||
return salary.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSalaryResult(String processInstanceId, Long id, Integer result) {
|
||||
BpmOASalaryDO salaryDO = validateLeaveExists(id);
|
||||
salaryMapper.updateById(new BpmOASalaryDO().setId(id).setResult(result));
|
||||
|
||||
//审核通过 (最后节点)
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
@ -139,17 +130,7 @@ public class BpmOASalaryServiceImpl extends BpmOABaseService implements BpmOASal
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// -- 自己取消
|
||||
// -- 审核拒绝
|
||||
//所有关联的采购申请改为 未支付状态
|
||||
if (BpmProcessInstanceResultEnum.REJECT.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.CANCEL.getResult().equals(result)
|
||||
|| BpmProcessInstanceResultEnum.BACK.getResult().equals(result)) {
|
||||
|
||||
// 还原员工薪资表已发放工资状态
|
||||
staffSalaryApi.updateIsGrant(salaryDO.getStaffSalaryIds(), 0);
|
||||
}
|
||||
salaryMapper.updateById(new BpmOASalaryDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
private BpmOASalaryDO validateLeaveExists(Long id) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -28,8 +28,6 @@ import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionServic
|
||||
import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOASalaryService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.dto.ProcessInstanceVariablesDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.FactoryInfoApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.factoryInfo.dto.FactoryInfoDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
@ -101,9 +99,6 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Resource
|
||||
private FactoryInfoApi factoryInfoApi;
|
||||
|
||||
@Resource
|
||||
private BpmTaskExtMapper taskExtMapper;
|
||||
|
||||
@ -217,45 +212,16 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
|
||||
// 获取薪资付款列表
|
||||
List<BpmOASalaryDO> salaryDOS = salaryService.getListByProcessInstanceIds(processInstanceIds);
|
||||
// 获取公司编号map
|
||||
Map<String, Long> salaryDeptMap = salaryDOS.stream()
|
||||
.filter(item -> item.getCompanyDeptId() != null)
|
||||
.collect(Collectors.toMap(BpmOASalaryDO::getProcessInstanceId, BpmOASalaryDO::getCompanyDeptId));
|
||||
// 获取工厂编号Map
|
||||
Map<String, Set<Long>> factoryDeptMap = salaryDOS.stream()
|
||||
.filter(item -> CollUtil.isNotEmpty(item.getFactoryDeptId()))
|
||||
.collect(Collectors.toMap(BpmOASalaryDO::getProcessInstanceId, BpmOASalaryDO::getFactoryDeptId));
|
||||
// 获取付款部门信息
|
||||
Map<Long, DeptRespDTO> dtoMap = deptApi.getDeptMap(convertSet(salaryDOS, BpmOASalaryDO::getCompanyDeptId));
|
||||
// 获取付款工厂信息
|
||||
Map<Long, FactoryInfoDTO> factoryInfoDTOMap = factoryInfoApi.getFactoryMap(factoryDeptMap.values()
|
||||
.stream()
|
||||
.flatMap(Set::stream)
|
||||
.collect(Collectors.toSet()));
|
||||
// 组合数据
|
||||
Map<String, List<FactoryInfoDTO>> groupedMap = factoryDeptMap.entrySet()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
entry -> entry.getValue().stream()
|
||||
.map(factoryInfoDTOMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList())
|
||||
));
|
||||
|
||||
pageResp.getRecords().forEach(item -> {
|
||||
if (salaryDeptMap.containsKey(item.getProcessInstanceId())) {
|
||||
item.setStartUserNickname(item.getStartUserNickname() +
|
||||
"(" +
|
||||
dtoMap.get(salaryDeptMap.get(item.getProcessInstanceId())).getName() +
|
||||
")");
|
||||
}else if (factoryDeptMap.containsKey(item.getProcessInstanceId())) {
|
||||
item.setStartUserNickname(item.getStartUserNickname() +
|
||||
"(" +
|
||||
groupedMap.get(item.getProcessInstanceId()).stream()
|
||||
.map(FactoryInfoDTO::getShortName)
|
||||
.collect(Collectors.joining(",")) +
|
||||
")");
|
||||
}
|
||||
});
|
||||
|
||||
@ -297,31 +263,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
// 获取薪资付款列表
|
||||
List<BpmOASalaryDO> salaryDOS = salaryService.getListByProcessInstanceIds(processInstanceIds);
|
||||
Map<String, Long> salaryDeptMap = salaryDOS.stream()
|
||||
.filter(item -> item.getCompanyDeptId() != null)
|
||||
.collect(Collectors.toMap(BpmOASalaryDO::getProcessInstanceId, BpmOASalaryDO::getCompanyDeptId));
|
||||
// 获取付款部门信息
|
||||
Map<Long, DeptRespDTO> dtoMap = deptApi.getDeptMap(convertSet(salaryDOS, BpmOASalaryDO::getCompanyDeptId));
|
||||
|
||||
// 获取工厂编号Map
|
||||
Map<String, Set<Long>> factoryDeptMap = salaryDOS.stream()
|
||||
.filter(item -> CollUtil.isNotEmpty(item.getFactoryDeptId()))
|
||||
.collect(Collectors.toMap(BpmOASalaryDO::getProcessInstanceId, BpmOASalaryDO::getFactoryDeptId));
|
||||
// 获取付款工厂信息
|
||||
Map<Long, FactoryInfoDTO> factoryInfoDTOMap = factoryInfoApi.getFactoryMap(factoryDeptMap.values()
|
||||
.stream()
|
||||
.flatMap(Set::stream)
|
||||
.collect(Collectors.toSet()));
|
||||
// 组合数据
|
||||
Map<String, List<FactoryInfoDTO>> groupedMap = factoryDeptMap.entrySet()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
entry -> entry.getValue().stream()
|
||||
.map(factoryInfoDTOMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList())
|
||||
));
|
||||
|
||||
pageResult.getList().forEach(item -> {
|
||||
item.setStartUserNickname(userMap.get(item.getStartUserId()).getNickname());
|
||||
if (salaryDeptMap.containsKey(item.getProcessInstanceId())) {
|
||||
@ -329,13 +274,6 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
"(" +
|
||||
dtoMap.get(salaryDeptMap.get(item.getProcessInstanceId())).getName() +
|
||||
")");
|
||||
}else if (factoryDeptMap.containsKey(item.getProcessInstanceId())) {
|
||||
item.setStartUserNickname(item.getStartUserNickname() +
|
||||
"(" +
|
||||
groupedMap.get(item.getProcessInstanceId()).stream()
|
||||
.map(FactoryInfoDTO::getShortName)
|
||||
.collect(Collectors.joining(",")) +
|
||||
")");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAEvectionMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectEvectionList" resultType="cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEvectionDO">
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
bpm_oa_evection a
|
||||
WHERE
|
||||
a.id NOT IN (
|
||||
SELECT
|
||||
c.object_id
|
||||
FROM
|
||||
bpm_oa_reimbursement b,
|
||||
bpm_oa_reimbursement_item c
|
||||
WHERE
|
||||
b.user_id = #{userId}
|
||||
AND b.deleted = 0
|
||||
AND b.id = c.reimbursement_id
|
||||
AND b.result IN ( 1, 2 )
|
||||
AND c.type = 1
|
||||
AND c.object_id IS NOT NULL
|
||||
)
|
||||
AND a.user_id = #{userId}
|
||||
AND a.deleted = 0
|
||||
ORDER BY
|
||||
a.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
@ -70,21 +70,16 @@
|
||||
SUM(a.total_money) - SUM(a.amount_paid) AS remainingPayable
|
||||
FROM
|
||||
bpm_oa_expenses a
|
||||
LEFT JOIN bpm_oa_expenses_item b ON b.expenses_id = a.id
|
||||
LEFT JOIN bpm_process_instance_ext c ON c.process_instance_id = a.process_instance_id
|
||||
LEFT JOIN system_bank ub ON ub.id = a.bank_id
|
||||
WHERE
|
||||
a.deleted = 0
|
||||
AND b.deleted = 0
|
||||
AND a.result = 2
|
||||
<if test="pageReqVO.userId != null">
|
||||
AND a.user_id = #{pageReqVO.userId}
|
||||
</if>
|
||||
AND EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
bpm_oa_expenses_item b
|
||||
WHERE
|
||||
b.expenses_id = a.id
|
||||
<if test="pageReqVO.factoryId != null">
|
||||
AND b.dept_id = #{pageReqVO.factoryId}
|
||||
</if>
|
||||
@ -94,7 +89,6 @@
|
||||
<if test="pageReqVO.costSection != null">
|
||||
AND b.cost_section = #{pageReqVO.costSection}
|
||||
</if>
|
||||
)
|
||||
<if test="pageReqVO.payeeName != null">
|
||||
AND ub.nickname LIKE CONCAT('%', #{pageReqVO.payeeName}, '%')
|
||||
</if>
|
||||
|
@ -31,7 +31,7 @@
|
||||
<if test="pageReqVO.loanType == 1">
|
||||
SELECT
|
||||
s.staff_id AS staffId,
|
||||
st.nick_name AS staffName,
|
||||
CONVERT(st.nick_name USING utf8mb4) COLLATE utf8mb4_unicode_ci AS staffName,
|
||||
s.factory_id AS factoryId,
|
||||
sf.short_name AS factoryName,
|
||||
s.month AS month,
|
||||
|
22
yudao-module-crm/.flattened-pom.xml
Normal file
22
yudao-module-crm/.flattened-pom.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
</parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-crm</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>${project.artifactId}</name>
|
||||
<description>infra 模块,主要提供两块能力:
|
||||
1. 我们放基础设施的运维与管理,支撑上层的通用与核心业务。 例如说:定时任务的管理、服务器的信息等等
|
||||
2. 研发工具,提升研发效率与质量。 例如说:代码生成器、接口文档等等</description>
|
||||
<modules>
|
||||
<module>yudao-module-crm-api</module>
|
||||
<module>yudao-module-crm-biz</module>
|
||||
</modules>
|
||||
</project>
|
36
yudao-module-crm/yudao-module-crm-api/.flattened-pom.xml
Normal file
36
yudao-module-crm/yudao-module-crm-api/.flattened-pom.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-crm</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
</parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-crm-api</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<name>${project.artifactId}</name>
|
||||
<description>infra 模块 API,暴露给其它模块调用</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
153
yudao-module-crm/yudao-module-crm-biz/.flattened-pom.xml
Normal file
153
yudao-module-crm/yudao-module-crm-biz/.flattened-pom.xml
Normal file
@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-crm</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
</parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-crm-biz</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<name>${project.artifactId}</name>
|
||||
<description>infra 模块,主要提供两块能力:
|
||||
1. 我们放基础设施的运维与管理,支撑上层的通用与核心业务。 例如说:定时任务的管理、服务器的信息等等
|
||||
2. 研发工具,提升研发效率与质量。 例如说:代码生成器、接口文档等等</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-crm-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-product-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-system-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-banner</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-error-code</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-rpc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mq</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.smallbun.screw</groupId>
|
||||
<artifactId>screw-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-server</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-file</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-bpm-api</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -1,26 +0,0 @@
|
||||
package cn.iocoder.yudao.module.system.api.customersettlement;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 结算")
|
||||
public interface SettlementApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/customer-settlement";
|
||||
|
||||
@GetMapping(PREFIX + "/get-deductionItems")
|
||||
@Operation(summary = "获得结算扣款明细")
|
||||
CommonResult<List<SettlementItemDTO>> getDeductionItems(@RequestParam(value = "factoryId", required = false) Long factoryId,
|
||||
@RequestParam(value = "month", required = false) String month);
|
||||
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package cn.iocoder.yudao.module.system.api.customersettlement.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂结算项VO")
|
||||
@Data
|
||||
public class SettlementItemDTO {
|
||||
|
||||
@Schema(description = "工厂编号")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "结算月份")
|
||||
private String month;
|
||||
|
||||
@Schema(description = "业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "扣款明细")
|
||||
private List<Deduction> deductionItems;
|
||||
|
||||
/**
|
||||
* 扣款明细
|
||||
*/
|
||||
@Data
|
||||
public static class Deduction {
|
||||
|
||||
private String key;
|
||||
|
||||
private BigDecimal value;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package cn.iocoder.yudao.module.system.api.customersettlement;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
|
||||
import cn.iocoder.yudao.module.system.service.customersettlement.CustomerSettlementService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class SettlementApiImpl implements SettlementApi {
|
||||
|
||||
@Resource
|
||||
private CustomerSettlementService customerSettlementService;
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult<List<SettlementItemDTO>> getDeductionItems(Long factoryId, String month) {
|
||||
return success( customerSettlementService.getDeductionItems(factoryId, month));
|
||||
}
|
||||
}
|
@ -3,17 +3,12 @@ package cn.iocoder.yudao.module.system.dal.mysql.customersettlement;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.CustomerSettlementDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.customersettlement.SettlementItemDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户结算信息 Mapper
|
||||
*
|
||||
@ -30,18 +25,4 @@ public interface CustomerSettlementMapper extends BaseMapperX<CustomerSettlement
|
||||
}
|
||||
|
||||
StatisticsVO selectTotal(@Param("reqVO") CustomerSettlementPageReqVO pageReqVO);
|
||||
|
||||
default List<SettlementItemDTO> selectDeductionItems(Long factoryId, String month) {
|
||||
|
||||
MPJLambdaWrapperX<CustomerSettlementDO> queryWrapper = new MPJLambdaWrapperX<CustomerSettlementDO>();
|
||||
queryWrapper.selectAs(CustomerSettlementDO::getCustomerId, SettlementItemDTO::getFactoryId);
|
||||
queryWrapper.selectAs(CustomerSettlementDO::getSettlementMonth, SettlementItemDTO::getMonth);
|
||||
queryWrapper.selectAs(SettlementItemDO::getBusinessType, SettlementItemDTO::getBusinessType);
|
||||
queryWrapper.selectAs(SettlementItemDO::getDeductionItems, SettlementItemDTO::getDeductionItems);
|
||||
queryWrapper.leftJoin(SettlementItemDO.class, SettlementItemDO::getSettlementId, CustomerSettlementDO::getId);
|
||||
queryWrapper.eqIfPresent(CustomerSettlementDO::getCustomerId, factoryId);
|
||||
queryWrapper.eqIfPresent(CustomerSettlementDO::getSettlementMonth, month);
|
||||
|
||||
return selectJoinList(SettlementItemDTO.class, queryWrapper);
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.service.customersettlement;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
|
||||
@ -79,12 +78,4 @@ public interface CustomerSettlementService {
|
||||
* @return 统计信息
|
||||
*/
|
||||
StatisticsVO getCustomerSettlementTotal(CustomerSettlementPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得结算扣款明细
|
||||
* @param factoryId 工厂id
|
||||
* @param month 月份
|
||||
* @return 结算扣款明细
|
||||
*/
|
||||
List<SettlementItemDTO> getDeductionItems(Long factoryId, String month);
|
||||
}
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.CustomerSettlementSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.customersettlement.vo.StatisticsVO;
|
||||
@ -171,9 +170,4 @@ public class CustomerSettlementServiceImpl implements CustomerSettlementService
|
||||
|
||||
return customerSettlementMapper.selectTotal(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SettlementItemDTO> getDeductionItems(Long factoryId, String month) {
|
||||
return customerSettlementMapper.selectDeductionItems(factoryId, month);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.api.staffSalary;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 厂区员工薪资")
|
||||
public interface StaffSalaryApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/staffSalary";
|
||||
|
||||
@PutMapping(PREFIX + "/updateIsGrant")
|
||||
@Operation(summary = "更新是否已发放薪资")
|
||||
CommonResult<Boolean> updateIsGrant(@RequestParam("ids") Collection<Long> ids,
|
||||
@RequestParam("isGrant") Integer isGrant);
|
||||
}
|
@ -19,7 +19,6 @@ public interface ErrorCodeConstants {
|
||||
|
||||
ErrorCode STAFF_NOT_EXISTS = new ErrorCode(1_000_000_005, "员工不存在");
|
||||
ErrorCode ACCESSORIES_COLLAR_NOT_EXISTS = new ErrorCode(1_000_000_006, "配件费用不存在");
|
||||
ErrorCode IMPORT_LIST_IS_EMPTY = new ErrorCode(1_000_000_007, "导入数据不存在");
|
||||
|
||||
//打包线模块
|
||||
ErrorCode PACKAGE_NOT_EXISTS = new ErrorCode(1_000_001_001, "打包线信息不存在");
|
||||
@ -39,9 +38,6 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode STAFF_SALARY_EXISTS = new ErrorCode(1_000_004_003, "工资记录已存在");
|
||||
// ========== 搬运模块 1_000_005_000 ==========
|
||||
ErrorCode CANNOT_FIND_THE_CORRESPONDING_FACTORY_HANDLING_SPECIFICATION = new ErrorCode(1_000_005_001, "找不到对应的工厂搬运规格");
|
||||
ErrorCode FACTORY_HANDLING_SPECIFICATION_EXISTS = new ErrorCode(1_000_005_002, "工厂搬运规格已存在");
|
||||
ErrorCode SPECIFICATION_USER_AMOUNT_NOT_EXISTS = new ErrorCode(1_000_005_003, "工厂当前月份存在未分配人员数据!");
|
||||
ErrorCode ADDED_A_HANDLING_GROUP_WITH_DUPLICATE_DATA = new ErrorCode(1_000_005_004, "新增数据有重复的搬运组!");
|
||||
ErrorCode NEW_DATA_AND_OLD_DATA_HAVE_DUPLICATE_HANDLING_GROUP = new ErrorCode(1_000_005_005, "新增数据与老数据有重复的搬运组!");
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.api.staffSalary;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.staffsalary.StaffSalaryService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class StaffSalaryApiImpl implements StaffSalaryApi {
|
||||
|
||||
@Resource
|
||||
private StaffSalaryService staffSalaryService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateIsGrant(Collection<Long> ids, Integer isGrant) {
|
||||
staffSalaryService.updateIsGrant(ids, isGrant);
|
||||
return success(true);
|
||||
}
|
||||
}
|
@ -124,15 +124,6 @@ public class FactoryInfoController {
|
||||
return success(BeanUtils.toBean(factoryInfo, FactorySimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/factory-list")
|
||||
@Operation(summary = "取登录用户工厂列表, 登陆用户无工厂则拉取所有工厂 | 用于前端下拉框")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
|
||||
public CommonResult<List<FactorySimpleRespVO>> getFactoryListByLoginUser() {
|
||||
|
||||
List<FactoryInfoDO> factoryInfo = factoryInfoService.getFactoryListByLoginUser();
|
||||
return success(BeanUtils.toBean(factoryInfo, FactorySimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-tree")
|
||||
@Operation(summary = "获得工厂树结构")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
|
||||
|
@ -42,23 +42,14 @@ public class FactoryProfitVO {
|
||||
@Schema(description = "搬运扣款")
|
||||
private BigDecimal porterageDeduction;
|
||||
|
||||
@Schema(description = "叉车扣款明细")
|
||||
private Deduction forkliftDeductionItem;
|
||||
|
||||
@Schema(description = "打包扣款明细")
|
||||
private Deduction packageDeductionItem;
|
||||
|
||||
@Schema(description = "搬运扣款明细")
|
||||
private Deduction porterageDeductionItem;
|
||||
|
||||
@Schema(description = "水电扣款")
|
||||
private BigDecimal hydropower;
|
||||
|
||||
// @Schema(description = "工伤保险")
|
||||
// private BigDecimal employment;
|
||||
//
|
||||
// @Schema(description = "其他(理赔、扣点)")
|
||||
// private BigDecimal other;
|
||||
@Schema(description = "工伤保险")
|
||||
private BigDecimal employment;
|
||||
|
||||
@Schema(description = "其他(理赔、扣点)")
|
||||
private BigDecimal other;
|
||||
|
||||
@Schema(description = "叉车工资")
|
||||
private BigDecimal forkliftSalary;
|
||||
@ -113,20 +104,4 @@ public class FactoryProfitVO {
|
||||
|
||||
@Schema(description = "搬运毛利")
|
||||
private BigDecimal porterageGrossProfit;
|
||||
|
||||
@Data
|
||||
public static class Deduction {
|
||||
|
||||
@Schema(description = "行政罚款")
|
||||
private BigDecimal administrativePenalty;
|
||||
|
||||
@Schema(description = "破损罚款")
|
||||
private BigDecimal damagePenalty;
|
||||
|
||||
@Schema(description = "少件扣款")
|
||||
private BigDecimal missPenalty;
|
||||
|
||||
@Schema(description = "其他扣款")
|
||||
private BigDecimal otherPenalty;
|
||||
}
|
||||
}
|
||||
|
@ -1,95 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.handlinggroup.HandlingGroupService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 搬运组")
|
||||
@RestController
|
||||
@RequestMapping("/smartfactory/handling-group")
|
||||
@Validated
|
||||
public class HandlingGroupController {
|
||||
|
||||
@Resource
|
||||
private HandlingGroupService handlingGroupService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建搬运组")
|
||||
public CommonResult<Long> createHandlingGroup(@Valid @RequestBody HandlingGroupSaveReqVO createReqVO) {
|
||||
return success(handlingGroupService.createHandlingGroup(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新搬运组")
|
||||
public CommonResult<Boolean> updateHandlingGroup(@Valid @RequestBody HandlingGroupSaveReqVO updateReqVO) {
|
||||
handlingGroupService.updateHandlingGroup(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除搬运组")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteHandlingGroup(@RequestParam("id") Long id) {
|
||||
handlingGroupService.deleteHandlingGroup(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得搬运组")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<HandlingGroupRespVO> getHandlingGroup(@RequestParam("id") Long id) {
|
||||
HandlingGroupDO handlingGroup = handlingGroupService.getHandlingGroup(id);
|
||||
return success(BeanUtils.toBean(handlingGroup, HandlingGroupRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getAllByFactoryId")
|
||||
@Operation(summary = "根据工程id获得搬运组列表")
|
||||
public CommonResult<List<HandlingGroupRespVO>> getAllByFactoryId(@RequestParam("factoryId") Long factoryId) {
|
||||
List<HandlingGroupDO> list = handlingGroupService.list(new LambdaQueryWrapper<HandlingGroupDO>().eq(HandlingGroupDO::getFactoryId, factoryId));
|
||||
return success(BeanUtils.toBean(list, HandlingGroupRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得搬运组分页")
|
||||
public CommonResult<PageResult<HandlingGroupRespVO>> getHandlingGroupPage(@Valid HandlingGroupPageReqVO pageReqVO) {
|
||||
PageResult<HandlingGroupDO> pageResult = handlingGroupService.getHandlingGroupPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, HandlingGroupRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出搬运组 Excel")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportHandlingGroupExcel(@Valid HandlingGroupPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<HandlingGroupDO> list = handlingGroupService.getHandlingGroupPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "搬运组.xls", "数据", HandlingGroupRespVO.class,
|
||||
BeanUtils.toBean(list, HandlingGroupRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateItemVO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class HandlingGroupListVO {
|
||||
@Schema(description = "搬运组id", example = "27617")
|
||||
private Long handlingGroupId;
|
||||
|
||||
@Schema(description = "叉车司机id", example = "27617")
|
||||
private Long staffId;
|
||||
|
||||
@Schema(description = "规格/数量列表")
|
||||
private List<HandlingGroupAmountSpecificationsBatchCreateItemVO> itemList;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 搬运组分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class HandlingGroupPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "工厂id", example = "5268")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "搬运组名称", example = "芋艿")
|
||||
private String handlingGroupName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 搬运组 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class HandlingGroupRespVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9657")
|
||||
@ExcelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5268")
|
||||
@ExcelProperty("工厂id")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "工厂名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "5268")
|
||||
@ExcelProperty("工厂名称")
|
||||
private String factoryName;
|
||||
|
||||
@Schema(description = "搬运组名称", example = "芋艿")
|
||||
@ExcelProperty("搬运组名称")
|
||||
private String handlingGroupName;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
|
||||
@Schema(description = "管理后台 - 搬运组新增/修改 Request VO")
|
||||
@Data
|
||||
public class HandlingGroupSaveReqVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9657")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5268")
|
||||
@NotNull(message = "工厂id不能为空")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "搬运组名称", example = "芋艿")
|
||||
private String handlingGroupName;
|
||||
|
||||
}
|
@ -7,17 +7,18 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsPageReqDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsTotalNumDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.handlinggroupuseramount.HandlingGroupUserAmountService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -25,13 +26,13 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 搬运组工资规格关联")
|
||||
@ -42,94 +43,69 @@ public class HandlingGroupAmountSpecificationsController {
|
||||
|
||||
@Resource
|
||||
private HandlingGroupAmountSpecificationsService handlingGroupAmountSpecificationsService;
|
||||
|
||||
@Resource
|
||||
private HandlingGroupUserAmountService handlingGroupUserAmountService;
|
||||
private DeptApi deptApi;
|
||||
|
||||
@PostMapping("/batchCreate")
|
||||
@Operation(summary = "批量创建搬运组工资规格关联")
|
||||
@Operation(summary = "创建搬运组工资规格关联")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:create')")
|
||||
public CommonResult<Boolean> batchCreate(@Valid @RequestBody HandlingGroupAmountSpecificationsBatchCreateVO vo) {
|
||||
handlingGroupAmountSpecificationsService.batchCreate(vo);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/getTotalNum")
|
||||
@Operation(summary = "获取合计数")
|
||||
public CommonResult<HandlingGroupAmountSpecificationsTotalNumVO> getTotalNum(@Valid HandlingGroupAmountSpecificationsTotalNumDTO dto) {
|
||||
HandlingGroupAmountSpecificationsTotalNumVO vo = handlingGroupAmountSpecificationsService.getTotalNum(dto);
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getAmountSubtotal")
|
||||
@Operation(summary = "获取金额小计")
|
||||
public CommonResult<BigDecimal> getAmountSubtotal(@RequestParam Integer totalCount,
|
||||
@RequestParam Long handlingSpecificationsId) {
|
||||
BigDecimal amount = handlingGroupAmountSpecificationsService.getAmountSubtotal(totalCount, handlingSpecificationsId);
|
||||
return success(amount);
|
||||
}
|
||||
|
||||
@PostMapping("/batchUpdate")
|
||||
@Operation(summary = "批量更新搬运组工资规格关联")
|
||||
public CommonResult<Boolean> batchUpdate(@Valid @RequestBody HandlingGroupAmountSpecificationsBatchUpdateVO vo) {
|
||||
handlingGroupAmountSpecificationsService.batchUpdate(vo);
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "更新搬运组工资规格关联")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:update')")
|
||||
public CommonResult<Boolean> update(@Valid @RequestBody HandlingGroupAmountSpecificationsSaveReqVO createReqVO) {
|
||||
handlingGroupAmountSpecificationsService.updateHandlingGroupAmountSpecifications(createReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/batchDelete")
|
||||
@Operation(summary = "批量删除搬运组工资规格关联")
|
||||
public CommonResult<Boolean> batchDelete(@RequestBody HandlingGroupAmountSpecificationsBatchDelVO vo) {
|
||||
handlingGroupAmountSpecificationsService.batchDelete(vo);
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除搬运组工资规格关联")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:delete')")
|
||||
public CommonResult<Boolean> deleteHandlingGroupAmountSpecifications(@RequestParam("id") Long id) {
|
||||
handlingGroupAmountSpecificationsService.deleteHandlingGroupAmountSpecifications(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得搬运组工资规格关联")
|
||||
@Parameter(name = "factoryId", description = "工厂id", required = true, example = "1024")
|
||||
@Parameter(name = "dateStr", description = "日期", required = true, example = "1024")
|
||||
@Parameter(name = "handlingGroupId", description = "搬运组id", required = true, example = "1024")
|
||||
public CommonResult<List<HandlingGroupAmountSpecificationsDetailsRespVO>> getHandlingGroupAmountSpecifications(@RequestParam Long factoryId,
|
||||
@RequestParam String dateStr,
|
||||
@RequestParam Long handlingGroupId) {
|
||||
List<HandlingGroupAmountSpecificationsDO> handlingGroupAmountSpecifications = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecificationsList(factoryId, dateStr, handlingGroupId);
|
||||
return success(BeanUtils.toBean(handlingGroupAmountSpecifications, HandlingGroupAmountSpecificationsDetailsRespVO.class));
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:query')")
|
||||
public CommonResult<HandlingGroupAmountSpecificationsRespVO> getHandlingGroupAmountSpecifications(@RequestParam("id") Long id) {
|
||||
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecifications = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecifications(id);
|
||||
return success(BeanUtils.toBean(handlingGroupAmountSpecifications, HandlingGroupAmountSpecificationsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得搬运组工资规格关联分页")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:query')")
|
||||
public CommonResult<PageResult<HandlingGroupAmountSpecificationsRespVO>> getHandlingGroupAmountSpecificationsPage(@Valid HandlingGroupAmountSpecificationsPageReqVO pageReqVO) {
|
||||
PageResult<HandlingGroupAmountSpecificationsDO> pageResult = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecificationsPage(pageReqVO);
|
||||
PageResult<HandlingGroupAmountSpecificationsRespVO> result = BeanUtils.toBean(pageResult, HandlingGroupAmountSpecificationsRespVO.class);
|
||||
// 计算合计 - 先根据工厂+搬运组+日期进行分组
|
||||
Map<String, List<HandlingGroupAmountSpecificationsRespVO>> map = result.getList().stream().collect(Collectors.groupingBy(a -> a.getFactoryId() + "_" + a.getHandlingGroupId() + "_" + a.getDateStr()));
|
||||
List<Long> ids = result.getList().stream().map(HandlingGroupAmountSpecificationsRespVO::getHandlingGroupId).distinct().collect(Collectors.toList());
|
||||
Map<Long, List<HandlingGroupUserAmountDO>> handlingGroupUserAmountMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
List<HandlingGroupUserAmountDO> list = handlingGroupUserAmountService.getByHandlingGroupIds(ids);
|
||||
handlingGroupUserAmountMap = list.stream().collect(Collectors.groupingBy(HandlingGroupUserAmountDO::getHandlingGroupId));
|
||||
}
|
||||
for (HandlingGroupAmountSpecificationsRespVO handlingGroupAmountSpecificationsDO : result.getList()) {
|
||||
String key = handlingGroupAmountSpecificationsDO.getFactoryId() + "_" + handlingGroupAmountSpecificationsDO.getHandlingGroupId() + "_" + handlingGroupAmountSpecificationsDO.getDateStr();
|
||||
// handlingGroupAmountSpecificationsDO.setTotalAmount(getSumValue(map.get(key), HandlingGroupAmountSpecificationsRespVO::getAmount, BigDecimal::add));
|
||||
// handlingGroupAmountSpecificationsDO.setTotalNum(getSumValue(map.get(key), HandlingGroupAmountSpecificationsRespVO::getTotalCount, Integer::sum));
|
||||
List<HandlingGroupUserAmountDO> items = handlingGroupUserAmountMap.get(handlingGroupAmountSpecificationsDO.getHandlingGroupId());
|
||||
if (CollUtil.isNotEmpty(items)) {
|
||||
List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS = BeanUtils.toBean(items, HandlingGroupUserAmountItemVO.class);
|
||||
handlingGroupAmountSpecificationsDO.setHandlingGroupUserAmountItemVOS(handlingGroupUserAmountItemVOS);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result.getList())) {
|
||||
|
||||
// 获取工厂信息
|
||||
Set<Long> factoryIds = convertSet(result.getList(), HandlingGroupAmountSpecificationsRespVO::getFactoryId);
|
||||
Map<Long, DeptRespDTO> factoryMap = convertMap(deptApi.getDeptList(factoryIds).getCheckedData(), DeptRespDTO::getId);
|
||||
|
||||
result.getList().forEach(data -> {
|
||||
// 设置工厂名称
|
||||
data.setFactoryName(factoryMap.get(data.getFactoryId()) != null ? factoryMap.get(data.getFactoryId()).getName() : null);
|
||||
});
|
||||
}
|
||||
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/pageV2")
|
||||
@Operation(summary = "获得搬运组工资规格关联分页")
|
||||
public CommonResult<PageResult<HandlingGroupAmountSpecificationsRespVO>> getHandlingGroupAmountSpecificationsPageV2(@Valid HandlingGroupAmountSpecificationsPageReqDTO pageReqVO) {
|
||||
PageResult<HandlingGroupAmountSpecificationsRespVO> pageResult = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecificationsPageV2(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出搬运组工资规格关联 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportHandlingGroupAmountSpecificationsExcel(@Valid HandlingGroupAmountSpecificationsPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
@ -1,43 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class HandlingGroupAmountSpecificationsPageReqDTO extends PageParam {
|
||||
|
||||
@Schema(description = "工厂id", example = "23178")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "搬运组id", example = "23178")
|
||||
private Long handlingGroupId;
|
||||
|
||||
@Schema(description = "叉车司机名称", example = "23178")
|
||||
private String staffName;
|
||||
|
||||
@Schema(description = "搬运工名称", example = "23178")
|
||||
private String porterName;
|
||||
|
||||
@Schema(description = "搬运规格id", example = "23178")
|
||||
private Long handlingSpecificationsId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "工厂ids", example = "23178")
|
||||
private List<Long> factoryIds;
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class HandlingGroupAmountSpecificationsTotalNumDTO {
|
||||
@Schema(description = "工厂id")
|
||||
private Long factoryId;
|
||||
@Schema(description = "规格id")
|
||||
private Long handlingSpecificationsId;
|
||||
@Schema(description = "叉车司机名称")
|
||||
private String forkliftDriverName;
|
||||
@Schema(description = "搬运工名称")
|
||||
private String porterName;
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
@Schema(description = "工厂ids")
|
||||
private List<Long> factoryIds;
|
||||
}
|
@ -8,10 +8,6 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
public class HandlingGroupAmountSpecificationsBatchCreateItemVO {
|
||||
|
||||
@Schema(description = "id", example = "23178")
|
||||
@NotNull(message = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "搬运规格id", example = "23178")
|
||||
@NotNull(message = "搬运规格不能为空")
|
||||
private Long handlingSpecificationsId;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupListVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@ -16,6 +15,6 @@ public class HandlingGroupAmountSpecificationsBatchCreateVO {
|
||||
@NotNull(message = "日期不能为空")
|
||||
private String dateStr;
|
||||
|
||||
@Schema(description = "搬运组列表")
|
||||
private List<HandlingGroupListVO> handlingGroupList;
|
||||
@Schema(description = "子列表")
|
||||
private List<HandlingGroupAmountSpecificationsBatchCreateItemVO> itemVOS;
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HandlingGroupAmountSpecificationsBatchDelVO {
|
||||
@Schema(description = "工厂id", example = "23178")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
@NotNull(message = "日期不能为空")
|
||||
private String dateStr;
|
||||
|
||||
@Schema(description = "搬运组id", example = "27617")
|
||||
private Long handlingGroupId;
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupListVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HandlingGroupAmountSpecificationsBatchUpdateVO {
|
||||
@Schema(description = "工厂id", example = "23178")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
@NotNull(message = "日期不能为空")
|
||||
private String dateStr;
|
||||
|
||||
@Schema(description = "搬运组id", example = "27617")
|
||||
private Long handlingGroupId;
|
||||
|
||||
@Schema(description = "叉车司机id", example = "27617")
|
||||
private Long staffId;
|
||||
|
||||
@Schema(description = "规格/数量列表")
|
||||
private List<HandlingGroupAmountSpecificationsBatchCreateItemVO> itemList;
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class HandlingGroupAmountSpecificationsDetailsRespVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9721")
|
||||
@ExcelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂id", example = "23178")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "工厂名称", example = "23178")
|
||||
private String factoryName;
|
||||
|
||||
@Schema(description = "搬运组id", example = "23178")
|
||||
@ExcelProperty("搬运组id")
|
||||
private Long handlingGroupId;
|
||||
|
||||
@Schema(description = "搬运组名称", example = "23178")
|
||||
@ExcelProperty("搬运组名称")
|
||||
private String handlingGroupName;
|
||||
|
||||
@Schema(description = "叉车司机名称", example = "23178")
|
||||
@ExcelProperty("叉车司机名称")
|
||||
private String staffName;
|
||||
|
||||
@Schema(description = "叉车司机id", example = "23178")
|
||||
@ExcelProperty("叉车司机id")
|
||||
private Long staffId;
|
||||
|
||||
@Schema(description = "搬运规格id", example = "23178")
|
||||
@ExcelProperty("搬运规格id")
|
||||
private Long handlingSpecificationsId;
|
||||
|
||||
@Schema(description = "搬运规格名称", example = "23178")
|
||||
@ExcelProperty("搬运规格名称")
|
||||
private String handlingSpecificationsName;
|
||||
|
||||
@Schema(description = "数量", example = "15611")
|
||||
@ExcelProperty("数量")
|
||||
private Integer totalCount;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
@ExcelProperty("日期 格式 yyyy-MM-dd")
|
||||
private String dateStr;
|
||||
|
||||
@Schema(description = "总金额(根据规格和总量计算出 该搬运组获得的总金额)")
|
||||
@ExcelProperty("总金额(根据规格和总量计算出 该搬运组获得的总金额)")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@Schema(description = "金额小计")
|
||||
@ExcelProperty("金额小计")
|
||||
private BigDecimal totalAmount;
|
||||
@Schema(description = "数量小计")
|
||||
@ExcelProperty("数量小计")
|
||||
private Integer totalNum;
|
||||
|
||||
@Schema(description = "搬运工明细列表")
|
||||
private List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS;
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -10,7 +9,6 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ -23,15 +21,6 @@ public class HandlingGroupAmountSpecificationsPageReqVO extends PageParam {
|
||||
@Schema(description = "工厂id", example = "23178")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "搬运组id", example = "23178")
|
||||
private Long handlingGroupId;
|
||||
|
||||
@Schema(description = "叉车司机名称", example = "23178")
|
||||
private String staffName;
|
||||
|
||||
@Schema(description = "搬运工名称", example = "23178")
|
||||
private String porterName;
|
||||
|
||||
@Schema(description = "搬运规格id", example = "23178")
|
||||
private Long handlingSpecificationsId;
|
||||
|
||||
@ -48,7 +37,4 @@ public class HandlingGroupAmountSpecificationsPageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "工厂ids", example = "23178")
|
||||
private List<Long> factoryIds;
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@ -8,7 +7,6 @@ import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 搬运组工资规格关联 Response VO")
|
||||
@Data
|
||||
@ -25,46 +23,28 @@ public class HandlingGroupAmountSpecificationsRespVO {
|
||||
@Schema(description = "工厂名称", example = "23178")
|
||||
private String factoryName;
|
||||
|
||||
@Schema(description = "搬运组id", example = "23178")
|
||||
@ExcelProperty("搬运组id")
|
||||
private Long handlingGroupId;
|
||||
|
||||
@Schema(description = "搬运组名称", example = "23178")
|
||||
@ExcelProperty("搬运组名称")
|
||||
private String handlingGroupName;
|
||||
|
||||
@Schema(description = "叉车司机名称", example = "23178")
|
||||
@ExcelProperty("叉车司机名称")
|
||||
private String staffName;
|
||||
|
||||
@Schema(description = "叉车司机id", example = "23178")
|
||||
@ExcelProperty("叉车司机id")
|
||||
private Long staffId;
|
||||
@Schema(description = "搬运规格id", example = "23178")
|
||||
@ExcelProperty("搬运规格id")
|
||||
private Long handlingSpecificationsId;
|
||||
|
||||
@Schema(description = "搬运规格名称", example = "23178")
|
||||
@ExcelProperty("搬运规格名称")
|
||||
private List<SpecificationDetailVO> specificationDetails;
|
||||
private String handlingSpecificationsName;
|
||||
|
||||
@Schema(description = "数量", example = "15611")
|
||||
@ExcelProperty("数量")
|
||||
private Integer totalCount;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
@ExcelProperty("日期 格式 yyyy-MM-dd")
|
||||
private String dateStr;
|
||||
|
||||
@Schema(description = "总金额(根据规格和总量计算出 该搬运组获得的总金额)")
|
||||
@ExcelProperty("总金额(根据规格和总量计算出 该搬运组获得的总金额)")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@Schema(description = "金额小计")
|
||||
@ExcelProperty("金额小计")
|
||||
private BigDecimal totalAmount;
|
||||
@Schema(description = "数量小计")
|
||||
@ExcelProperty("数量小计")
|
||||
private Integer totalNum;
|
||||
/**
|
||||
* 搬运规格id 逗号隔开
|
||||
*/
|
||||
private String handlingSpecificationsIds;
|
||||
|
||||
@Schema(description = "搬运工明细列表")
|
||||
private List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS;
|
||||
}
|
||||
|
@ -1,84 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class HandlingGroupAmountSpecificationsRespVOV2 {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9721")
|
||||
@ExcelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂id", example = "23178")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "工厂名称", example = "23178")
|
||||
private String factoryName;
|
||||
|
||||
@Schema(description = "搬运组id", example = "23178")
|
||||
@ExcelProperty("搬运组id")
|
||||
private Long handlingGroupId;
|
||||
|
||||
@Schema(description = "搬运组名称", example = "23178")
|
||||
@ExcelProperty("搬运组名称")
|
||||
private String handlingGroupName;
|
||||
|
||||
@Schema(description = "叉车司机名称", example = "23178")
|
||||
@ExcelProperty("叉车司机名称")
|
||||
private String staffName;
|
||||
|
||||
@Schema(description = "叉车司机id", example = "23178")
|
||||
@ExcelProperty("叉车司机id")
|
||||
private Long staffId;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
@ExcelProperty("日期 格式 yyyy-MM-dd")
|
||||
private String dateStr;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description = "搬运规格id", example = "23178")
|
||||
@ExcelProperty("搬运规格id")
|
||||
private Long handlingSpecificationsId;
|
||||
|
||||
@Schema(description = "搬运规格名称", example = "23178")
|
||||
@ExcelProperty("搬运规格名称")
|
||||
private String handlingSpecificationsName;
|
||||
|
||||
@Schema(description = "数量", example = "15611")
|
||||
@ExcelProperty("数量")
|
||||
private Integer totalCount;
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description = "总金额(根据规格和总量计算出 该搬运组获得的总金额)")
|
||||
@ExcelProperty("总金额(根据规格和总量计算出 该搬运组获得的总金额)")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "金额小计")
|
||||
@ExcelProperty("金额小计")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@Schema(description = "数量小计")
|
||||
@ExcelProperty("数量小计")
|
||||
private Integer totalNum;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "搬运工明细列表")
|
||||
private List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class HandlingGroupAmountSpecificationsTotalNumVO {
|
||||
@Schema(description = "数量")
|
||||
private Long num;
|
||||
|
||||
@Schema(description = "总金额")
|
||||
private BigDecimal amount;
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 搬运组工资规格关联 DO
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Data
|
||||
public class HandlingGroupAmountSpecificationsVO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 工厂id
|
||||
*/
|
||||
private Long factoryId;
|
||||
/**
|
||||
* 搬运规格id
|
||||
*/
|
||||
private Long handlingSpecificationsId;
|
||||
/**
|
||||
* 搬运组id
|
||||
*/
|
||||
private Long handlingGroupId;
|
||||
|
||||
/**
|
||||
* 叉车司机id
|
||||
*/
|
||||
private Long staffId;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer totalCount;
|
||||
/**
|
||||
* 日期 格式 yyyy-MM-dd
|
||||
*/
|
||||
private String dateStr;
|
||||
/**
|
||||
* 总金额(根据规格和总量计算出 该搬运组获得的总金额)
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 金额合计
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BigDecimal totalAmount;
|
||||
/**
|
||||
* 数量合计
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer totalNum;
|
||||
/**
|
||||
* 工厂名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String factoryName;
|
||||
/**
|
||||
* 搬运组名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String handlingGroupName;
|
||||
/**
|
||||
* 叉车司机名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String staffName;
|
||||
/**
|
||||
* 搬运规格id 逗号隔开
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<SpecificationDetailVO> specificationDetails;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SpecificationDetailVO {
|
||||
@Schema(description = "工厂搬运规格id", example = "23178")
|
||||
private Long handlingSpecificationsId;
|
||||
|
||||
@Schema(description = "规格名称", example = "标准规格")
|
||||
private String handlingSpecificationsName;
|
||||
|
||||
@Schema(description = "数量", example = "23178")
|
||||
private Integer totalCount;
|
||||
|
||||
@Schema(description = "金额", example = "23178")
|
||||
private BigDecimal amount;
|
||||
|
||||
public SpecificationDetailVO() {
|
||||
}
|
||||
|
||||
public SpecificationDetailVO(Long handlingSpecificationsId, String handlingSpecificationsName, Integer totalCount, BigDecimal amount) {
|
||||
this.handlingSpecificationsId = handlingSpecificationsId;
|
||||
this.handlingSpecificationsName = handlingSpecificationsName;
|
||||
this.totalCount = totalCount;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
@ -85,13 +85,6 @@ public class HandlingGroupUserAmountController {
|
||||
return success(BeanUtils.toBean(pageResult, HandlingGroupUserAmountRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/listAll")
|
||||
@Operation(summary = "获得搬运组每日个人工资记录列表")
|
||||
public CommonResult<List<HandlingGroupUserAmountRespVO>> getHandlingGroupUserAmountList(@Valid HandlingGroupUserAmountPageReqVO pageReqVO) {
|
||||
List<HandlingGroupUserAmountDO> list = handlingGroupUserAmountService.getHandlingGroupUserAmountList(pageReqVO);
|
||||
return success(BeanUtils.toBean(list, HandlingGroupUserAmountRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/staffWagesPage")
|
||||
@Operation(summary = "以用户分组工资分页列表")
|
||||
public CommonResult<PageResult<StaffWagesPageVO>> staffWagesPage(@Valid StaffWagesPageDTO dto) {
|
||||
@ -99,15 +92,6 @@ public class HandlingGroupUserAmountController {
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/confirm")
|
||||
@Operation(summary = "确认搬运组薪资")
|
||||
public CommonResult<Boolean> confirmHandlingGroupUserAmount(@RequestParam("factoryId") Long factoryId,
|
||||
@RequestParam("month") String month) {
|
||||
|
||||
handlingGroupUserAmountService.confirmHandlingGroupUserAmount(factoryId, month);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出搬运组每日个人工资记录 Excel")
|
||||
@OperateLog(type = EXPORT)
|
||||
|
@ -18,6 +18,9 @@ public class StaffWagesPageDTO extends PageParam {
|
||||
@Schema(description = "工厂id", example = "12639")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "搬运组工资规格关联id", example = "27617")
|
||||
private Long handlingGroupAmountSpecificationsId;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
private String dateStr;
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class HandlingGroupUserAmountItemVO {
|
||||
@Schema(description = "用户id", example = "12639")
|
||||
@ExcelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户名称", example = "12639")
|
||||
@ExcelProperty("用户名称")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "搬运组每日个人工资")
|
||||
@ExcelProperty("搬运组每日个人工资")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "状态 0未确认 1已确认")
|
||||
private Integer status;
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@ -21,11 +19,8 @@ public class HandlingGroupUserAmountPageReqVO extends PageParam {
|
||||
@Schema(description = "用户id", example = "12639")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "工厂id", example = "27617")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "搬运组id", example = "27617")
|
||||
private Long handlingGroupId;
|
||||
@Schema(description = "搬运组工资规格关联id", example = "27617")
|
||||
private Long handlingGroupAmountSpecificationsId;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
private String dateStr;
|
||||
|
@ -1,12 +1,13 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 搬运组每日个人工资记录 Response VO")
|
||||
@Data
|
||||
@ -25,6 +26,10 @@ public class HandlingGroupUserAmountRespVO {
|
||||
@ExcelProperty("用户名称")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "搬运组工资规格关联id", example = "27617")
|
||||
@ExcelProperty("搬运组工资规格关联id")
|
||||
private Long handlingGroupAmountSpecificationsId;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
@ExcelProperty("日期 格式 yyyy-MM-dd")
|
||||
private String dateStr;
|
||||
@ -33,9 +38,6 @@ public class HandlingGroupUserAmountRespVO {
|
||||
@ExcelProperty("搬运组每日个人工资")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "状态 0.未确认 1.已确认")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
@ -1,8 +1,10 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 搬运组每日个人工资记录新增/修改 Request VO")
|
||||
@ -18,8 +20,8 @@ public class HandlingGroupUserAmountSaveReqVO {
|
||||
@Schema(description = "工厂id", example = "12639")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "搬运组id", example = "12639")
|
||||
private Long handlingGroupId;
|
||||
@Schema(description = "搬运组工资规格关联id", example = "27617")
|
||||
private Long handlingGroupAmountSpecificationsId;
|
||||
|
||||
@Schema(description = "日期 格式 yyyy-MM-dd")
|
||||
private String dateStr;
|
||||
|
@ -1,37 +1,33 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlingspecifications.HandlingSpecificationsDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factoryinfo.FactoryInfoService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.handlingspecifications.HandlingSpecificationsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlingspecifications.HandlingSpecificationsDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.handlingspecifications.HandlingSpecificationsService;
|
||||
|
||||
@Tag(name = "管理后台 - 工厂搬运规格")
|
||||
@RestController
|
||||
@ -42,9 +38,6 @@ public class HandlingSpecificationsController {
|
||||
@Resource
|
||||
private HandlingSpecificationsService handlingSpecificationsService;
|
||||
|
||||
@Resource
|
||||
private FactoryInfoService factoryInfoService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建工厂搬运规格")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:handling-specifications:create')")
|
||||
@ -106,38 +99,4 @@ public class HandlingSpecificationsController {
|
||||
BeanUtils.toBean(list, HandlingSpecificationsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-import-template")
|
||||
@Operation(summary = "获得导入用户模板")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||
|
||||
//获取部门名称
|
||||
List<FactoryInfoDO> factoryInfoDOS = factoryInfoService.getFactoryListByType();
|
||||
List<String> factoryName = factoryInfoDOS.stream()
|
||||
.map(item -> item.getId() + ":" + item.getShortName())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 类型选择
|
||||
List<String> type = Arrays.asList("0:数量", "1:重量");
|
||||
|
||||
Map<Integer, List<String>> mapDropDown = new HashMap<>();
|
||||
mapDropDown.put(0, factoryName);
|
||||
mapDropDown.put(2, type);
|
||||
|
||||
// 输出
|
||||
ExcelUtils.write(response, "搬运规格列表模板.xlsx", "搬运规格列表",
|
||||
HandlingSpecificationsImportVO.class, null,
|
||||
mapDropDown);
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
@Operation(summary = "导入搬运规格列表")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
|
||||
})
|
||||
public CommonResult<HandlingSpecificationsImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
||||
List<HandlingSpecificationsImportVO> list = ExcelUtils.read(file, HandlingSpecificationsImportVO.class);
|
||||
return success(handlingSpecificationsService.importList(list, updateSupport));
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "管理后台 - 用户导入 Response VO")
|
||||
@Data
|
||||
@Builder
|
||||
public class HandlingSpecificationsImportRespVO {
|
||||
|
||||
@Schema(description = "创建成功的用户名数组", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<String> createUsernames;
|
||||
|
||||
@Schema(description = "更新成功的用户名数组", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<String> updateUsernames;
|
||||
|
||||
@Schema(description = "导入失败的用户集合,key 为用户名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Map<String, String> failureUsernames;
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂搬运规格导入 Request VO")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题
|
||||
public class HandlingSpecificationsImportVO {
|
||||
|
||||
@ExcelProperty("厂区名称")
|
||||
@NotNull(message = "厂区名称不能为空")
|
||||
private String factoryName;
|
||||
|
||||
@ExcelProperty("规格名称")
|
||||
@NotNull(message = "规格名称不能为空")
|
||||
private String specificationsName;
|
||||
|
||||
@ExcelProperty("类型")
|
||||
@NotNull(message = "类型不能为空")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("重量 /(公斤 kg)")
|
||||
private BigDecimal weight;
|
||||
|
||||
@ExcelProperty("单价/(吨/1000 or 件)")
|
||||
@NotNull(message = "单价不能为空")
|
||||
private BigDecimal unitPrice;
|
||||
}
|
@ -55,6 +55,7 @@ public class StaffController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建员工")
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:create')")
|
||||
public CommonResult<Long> createStaff(@Valid @RequestBody StaffSaveReqVO createReqVO) {
|
||||
return success(staffService.createStaff(createReqVO));
|
||||
}
|
||||
@ -67,6 +68,7 @@ public class StaffController {
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新员工")
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:update')")
|
||||
public CommonResult<Boolean> updateStaff(@Valid @RequestBody StaffSaveReqVO updateReqVO) {
|
||||
staffService.updateStaff(updateReqVO);
|
||||
return success(true);
|
||||
@ -74,6 +76,7 @@ public class StaffController {
|
||||
|
||||
@PutMapping("/update-salary")
|
||||
@Operation(summary = "更新员工")
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:update')")
|
||||
public CommonResult<Boolean> updateStaffSalary(@RequestBody StaffSalaryUpdateVO updateReqVO) {
|
||||
staffService.updateStaffSalary(updateReqVO);
|
||||
return success(true);
|
||||
@ -82,6 +85,7 @@ public class StaffController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除员工")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:delete')")
|
||||
public CommonResult<Boolean> deleteStaff(@RequestParam("id") Long id) {
|
||||
staffService.deleteStaff(id);
|
||||
return success(true);
|
||||
@ -90,6 +94,7 @@ public class StaffController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得员工")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:query')")
|
||||
public CommonResult<StaffDO> getStaff(@RequestParam("id") Long id) {
|
||||
StaffDO staff = staffService.getStaff(id);
|
||||
return success(staff);
|
||||
@ -99,6 +104,7 @@ public class StaffController {
|
||||
@Operation(summary = "获得指定厂区得员工")
|
||||
@Parameter(name = "factoryId", description = "厂区编号", required = true, example = "1024")
|
||||
@Parameter(name = "isIn", description = "是否获取该厂区得员工", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:query')")
|
||||
public CommonResult<List<StaffRespVO>> getListByFactory(@RequestParam("factoryId") Long factoryId,
|
||||
@RequestParam("isIn") Boolean isIn) {
|
||||
List<StaffDO> staffs = staffService.getListByFactory(factoryId, isIn);
|
||||
@ -109,14 +115,14 @@ public class StaffController {
|
||||
@GetMapping("/getListByFactoryId")
|
||||
@Operation(summary = "获得指定厂员工")
|
||||
public CommonResult<List<StaffRespVO>> getListByFactoryId(@RequestParam("factoryId") Long factoryId,
|
||||
@RequestParam(value = "nickName", required = false) String nickName,
|
||||
@RequestParam(value = "workTypeId", required = false) Long workTypeId) {
|
||||
List<StaffDO> staffs = staffService.getListByFactoryId(factoryId, nickName, workTypeId);
|
||||
@RequestParam(value = "nickName", required = false) String nickName) {
|
||||
List<StaffDO> staffs = staffService.getListByFactoryId(factoryId, nickName);
|
||||
return success(BeanUtils.toBean(staffs, StaffRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得员工分页")
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:query')")
|
||||
public CommonResult<PageResult<StaffRespVO>> getStaffPage(@Valid StaffPageReqVO pageReqVO) {
|
||||
PageResult<StaffDO> pageResult = staffService.getStaffPage(pageReqVO);
|
||||
PageResult<StaffRespVO> result = BeanUtils.toBean(pageResult, StaffRespVO.class);
|
||||
@ -136,6 +142,7 @@ public class StaffController {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出员工 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportStaffExcel(@Valid StaffPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@ -153,7 +160,7 @@ public class StaffController {
|
||||
//获取部门名称
|
||||
List<FactoryInfoDO> factoryInfoDOS = factoryInfoService.getFactoryListByType();
|
||||
List<String> factoryName = factoryInfoDOS.stream()
|
||||
.map(item -> item.getId() + ":" + item.getShortName())
|
||||
.map(item -> item.getId() + ":" + item.getName())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//获取工种名称
|
||||
@ -185,6 +192,7 @@ public class StaffController {
|
||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('factory:staff:import')")
|
||||
public CommonResult<StaffImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
||||
List<StaffImportExcelVO> list = ExcelUtils.read(file, StaffImportExcelVO.class);
|
||||
|
@ -41,12 +41,6 @@ public class StaffImportExcelVO {
|
||||
@IdCard
|
||||
private String idCard;
|
||||
|
||||
@ExcelProperty("银行名称")
|
||||
private String bankName;
|
||||
|
||||
@ExcelProperty("银行卡号")
|
||||
private String bankNo;
|
||||
|
||||
@ExcelProperty("薪资")
|
||||
private BigDecimal salary;
|
||||
}
|
||||
|
@ -39,12 +39,14 @@ public class StaffSalaryController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建员工工资")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:create')")
|
||||
public CommonResult<Long> createStaff(@Valid @RequestBody StaffSalarySaveReqVO createReqVO) {
|
||||
return success(staffSalaryService.createStaffSalary(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新厂区员工工资")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:update')")
|
||||
public CommonResult<Boolean> updateStaffSalary(@Valid @RequestBody StaffSalarySaveReqVO updateReqVO) {
|
||||
staffSalaryService.updateStaffSalary(updateReqVO);
|
||||
return success(true);
|
||||
@ -52,6 +54,7 @@ public class StaffSalaryController {
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新厂区员工工资状态")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:update')")
|
||||
public CommonResult<Boolean> updateStatus(@RequestBody StaffSalarySaveReqVO updateReqVO) {
|
||||
staffSalaryService.updateStatus(updateReqVO);
|
||||
return success(true);
|
||||
@ -60,6 +63,7 @@ public class StaffSalaryController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除厂区员工工资")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:delete')")
|
||||
public CommonResult<Boolean> deleteStaffSalary(@RequestParam("id") Long id) {
|
||||
staffSalaryService.deleteStaffSalary(id);
|
||||
return success(true);
|
||||
@ -68,6 +72,7 @@ public class StaffSalaryController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得厂区员工工资")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:query')")
|
||||
public CommonResult<StaffSalaryRespVO> getStaffSalary(@RequestParam("id") Long id) {
|
||||
StaffSalaryDO staffSalary = staffSalaryService.getStaffSalary(id);
|
||||
|
||||
@ -76,6 +81,7 @@ public class StaffSalaryController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得厂区员工工资分页")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:query')")
|
||||
public CommonResult<PageResult<StaffSalaryRespVO>> getStaffSalaryPage(@Valid StaffSalaryPageReqVO pageReqVO) {
|
||||
PageResult<StaffSalaryRespVO> pageResult = staffSalaryService.getStaffSalaryPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
@ -83,6 +89,7 @@ public class StaffSalaryController {
|
||||
|
||||
@GetMapping("/total")
|
||||
@Operation(summary = "获取工资统计")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:query')")
|
||||
public CommonResult<SalaryTotalVO> getStaffSalaryTotal(@Valid StaffSalaryPageReqVO pageReqVO) {
|
||||
|
||||
return success(staffSalaryService.getStaffSalaryTotal(pageReqVO));
|
||||
@ -90,6 +97,7 @@ public class StaffSalaryController {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出厂区员工工资 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportStaffSalaryExcel(@Valid StaffSalaryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
@ -31,7 +31,4 @@ public class StaffSalaryPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "工厂编码集合")
|
||||
private List<Long> factoryIds;
|
||||
|
||||
@Schema(description = "是否发放工资 | 0未发放 1已发放", example = "0")
|
||||
private Integer isGrant;
|
||||
}
|
@ -77,7 +77,4 @@ public class StaffSalaryRespVO {
|
||||
|
||||
@Schema(description = "借支金额")
|
||||
private BigDecimal loanAmount;
|
||||
|
||||
@Schema(description = "是否发放工资 | 0未发放 1已发放")
|
||||
private Integer isGrant;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 搬运组 DO
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@TableName("sf_handling_group")
|
||||
@KeySequence("sf_handling_group_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HandlingGroupDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 工厂id
|
||||
*/
|
||||
private Long factoryId;
|
||||
/**
|
||||
* 搬运组名称
|
||||
*/
|
||||
private String handlingGroupName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String factoryName;
|
||||
|
||||
/**
|
||||
* 搬运日期
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String dateStr;
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.SpecificationDetailVO;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 搬运组工资规格关联 DO
|
||||
@ -17,8 +17,7 @@ import java.util.List;
|
||||
* @author 艾楷
|
||||
*/
|
||||
@TableName("sf_handling_group_amount_specifications")
|
||||
@KeySequence("sf_handling_group_amount_specifications_seq")
|
||||
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@KeySequence("sf_handling_group_amount_specifications_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@ -40,21 +39,9 @@ public class HandlingGroupAmountSpecificationsDO extends BaseDO {
|
||||
* 搬运规格id
|
||||
*/
|
||||
private Long handlingSpecificationsId;
|
||||
/**
|
||||
* 搬运规格名称
|
||||
*/
|
||||
|
||||
@TableField(exist = false)
|
||||
private String handlingSpecificationsName;
|
||||
/**
|
||||
* 搬运组id
|
||||
*/
|
||||
private Long handlingGroupId;
|
||||
|
||||
/**
|
||||
* 叉车司机id
|
||||
*/
|
||||
private Long staffId;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ -67,34 +54,5 @@ public class HandlingGroupAmountSpecificationsDO extends BaseDO {
|
||||
* 总金额(根据规格和总量计算出 该搬运组获得的总金额)
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 金额合计
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BigDecimal totalAmount;
|
||||
/**
|
||||
* 数量合计
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer totalNum;
|
||||
/**
|
||||
* 工厂名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String factoryName;
|
||||
/**
|
||||
* 搬运组名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String handlingGroupName;
|
||||
/**
|
||||
* 叉车司机名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String staffName;
|
||||
/**
|
||||
* 搬运规格id 逗号隔开
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<SpecificationDetailVO> specificationDetails;
|
||||
|
||||
}
|
||||
|
@ -41,10 +41,9 @@ public class HandlingGroupUserAmountDO extends BaseDO {
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 搬运组id
|
||||
* 搬运组工资规格关联id
|
||||
*/
|
||||
private Long handlingGroupId;
|
||||
|
||||
private Long handlingGroupAmountSpecificationsId;
|
||||
/**
|
||||
* 工厂id
|
||||
*/
|
||||
@ -58,8 +57,4 @@ public class HandlingGroupUserAmountDO extends BaseDO {
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 状态 1未确认 2已确认
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
|
@ -80,9 +80,4 @@ public class StaffSalaryDO extends BaseDO {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否发放工资 | 0未发放 1已发放
|
||||
*/
|
||||
private Integer isGrant;
|
||||
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroup;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsPageReqDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 搬运组 Mapper
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Mapper
|
||||
public interface HandlingGroupMapper extends BaseMapperX<HandlingGroupDO> {
|
||||
|
||||
default PageResult<HandlingGroupDO> selectPage(HandlingGroupPageReqVO reqVO) {
|
||||
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<HandlingGroupDO>()
|
||||
.eqIfPresent(HandlingGroupDO::getFactoryId, reqVO.getFactoryId())
|
||||
.likeIfPresent(HandlingGroupDO::getHandlingGroupName, reqVO.getHandlingGroupName())
|
||||
.betweenIfPresent(HandlingGroupDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(HandlingGroupDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
IPage<HandlingGroupDO> selectPageList(@Param("page") Page<Object> page, @Param("vo") HandlingGroupPageReqVO vo);
|
||||
|
||||
/**
|
||||
* 根据时间分组查询分页
|
||||
*
|
||||
* @param page
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
IPage<HandlingGroupAmountSpecificationsVO> selectPageListByDateStr(@Param("page") Page<Object> page, @Param("vo") HandlingGroupAmountSpecificationsPageReqDTO vo);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
HandlingGroupDO getHandlingGroup(@Param("id") Long id);
|
||||
}
|
@ -3,17 +3,13 @@ package cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupamountspecif
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsTotalNumDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsTotalNumVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 搬运组工资规格关联 Mapper
|
||||
*
|
||||
@ -48,22 +44,4 @@ public interface HandlingGroupAmountSpecificationsMapper extends BaseMapperX<Han
|
||||
* @return
|
||||
*/
|
||||
HandlingGroupAmountSpecificationsDO getHandlingGroupAmountSpecifications(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 获取详情 多条
|
||||
*
|
||||
* @param factoryId
|
||||
* @param dateStr
|
||||
* @param handlingGroupId
|
||||
* @return
|
||||
*/
|
||||
List<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsList(@Param("factoryId") Long factoryId, @Param("dateStr") String dateStr, @Param("handlingGroupId") Long handlingGroupId);
|
||||
|
||||
/**
|
||||
* 获取总金额
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(@Param("dto") HandlingGroupAmountSpecificationsTotalNumDTO dto);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* 搬运组每日个人工资记录 Mapper
|
||||
@ -26,6 +27,7 @@ public interface HandlingGroupUserAmountMapper extends BaseMapperX<HandlingGroup
|
||||
default PageResult<HandlingGroupUserAmountDO> selectPage(HandlingGroupUserAmountPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<HandlingGroupUserAmountDO>()
|
||||
.eqIfPresent(HandlingGroupUserAmountDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(HandlingGroupUserAmountDO::getHandlingGroupAmountSpecificationsId, reqVO.getHandlingGroupAmountSpecificationsId())
|
||||
.eqIfPresent(HandlingGroupUserAmountDO::getDateStr, reqVO.getDateStr())
|
||||
.eqIfPresent(HandlingGroupUserAmountDO::getAmount, reqVO.getAmount())
|
||||
.betweenIfPresent(HandlingGroupUserAmountDO::getCreateTime, reqVO.getCreateTime())
|
||||
@ -50,35 +52,10 @@ public interface HandlingGroupUserAmountMapper extends BaseMapperX<HandlingGroup
|
||||
|
||||
/**
|
||||
* 获取月工资列表
|
||||
*
|
||||
* @param factoryId
|
||||
* @param dateList
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getListByMonth(@Param("id") Long id, @Param("factoryId") Long factoryId, @Param("dateList") List<String> dateList, @Param("name") String name);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<HandlingGroupUserAmountDO> getHandlingGroupUserAmountList(@Param("vo") HandlingGroupUserAmountPageReqVO vo);
|
||||
|
||||
List<HandlingGroupUserAmountDO> getByHandlingGroupIds(@Param("handlingGroupIds") List<Long> handlingGroupIds);
|
||||
|
||||
List<HandlingGroupUserAmountDO> selectAmountSum(@Param("factoryId") Long factoryId, @Param("month") String month);
|
||||
|
||||
Long selectIsExists(@Param("factoryId") Long factoryId, @Param("month") String month);
|
||||
|
||||
/**
|
||||
* 通过工厂列表ids 和日期列表 和 搬运组ids 获取
|
||||
*
|
||||
* @param factoryIds
|
||||
* @param dateStrList
|
||||
* @param handlingGroupIds
|
||||
* @return
|
||||
*/
|
||||
List<HandlingGroupUserAmountDO> getByFactorIdAndDateStrAndHandlingGroupId(@Param("factoryIds") List<Long> factoryIds, @Param("dateStrList") List<String> dateStrList, @Param("handlingGroupIds") List<Long> handlingGroupIds);
|
||||
}
|
||||
|
@ -44,11 +44,4 @@ public interface HandlingSpecificationsMapper extends BaseMapperX<HandlingSpecif
|
||||
* @return
|
||||
*/
|
||||
List<HandlingSpecificationsDO> getHandlingSpecificationsList(@Param("vo") HandlingSpecificationsPageReqVO vo);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
HandlingSpecificationsDO getHandlingSpecifications(@Param("id") Long id);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.smartfactory.dal.mysql.staffsalary;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.SalarySubjectItemsVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.SalaryTotalVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalaryPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalaryRespVO;
|
||||
@ -39,7 +40,6 @@ public interface StaffSalaryMapper extends BaseMapperX<StaffSalaryDO> {
|
||||
query.eqIfPresent(StaffSalaryDO::getFactoryId, reqVO.getFactoryId());
|
||||
query.inIfPresent(StaffSalaryDO::getFactoryId, reqVO.getFactoryIds());
|
||||
query.eqIfPresent(StaffSalaryDO::getStatus, reqVO.getStatus());
|
||||
query.eqIfPresent(StaffSalaryDO::getIsGrant, reqVO.getIsGrant());
|
||||
query.apply(Objects.nonNull(reqVO.getWorkTypeId()), "staff.work_type_id = {0} ", reqVO.getWorkTypeId());
|
||||
|
||||
return selectJoinPage(reqVO, StaffSalaryRespVO.class, query);
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.BpmOALeaveDTO;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOALoanApi;
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsTypeApi;
|
||||
import cn.iocoder.yudao.module.system.api.auth.AdminOauthUserOtherInfoApi;
|
||||
import cn.iocoder.yudao.module.system.api.customersettlement.SettlementApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.PostApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
@ -21,8 +21,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class, NotifyMessageSendApi.class,
|
||||
SubscribeMessageSendApi.class, ConfigApi.class, PermissionApi.class, AssetsTypeApi.class, LoanApi.class, BpmOALoanApi.class, AdminOauthUserOtherInfoApi.class,
|
||||
SettlementApi.class
|
||||
SubscribeMessageSendApi.class, ConfigApi.class, PermissionApi.class, AssetsTypeApi.class, LoanApi.class, BpmOALoanApi.class, AdminOauthUserOtherInfoApi.class
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -152,10 +152,4 @@ public interface FactoryInfoService {
|
||||
* @return 工厂列表
|
||||
*/
|
||||
List<FactoryInfoDO> getCompanyFactoryList();
|
||||
|
||||
/**
|
||||
* 获取登录用户工厂列表, 登陆用户无工厂则拉取所有工厂
|
||||
* @return 工厂列表
|
||||
*/
|
||||
List<FactoryInfoDO> getFactoryListByLoginUser();
|
||||
}
|
||||
|
@ -9,13 +9,14 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.ip.core.Area;
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryProfitVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryUpdateStatusReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.FactoryRollDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.ProvincesDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.factoryinfo.FactoryInfoMapper;
|
||||
import cn.iocoder.yudao.module.system.api.customersettlement.SettlementApi;
|
||||
import cn.iocoder.yudao.module.system.api.customersettlement.dto.SettlementItemDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||
@ -27,12 +28,11 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.FACTORY_INFO_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.FACTOYRY_EXISTS_STAFF;
|
||||
@ -58,9 +58,6 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
@Resource
|
||||
private PermissionApi permissionApi;
|
||||
|
||||
@Resource
|
||||
private SettlementApi settlementApi;
|
||||
|
||||
@Override
|
||||
public Long createFactoryInfo(FactoryInfoSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -289,11 +286,6 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
public List<FactoryProfitVO> getProfit(Long factoryId, String month) {
|
||||
|
||||
List<FactoryProfitVO> result = factoryInfoMapper.selectProfit(factoryId, month);
|
||||
|
||||
// 获取结算扣款明细
|
||||
List<SettlementItemDTO> itemList = settlementApi.getDeductionItems(factoryId, month).getCheckedData();
|
||||
Map<Long, List<SettlementItemDTO>> itemMap = convertMultiMap(itemList, SettlementItemDTO::getFactoryId);
|
||||
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
// 设置叉车毛利、打包毛利、搬运毛利 = 收入 - 扣款 - 人员工资 - 支出
|
||||
result.forEach(vo -> {
|
||||
@ -312,88 +304,12 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
.subtract(vo.getPorterageDeduction())
|
||||
.subtract(vo.getPorterageSalary())
|
||||
.subtract(vo.getTransportationExpenses()));
|
||||
|
||||
// 设置扣款明细
|
||||
List<SettlementItemDTO> item = itemMap.get(vo.getFactoryId());
|
||||
if (CollUtil.isNotEmpty(item)) {
|
||||
// 获取打包扣款明细
|
||||
List<SettlementItemDTO.Deduction> packageDeduction = item.stream()
|
||||
.filter(data -> data.getBusinessType() == 1)
|
||||
.flatMap( data -> data.getDeductionItems().stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取叉车扣款明细
|
||||
List<SettlementItemDTO.Deduction> forkliftDeduction = item.stream()
|
||||
.filter(data -> data.getBusinessType() == 2)
|
||||
.flatMap( data -> data.getDeductionItems().stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取搬运扣款明细
|
||||
List<SettlementItemDTO.Deduction> porterageDeduction = item.stream()
|
||||
.filter(data -> data.getBusinessType() == 3)
|
||||
.flatMap( data -> data.getDeductionItems().stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 设置打包扣款
|
||||
vo.setPackageDeductionItem(getDeduction(packageDeduction));
|
||||
// 设置叉车扣款
|
||||
vo.setForkliftDeductionItem(getDeduction(forkliftDeduction));
|
||||
// 设置搬运扣款
|
||||
vo.setPorterageDeductionItem(getDeduction(porterageDeduction));
|
||||
}else {
|
||||
// 设置打包扣款
|
||||
vo.setPackageDeductionItem(getDeduction(null));
|
||||
// 设置叉车扣款
|
||||
vo.setForkliftDeductionItem(getDeduction(null));
|
||||
// 设置搬运扣款
|
||||
vo.setPorterageDeductionItem(getDeduction(null));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private FactoryProfitVO.Deduction getDeduction(List<SettlementItemDTO.Deduction> item) {
|
||||
|
||||
FactoryProfitVO.Deduction deduction = new FactoryProfitVO.Deduction();
|
||||
if (CollUtil.isNotEmpty(item)) {
|
||||
BigDecimal administrativePenalty = item.stream()
|
||||
.filter(data -> "xzfk".equals(data.getKey()))
|
||||
.map(SettlementItemDTO.Deduction::getValue)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
BigDecimal damagePenalty = item.stream()
|
||||
.filter(data -> "psfk".equals(data.getKey()))
|
||||
.map(SettlementItemDTO.Deduction::getValue)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
BigDecimal missPenalty = item.stream()
|
||||
.filter(data -> "sjkk".equals(data.getKey()))
|
||||
.map(SettlementItemDTO.Deduction::getValue)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
BigDecimal other = item.stream()
|
||||
.filter(data -> !"xzfk".equals(data.getKey()) && !"psfk".equals(data.getKey()) && !"sjkk".equals(data.getKey()))
|
||||
.map(SettlementItemDTO.Deduction::getValue)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 设置扣款项,默认为 0
|
||||
deduction.setAdministrativePenalty(administrativePenalty);
|
||||
deduction.setDamagePenalty(damagePenalty);
|
||||
deduction.setMissPenalty(missPenalty);
|
||||
deduction.setOtherPenalty(other);
|
||||
} else {
|
||||
// 如果 item 为空,则所有值设为 0
|
||||
deduction.setAdministrativePenalty(BigDecimal.ZERO);
|
||||
deduction.setDamagePenalty(BigDecimal.ZERO);
|
||||
deduction.setMissPenalty(BigDecimal.ZERO);
|
||||
deduction.setOtherPenalty(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
return deduction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryInfoDO> getCompanyFactoryList() {
|
||||
|
||||
@ -401,25 +317,4 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
.eq(FactoryInfoDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.in(FactoryInfoDO::getType, Arrays.asList(0,1)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryInfoDO> getFactoryListByLoginUser() {
|
||||
|
||||
List<Long> factoryIds = new ArrayList<>();
|
||||
// 获取自己所在工厂
|
||||
DeptRespDTO respDTO = deptApi.getDept(userApi.getUser(getLoginUserId()).getCheckedData().getDeptId()).getCheckedData();
|
||||
if (respDTO != null && respDTO.getFactoryId() != null) {
|
||||
factoryIds.add(respDTO.getFactoryId());
|
||||
}
|
||||
|
||||
// 查找担任负责人的工厂信息
|
||||
List<DeptRespDTO> deptRespDTO = deptApi.getDeptByLeaderId(getLoginUserId()).getCheckedData();
|
||||
|
||||
if (deptRespDTO != null) {
|
||||
|
||||
factoryIds.addAll(convertList(deptRespDTO, DeptRespDTO::getFactoryId));
|
||||
}
|
||||
|
||||
return factoryInfoMapper.selectListByType(factoryIds);
|
||||
}
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.handlinggroup;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 搬运组 Service 接口
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
public interface HandlingGroupService extends IService<HandlingGroupDO> {
|
||||
|
||||
/**
|
||||
* 创建搬运组
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createHandlingGroup(@Valid HandlingGroupSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新搬运组
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateHandlingGroup(@Valid HandlingGroupSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除搬运组
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteHandlingGroup(Long id);
|
||||
|
||||
/**
|
||||
* 获得搬运组
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 搬运组
|
||||
*/
|
||||
HandlingGroupDO getHandlingGroup(Long id);
|
||||
|
||||
/**
|
||||
* 获得搬运组分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 搬运组分页
|
||||
*/
|
||||
PageResult<HandlingGroupDO> getHandlingGroupPage(HandlingGroupPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.handlinggroup;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroup.HandlingGroupMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 搬运组 Service 实现类
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class HandlingGroupServiceImpl extends ServiceImpl<HandlingGroupMapper, HandlingGroupDO> implements HandlingGroupService {
|
||||
|
||||
@Resource
|
||||
private HandlingGroupMapper handlingGroupMapper;
|
||||
|
||||
@Override
|
||||
public Long createHandlingGroup(HandlingGroupSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
HandlingGroupDO handlingGroup = BeanUtils.toBean(createReqVO, HandlingGroupDO.class);
|
||||
handlingGroupMapper.insert(handlingGroup);
|
||||
// 返回
|
||||
return handlingGroup.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHandlingGroup(HandlingGroupSaveReqVO updateReqVO) {
|
||||
// 更新
|
||||
HandlingGroupDO updateObj = BeanUtils.toBean(updateReqVO, HandlingGroupDO.class);
|
||||
handlingGroupMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteHandlingGroup(Long id) {
|
||||
// 删除
|
||||
handlingGroupMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HandlingGroupDO getHandlingGroup(Long id) {
|
||||
return handlingGroupMapper.getHandlingGroup(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<HandlingGroupDO> getHandlingGroupPage(HandlingGroupPageReqVO pageReqVO) {
|
||||
IPage<HandlingGroupDO> pageResult = handlingGroupMapper.selectPageList(MyBatisUtils.buildPage(pageReqVO), pageReqVO);
|
||||
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +1,41 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecifications;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsPageReqDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsTotalNumDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 搬运组工资规格关联 Service 接口
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
public interface HandlingGroupAmountSpecificationsService extends IService<HandlingGroupAmountSpecificationsDO> {
|
||||
public interface HandlingGroupAmountSpecificationsService {
|
||||
|
||||
/**
|
||||
* 创建搬运组工资规格关联
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createHandlingGroupAmountSpecifications(@Valid HandlingGroupAmountSpecificationsSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新搬运组工资规格关联
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateHandlingGroupAmountSpecifications(@Valid HandlingGroupAmountSpecificationsSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除搬运组工资规格关联
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteHandlingGroupAmountSpecifications(Long id);
|
||||
|
||||
/**
|
||||
* 获得搬运组工资规格关联
|
||||
@ -27,16 +45,6 @@ public interface HandlingGroupAmountSpecificationsService extends IService<Handl
|
||||
*/
|
||||
HandlingGroupAmountSpecificationsDO getHandlingGroupAmountSpecifications(Long id);
|
||||
|
||||
/**
|
||||
* 获取详情 - 多条
|
||||
*
|
||||
* @param factoryId
|
||||
* @param dateStr
|
||||
* @param handlingGroupId
|
||||
* @return
|
||||
*/
|
||||
List<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsList(Long factoryId, String dateStr, Long handlingGroupId);
|
||||
|
||||
/**
|
||||
* 获得搬运组工资规格关联分页
|
||||
*
|
||||
@ -46,45 +54,15 @@ public interface HandlingGroupAmountSpecificationsService extends IService<Handl
|
||||
PageResult<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsPage(HandlingGroupAmountSpecificationsPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 批量新增
|
||||
* 新增编辑
|
||||
*
|
||||
* @param createReqVO
|
||||
*/
|
||||
void createOrEdit(@Valid HandlingGroupAmountSpecificationsSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 批量新增
|
||||
* @param vo
|
||||
*/
|
||||
void batchCreate(@Valid HandlingGroupAmountSpecificationsBatchCreateVO vo);
|
||||
|
||||
/**
|
||||
* 批量更新
|
||||
*
|
||||
* @param vo
|
||||
*/
|
||||
void batchUpdate(@Valid HandlingGroupAmountSpecificationsBatchUpdateVO vo);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param vo
|
||||
*/
|
||||
void batchDelete(HandlingGroupAmountSpecificationsBatchDelVO vo);
|
||||
|
||||
/**
|
||||
* 获取合计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto);
|
||||
|
||||
/**
|
||||
* 获取金额小计
|
||||
*
|
||||
* @param totalCount
|
||||
* @param handlingSpecificationsId
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getAmountSubtotal(Integer totalCount, Long handlingSpecificationsId);
|
||||
|
||||
/**
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
*/
|
||||
PageResult<HandlingGroupAmountSpecificationsRespVO> getHandlingGroupAmountSpecificationsPageV2(@Valid HandlingGroupAmountSpecificationsPageReqDTO pageReqVO);
|
||||
}
|
||||
|
@ -1,43 +1,31 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecifications;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupListVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsPageReqDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsTotalNumDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateItemVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlingspecifications.HandlingSpecificationsDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroup.HandlingGroupMapper;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsMapper;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.handlinggroupuseramount.HandlingGroupUserAmountService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.handlingspecifications.HandlingSpecificationsService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import com.alibaba.druid.sql.visitor.functions.Lpad;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.ADDED_A_HANDLING_GROUP_WITH_DUPLICATE_DATA;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.NEW_DATA_AND_OLD_DATA_HAVE_DUPLICATE_HANDLING_GROUP;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.CANNOT_FIND_THE_CORRESPONDING_FACTORY_HANDLING_SPECIFICATION;
|
||||
|
||||
/**
|
||||
* 搬运组工资规格关联 Service 实现类
|
||||
@ -46,83 +34,91 @@ import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.NEW_
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class HandlingGroupAmountSpecificationsServiceImpl extends ServiceImpl<HandlingGroupAmountSpecificationsMapper, HandlingGroupAmountSpecificationsDO> implements HandlingGroupAmountSpecificationsService {
|
||||
public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGroupAmountSpecificationsService {
|
||||
|
||||
@Resource
|
||||
private HandlingGroupAmountSpecificationsMapper handlingGroupAmountSpecificationsMapper;
|
||||
@Resource
|
||||
private HandlingGroupMapper handlingGroupMapper;
|
||||
@Resource
|
||||
private HandlingSpecificationsService handlingSpecificationsService;
|
||||
@Resource
|
||||
private HandlingGroupUserAmountService handlingGroupUserAmountService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
private static final BigDecimal THOUSANDTH = new BigDecimal("0.001");
|
||||
|
||||
@Override
|
||||
public Long createHandlingGroupAmountSpecifications(HandlingGroupAmountSpecificationsSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecifications = BeanUtils.toBean(createReqVO, HandlingGroupAmountSpecificationsDO.class);
|
||||
handlingGroupAmountSpecificationsMapper.insert(handlingGroupAmountSpecifications);
|
||||
|
||||
// 返回
|
||||
return handlingGroupAmountSpecifications.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHandlingGroupAmountSpecifications(HandlingGroupAmountSpecificationsSaveReqVO updateReqVO) {
|
||||
// 更新
|
||||
HandlingGroupAmountSpecificationsDO updateObj = BeanUtils.toBean(updateReqVO, HandlingGroupAmountSpecificationsDO.class);
|
||||
HandlingSpecificationsDO handlingSpecificationsDO = handlingSpecificationsService.getById(updateObj.getHandlingSpecificationsId());
|
||||
if (handlingSpecificationsDO == null) {
|
||||
throw exception(CANNOT_FIND_THE_CORRESPONDING_FACTORY_HANDLING_SPECIFICATION);
|
||||
}
|
||||
BigDecimal totalAmount;
|
||||
if (handlingSpecificationsDO.getType() == 0) {
|
||||
totalAmount = new BigDecimal(updateReqVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
|
||||
} else {
|
||||
totalAmount = new BigDecimal(updateReqVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
|
||||
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
|
||||
}
|
||||
// 插入
|
||||
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecifications = BeanUtils.toBean(updateReqVO, HandlingGroupAmountSpecificationsDO.class);
|
||||
handlingGroupAmountSpecifications.setAmount(totalAmount);
|
||||
handlingGroupAmountSpecificationsMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteHandlingGroupAmountSpecifications(Long id) {
|
||||
// 删除
|
||||
handlingGroupAmountSpecificationsMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HandlingGroupAmountSpecificationsDO getHandlingGroupAmountSpecifications(Long id) {
|
||||
return handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecifications(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsList(Long factoryId, String dateStr, Long handlingGroupId) {
|
||||
return handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecificationsList(factoryId, dateStr, handlingGroupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsPage(HandlingGroupAmountSpecificationsPageReqVO pageReqVO) {
|
||||
// 判断当前登录人是否属于工厂主管
|
||||
List<DeptRespDTO> deptRespDTOS = deptApi.getDeptByLeaderId(getLoginUserId()).getCheckedData();
|
||||
List<DeptRespDTO> factoryDeptVOs = deptRespDTOS.stream().filter(item -> item.getFactoryId() != null).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(factoryDeptVOs)) {
|
||||
pageReqVO.setFactoryIds(factoryDeptVOs.stream().map(DeptRespDTO::getFactoryId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
IPage<HandlingGroupAmountSpecificationsDO> pageResult = handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecificationsPage(MyBatisUtils.buildPage(pageReqVO), pageReqVO);
|
||||
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createOrEdit(HandlingGroupAmountSpecificationsSaveReqVO createReqVO) {
|
||||
HandlingSpecificationsDO handlingSpecificationsDO = handlingSpecificationsService.getById(createReqVO.getHandlingSpecificationsId());
|
||||
if (handlingSpecificationsDO == null) {
|
||||
throw exception(CANNOT_FIND_THE_CORRESPONDING_FACTORY_HANDLING_SPECIFICATION);
|
||||
}
|
||||
BigDecimal totalAmount;
|
||||
if (handlingSpecificationsDO.getType() == 0) {
|
||||
totalAmount = new BigDecimal(createReqVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
|
||||
} else {
|
||||
totalAmount = new BigDecimal(createReqVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
|
||||
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
|
||||
}
|
||||
// 插入
|
||||
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecifications = BeanUtils.toBean(createReqVO, HandlingGroupAmountSpecificationsDO.class);
|
||||
handlingGroupAmountSpecifications.setAmount(totalAmount);
|
||||
handlingGroupAmountSpecificationsMapper.insertOrUpdate(handlingGroupAmountSpecifications);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchCreate(HandlingGroupAmountSpecificationsBatchCreateVO vo) {
|
||||
List<Long> newHandlingGroupIds = vo.getHandlingGroupList().stream().map(HandlingGroupListVO::getHandlingGroupId).collect(Collectors.toList());
|
||||
// -- 先判断 新增之中有没有冲突的搬运组
|
||||
int num = newHandlingGroupIds.size();
|
||||
List<Long> distinctList = newHandlingGroupIds.stream().distinct().collect(Collectors.toList());
|
||||
if (num > distinctList.size()) {
|
||||
throw exception(ADDED_A_HANDLING_GROUP_WITH_DUPLICATE_DATA);
|
||||
}
|
||||
// -- 再判断是否有重复的数据 - 同一天 同一个工厂 不可以出现两个相同的搬运组
|
||||
List<HandlingGroupAmountSpecificationsDO> oldList = this.list(new LambdaQueryWrapper<HandlingGroupAmountSpecificationsDO>()
|
||||
.eq(HandlingGroupAmountSpecificationsDO::getFactoryId, vo.getFactoryId())
|
||||
.eq(HandlingGroupAmountSpecificationsDO::getDateStr, vo.getDateStr()));
|
||||
List<Long> oldHandlingGroupIds = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(oldList)) {
|
||||
oldHandlingGroupIds = oldList.stream().map(HandlingGroupAmountSpecificationsDO::getHandlingGroupId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(CollUtil.intersection(distinctList, oldHandlingGroupIds))) {
|
||||
throw exception(NEW_DATA_AND_OLD_DATA_HAVE_DUPLICATE_HANDLING_GROUP);
|
||||
}
|
||||
|
||||
|
||||
List<HandlingGroupAmountSpecificationsDO> list = new ArrayList<>();
|
||||
// -- 获取到所有的规格列表
|
||||
List<Long> handlingSpecificationsIds = vo.getHandlingGroupList().stream()
|
||||
.flatMap(group -> group.getItemList().stream())
|
||||
.map(HandlingGroupAmountSpecificationsBatchCreateItemVO::getHandlingSpecificationsId)
|
||||
.collect(Collectors.toList());
|
||||
List<Long> handlingSpecificationsIds = vo.getItemVOS().stream().map(HandlingGroupAmountSpecificationsBatchCreateItemVO::getHandlingSpecificationsId).collect(Collectors.toList());
|
||||
List<HandlingSpecificationsDO> handlingSpecificationsDOS = handlingSpecificationsService.list(new LambdaQueryWrapper<HandlingSpecificationsDO>()
|
||||
.in(HandlingSpecificationsDO::getId, handlingSpecificationsIds));
|
||||
Map<Long, HandlingSpecificationsDO> map = handlingSpecificationsDOS.stream().collect(Collectors.toMap(HandlingSpecificationsDO::getId, item -> item));
|
||||
|
||||
for (HandlingGroupListVO handlingGroupListVO : vo.getHandlingGroupList()) {
|
||||
for (HandlingGroupAmountSpecificationsBatchCreateItemVO itemVO : handlingGroupListVO.getItemList()) {
|
||||
for (HandlingGroupAmountSpecificationsBatchCreateItemVO itemVO : vo.getItemVOS()) {
|
||||
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecificationsDO = new HandlingGroupAmountSpecificationsDO();
|
||||
BigDecimal totalAmount;
|
||||
HandlingSpecificationsDO handlingSpecificationsDO = map.get(itemVO.getHandlingSpecificationsId());
|
||||
@ -140,110 +136,8 @@ public class HandlingGroupAmountSpecificationsServiceImpl extends ServiceImpl<Ha
|
||||
handlingGroupAmountSpecificationsDO.setHandlingSpecificationsId(itemVO.getHandlingSpecificationsId());
|
||||
handlingGroupAmountSpecificationsDO.setAmount(totalAmount);
|
||||
handlingGroupAmountSpecificationsDO.setTotalCount(itemVO.getTotalCount());
|
||||
handlingGroupAmountSpecificationsDO.setHandlingGroupId(handlingGroupListVO.getHandlingGroupId());
|
||||
handlingGroupAmountSpecificationsDO.setStaffId(handlingGroupListVO.getStaffId());
|
||||
list.add(handlingGroupAmountSpecificationsDO);
|
||||
}
|
||||
}
|
||||
handlingGroupAmountSpecificationsMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchUpdate(HandlingGroupAmountSpecificationsBatchUpdateVO vo) {
|
||||
// 先通过 工厂 + 日期 + 组id 获取到当前编辑的搬运组
|
||||
List<HandlingGroupAmountSpecificationsDO> list = handlingGroupAmountSpecificationsMapper.selectList(new LambdaQueryWrapper<HandlingGroupAmountSpecificationsDO>()
|
||||
.eq(HandlingGroupAmountSpecificationsDO::getFactoryId, vo.getFactoryId())
|
||||
.eq(HandlingGroupAmountSpecificationsDO::getHandlingGroupId, vo.getHandlingGroupId())
|
||||
.eq(HandlingGroupAmountSpecificationsDO::getDateStr, vo.getDateStr()));
|
||||
|
||||
List<Long> handlingSpecificationsIds = vo.getItemList().stream().map(HandlingGroupAmountSpecificationsBatchCreateItemVO::getHandlingSpecificationsId).distinct().collect(Collectors.toList());
|
||||
List<HandlingSpecificationsDO> handlingSpecificationsDOS = handlingSpecificationsService.list(new LambdaQueryWrapper<HandlingSpecificationsDO>()
|
||||
.in(HandlingSpecificationsDO::getId, handlingSpecificationsIds));
|
||||
Map<Long, HandlingSpecificationsDO> map = handlingSpecificationsDOS.stream().collect(Collectors.toMap(HandlingSpecificationsDO::getId, item -> item));
|
||||
Map<Long, HandlingGroupAmountSpecificationsBatchCreateItemVO> handlingGroupAmountSpecificationsMap = vo.getItemList().stream()
|
||||
.collect(Collectors.toMap(HandlingGroupAmountSpecificationsBatchCreateItemVO::getId, item -> item));
|
||||
|
||||
for (HandlingGroupAmountSpecificationsDO item : list) {
|
||||
BigDecimal totalAmount;
|
||||
HandlingGroupAmountSpecificationsBatchCreateItemVO handlingGroupAmountSpecificationsBatchCreateItemVO
|
||||
= handlingGroupAmountSpecificationsMap.get(item.getId());
|
||||
item.setHandlingSpecificationsId(handlingGroupAmountSpecificationsBatchCreateItemVO.getHandlingSpecificationsId());
|
||||
HandlingSpecificationsDO handlingSpecificationsDO = map.get(item.getHandlingSpecificationsId());
|
||||
if (handlingSpecificationsDO == null) {
|
||||
continue;
|
||||
}
|
||||
if (handlingSpecificationsDO.getType() == 0) {
|
||||
totalAmount = new BigDecimal(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
|
||||
} else {
|
||||
totalAmount = new BigDecimal(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
|
||||
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
|
||||
}
|
||||
item.setAmount(totalAmount);
|
||||
item.setTotalCount(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount());
|
||||
item.setStaffId(vo.getStaffId());
|
||||
}
|
||||
handlingGroupAmountSpecificationsMapper.updateBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDelete(HandlingGroupAmountSpecificationsBatchDelVO vo) {
|
||||
List<HandlingGroupAmountSpecificationsDO> list = handlingGroupAmountSpecificationsMapper.selectList(new LambdaQueryWrapper<HandlingGroupAmountSpecificationsDO>()
|
||||
.eq(HandlingGroupAmountSpecificationsDO::getFactoryId, vo.getFactoryId())
|
||||
.eq(HandlingGroupAmountSpecificationsDO::getHandlingGroupId, vo.getHandlingGroupId())
|
||||
.eq(HandlingGroupAmountSpecificationsDO::getDateStr, vo.getDateStr()));
|
||||
List<Long> ids = list.stream().map(HandlingGroupAmountSpecificationsDO::getId).collect(Collectors.toList());
|
||||
handlingGroupAmountSpecificationsMapper.deleteBatchIds(ids);
|
||||
|
||||
handlingGroupUserAmountService.remove(new LambdaQueryWrapper<HandlingGroupUserAmountDO>()
|
||||
.eq(HandlingGroupUserAmountDO::getFactoryId, vo.getFactoryId())
|
||||
.eq(HandlingGroupUserAmountDO::getHandlingGroupId, vo.getHandlingGroupId())
|
||||
.eq(HandlingGroupUserAmountDO::getDateStr, vo.getDateStr()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto) {
|
||||
// 判断当前登录人是否属于工厂主管
|
||||
List<DeptRespDTO> deptRespDTOS = deptApi.getDeptByLeaderId(getLoginUserId()).getCheckedData();
|
||||
List<DeptRespDTO> factoryDeptVOs = deptRespDTOS.stream().filter(item -> item.getFactoryId() != null).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(factoryDeptVOs)) {
|
||||
dto.setFactoryIds(factoryDeptVOs.stream().map(DeptRespDTO::getFactoryId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
return handlingGroupAmountSpecificationsMapper.getTotalNum(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getAmountSubtotal(Integer totalCount, Long handlingSpecificationsId) {
|
||||
HandlingSpecificationsDO handlingSpecificationsDO = handlingSpecificationsService.getById(handlingSpecificationsId);
|
||||
BigDecimal totalAmount;
|
||||
if (handlingSpecificationsDO.getType() == 0) {
|
||||
totalAmount = new BigDecimal(totalCount.toString()).multiply(handlingSpecificationsDO.getUnitPrice());
|
||||
} else {
|
||||
totalAmount = new BigDecimal(totalCount.toString()).multiply(handlingSpecificationsDO.getWeight())
|
||||
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
|
||||
}
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<HandlingGroupAmountSpecificationsRespVO> getHandlingGroupAmountSpecificationsPageV2(HandlingGroupAmountSpecificationsPageReqDTO pageReqVO) {
|
||||
IPage<HandlingGroupAmountSpecificationsVO> handlingGroupPage = handlingGroupMapper.selectPageListByDateStr(MyBatisUtils.buildPage(pageReqVO), pageReqVO);
|
||||
// 搬运规格ids - 拼接 一起查询
|
||||
PageResult<HandlingGroupAmountSpecificationsVO> resultPage = new PageResult<>(handlingGroupPage.getRecords(), handlingGroupPage.getTotal());
|
||||
PageResult<HandlingGroupAmountSpecificationsRespVO> result = BeanUtils.toBean(resultPage, HandlingGroupAmountSpecificationsRespVO.class);
|
||||
List<Long> factoryIds = result.getList().stream().map(HandlingGroupAmountSpecificationsRespVO::getFactoryId).distinct().collect(Collectors.toList());
|
||||
List<String> dateStrList = result.getList().stream().map(HandlingGroupAmountSpecificationsRespVO::getDateStr).distinct().collect(Collectors.toList());
|
||||
List<Long> handlingGroupIds = result.getList().stream().map(HandlingGroupAmountSpecificationsRespVO::getHandlingGroupId).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(factoryIds) && CollUtil.isNotEmpty(dateStrList) && CollUtil.isNotEmpty(handlingGroupIds)) {
|
||||
// -- 工厂 - 时间 - 组
|
||||
List<HandlingGroupUserAmountDO> handlingGroupUserAmountDOS = handlingGroupUserAmountService.getByFactorIdAndDateStrAndHandlingGroupId(factoryIds, dateStrList, handlingGroupIds);
|
||||
Map<String, List<HandlingGroupUserAmountDO>> map = handlingGroupUserAmountDOS.stream().collect(Collectors.groupingBy(
|
||||
a -> a.getFactoryId() + "-" + a.getDateStr() + "-" + a.getHandlingGroupId()
|
||||
));
|
||||
for (HandlingGroupAmountSpecificationsRespVO handlingGroupAmountSpecificationsRespVO : result.getList()) {
|
||||
String key = handlingGroupAmountSpecificationsRespVO.getFactoryId() + "-" + handlingGroupAmountSpecificationsRespVO.getDateStr() + "-" + handlingGroupAmountSpecificationsRespVO.getHandlingGroupId();
|
||||
handlingGroupAmountSpecificationsRespVO.setHandlingGroupUserAmountItemVOS(BeanUtils.toBean(map.get(key), HandlingGroupUserAmountItemVO.class));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -7,17 +7,15 @@ import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseram
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.StaffWagesPageVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 搬运组每日个人工资记录 Service 接口
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
public interface HandlingGroupUserAmountService extends IService<HandlingGroupUserAmountDO> {
|
||||
public interface HandlingGroupUserAmountService {
|
||||
|
||||
/**
|
||||
* 创建搬运组每日个人工资记录
|
||||
@ -81,32 +79,4 @@ public interface HandlingGroupUserAmountService extends IService<HandlingGroupUs
|
||||
* @return
|
||||
*/
|
||||
HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, Integer type, String time, String name);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
*/
|
||||
List<HandlingGroupUserAmountDO> getHandlingGroupUserAmountList(HandlingGroupUserAmountPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 确认搬运工组薪资,确认后添加至员工薪资表
|
||||
*
|
||||
* @param factoryId
|
||||
* @param month
|
||||
*/
|
||||
void confirmHandlingGroupUserAmount(Long factoryId, String month);
|
||||
|
||||
List<HandlingGroupUserAmountDO> getByHandlingGroupIds(List<Long> handlingGroupIds);
|
||||
|
||||
/**
|
||||
* 通过工厂列表ids 和日期列表 和 搬运组ids 获取
|
||||
*
|
||||
* @param factoryIds
|
||||
* @param dateStrList
|
||||
* @param handlingGroupIds
|
||||
* @return
|
||||
*/
|
||||
List<HandlingGroupUserAmountDO> getByFactorIdAndDateStrAndHandlingGroupId(List<Long> factoryIds, List<String> dateStrList, List<Long> handlingGroupIds);
|
||||
}
|
||||
|
@ -1,43 +1,26 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.handlinggroupuseramount;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOALoanApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.loan.BpmOALoanSumDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.dto.StaffWagesPageDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.DeductionItemsVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.SalarySubjectItemsVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staff.StaffDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staffsalary.StaffSalaryDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsMapper;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupuseramount.HandlingGroupUserAmountMapper;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.staffsalary.StaffSalaryMapper;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.staff.StaffService;
|
||||
import cn.iocoder.yudao.module.system.api.loan.LoanApi;
|
||||
import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.SPECIFICATION_USER_AMOUNT_NOT_EXISTS;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 搬运组每日个人工资记录 Service 实现类
|
||||
@ -46,25 +29,12 @@ import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.SPEC
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class HandlingGroupUserAmountServiceImpl extends ServiceImpl<HandlingGroupUserAmountMapper,HandlingGroupUserAmountDO> implements HandlingGroupUserAmountService {
|
||||
public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmountService {
|
||||
|
||||
@Resource
|
||||
private HandlingGroupUserAmountMapper handlingGroupUserAmountMapper;
|
||||
@Resource
|
||||
private HandlingGroupAmountSpecificationsMapper handlingGroupAmountSpecificationsMapper;
|
||||
|
||||
@Resource
|
||||
private BpmOALoanApi bpmOALoanApi;
|
||||
|
||||
@Resource
|
||||
private LoanApi loanApi;
|
||||
|
||||
@Resource
|
||||
private StaffService staffService;
|
||||
|
||||
@Resource
|
||||
private StaffSalaryMapper staffSalaryMapper;
|
||||
|
||||
private static final String NAME = "姓名";
|
||||
private static final String TOTAL_AMOUNT = "总金额";
|
||||
// 提取常量
|
||||
@ -108,7 +78,9 @@ public class HandlingGroupUserAmountServiceImpl extends ServiceImpl<HandlingGrou
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createOrEdit(HandlingGroupUserAmountSaveReqVO createReqVO) {
|
||||
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecificationsDO = handlingGroupAmountSpecificationsMapper.selectById(createReqVO.getHandlingGroupAmountSpecificationsId());
|
||||
// 插入
|
||||
createReqVO.setFactoryId(handlingGroupAmountSpecificationsDO.getFactoryId());
|
||||
HandlingGroupUserAmountDO handlingGroupUserAmount = BeanUtils.toBean(createReqVO, HandlingGroupUserAmountDO.class);
|
||||
handlingGroupUserAmountMapper.insertOrUpdate(handlingGroupUserAmount);
|
||||
}
|
||||
@ -164,92 +136,5 @@ public class HandlingGroupUserAmountServiceImpl extends ServiceImpl<HandlingGrou
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HandlingGroupUserAmountDO> getHandlingGroupUserAmountList(HandlingGroupUserAmountPageReqVO pageReqVO) {
|
||||
return handlingGroupUserAmountMapper.getHandlingGroupUserAmountList(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmHandlingGroupUserAmount(Long factoryId, String month) {
|
||||
|
||||
// 查询搬运工 月工资总额
|
||||
List<HandlingGroupUserAmountDO> userAmountSums = handlingGroupUserAmountMapper.selectAmountSum(factoryId, month);
|
||||
if (CollUtil.isEmpty(userAmountSums)) {
|
||||
throw exception(SPECIFICATION_USER_AMOUNT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 校验 工厂当前月份是否存在未分配搬运工数据
|
||||
Long count = handlingGroupUserAmountMapper.selectIsExists(factoryId, month);
|
||||
if (count > 0L) {
|
||||
throw exception(SPECIFICATION_USER_AMOUNT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新搬运组薪资 状态
|
||||
handlingGroupUserAmountMapper.update(null, new LambdaUpdateWrapper<HandlingGroupUserAmountDO>()
|
||||
.set(HandlingGroupUserAmountDO::getStatus, 1)
|
||||
.eq(HandlingGroupUserAmountDO::getFactoryId, factoryId)
|
||||
.like(HandlingGroupUserAmountDO::getDateStr, month));
|
||||
|
||||
// 获取厂区得员工信息
|
||||
Set<Long> staffIds = convertSet(userAmountSums, HandlingGroupUserAmountDO::getUserId);
|
||||
List<StaffDO> staffDOS = staffService.getList(staffIds);
|
||||
Map<Long, StaffDO> staffMap = convertMap(staffDOS, StaffDO::getId);
|
||||
|
||||
// 获取员工借支记录
|
||||
List<BpmOALoanSumDTO> loanDOS = bpmOALoanApi.getListByStaffId(staffIds, month).getCheckedData();
|
||||
Map<Long, BigDecimal> loanMap = loanDOS.stream()
|
||||
.collect(Collectors.toMap(
|
||||
BpmOALoanSumDTO::getSfUserId,
|
||||
BpmOALoanSumDTO::getTotalAmount,
|
||||
BigDecimal::add
|
||||
));
|
||||
|
||||
// 获取员工剩余的 工资借支金额
|
||||
List<LoanDTO> sysLoanDOS = loanApi.getListByMonth(staffIds, month).getCheckedData();
|
||||
Map<Long, BigDecimal> sysLoanMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(sysLoanDOS)) {
|
||||
sysLoanMap = sysLoanDOS.stream()
|
||||
.collect(Collectors.toMap(LoanDTO::getUserId, LoanDTO::getRemainingAmount));
|
||||
}
|
||||
|
||||
Map<Long, BigDecimal> finalSysLoanMap = sysLoanMap;
|
||||
List<StaffSalaryDO> salaryDOS = userAmountSums.stream().map(item -> {
|
||||
StaffSalaryDO salaryDO = new StaffSalaryDO()
|
||||
.setStaffId(item.getUserId())
|
||||
.setFactoryId(item.getFactoryId())
|
||||
.setMonth(month)
|
||||
.setPayableAmount(item.getAmount())
|
||||
.setReturnAmount(loanMap.getOrDefault(item.getUserId(), BigDecimal.ZERO)
|
||||
.add(finalSysLoanMap.getOrDefault(item.getUserId(), BigDecimal.ZERO)))
|
||||
.setDeductionItems(Collections.singletonList(
|
||||
new DeductionItemsVO()
|
||||
.setKey("insurance")
|
||||
.setValue("50")));
|
||||
// 设置实发工资
|
||||
salaryDO.setRealAmount(salaryDO.getPayableAmount().subtract(salaryDO.getReturnAmount()));
|
||||
// 设置薪资主体数据
|
||||
if (staffMap.get(item.getUserId()).getSalarySubject() != null) {
|
||||
salaryDO.setSalarySubjectItems(Collections.singletonList(
|
||||
new SalarySubjectItemsVO()
|
||||
.setSalarySubjectId(staffMap.get(item.getUserId()).getSalarySubject())
|
||||
.setAmount(salaryDO.getPayableAmount())
|
||||
));
|
||||
}
|
||||
return salaryDO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 插入工资记录
|
||||
staffSalaryMapper.insertBatch(salaryDOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HandlingGroupUserAmountDO> getByHandlingGroupIds(List<Long> handlingGroupIds) {
|
||||
return handlingGroupUserAmountMapper.getByHandlingGroupIds(handlingGroupIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HandlingGroupUserAmountDO> getByFactorIdAndDateStrAndHandlingGroupId(List<Long> factoryIds, List<String> dateStrList, List<Long> handlingGroupIds) {
|
||||
return handlingGroupUserAmountMapper.getByFactorIdAndDateStrAndHandlingGroupId(factoryIds, dateStrList, handlingGroupIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.handlingspecifications;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.HandlingSpecificationsImportRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.HandlingSpecificationsImportVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.HandlingSpecificationsPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.HandlingSpecificationsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlingspecifications.HandlingSpecificationsDO;
|
||||
@ -63,12 +61,4 @@ public interface HandlingSpecificationsService extends IService<HandlingSpecific
|
||||
* @return
|
||||
*/
|
||||
List<HandlingSpecificationsDO> getHandlingSpecificationsList(@Valid HandlingSpecificationsPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 导入列表
|
||||
* @param list
|
||||
* @param updateSupport
|
||||
* @return
|
||||
*/
|
||||
HandlingSpecificationsImportRespVO importList(List<HandlingSpecificationsImportVO> list, Boolean updateSupport);
|
||||
}
|
||||
|
@ -1,14 +1,8 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.handlingspecifications;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.HandlingSpecificationsImportRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.HandlingSpecificationsImportVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.HandlingSpecificationsPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlingspecifications.vo.HandlingSpecificationsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlingspecifications.HandlingSpecificationsDO;
|
||||
@ -16,18 +10,12 @@ import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlingspecifications.Han
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.FACTORY_HANDLING_SPECIFICATION_EXISTS;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.IMPORT_LIST_IS_EMPTY;
|
||||
|
||||
/**
|
||||
* 工厂搬运规格 Service 实现类
|
||||
*
|
||||
@ -64,7 +52,7 @@ public class HandlingSpecificationsServiceImpl extends ServiceImpl<HandlingSpeci
|
||||
|
||||
@Override
|
||||
public HandlingSpecificationsDO getHandlingSpecifications(Long id) {
|
||||
return handlingSpecificationsMapper.getHandlingSpecifications(id);
|
||||
return handlingSpecificationsMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -78,87 +66,4 @@ public class HandlingSpecificationsServiceImpl extends ServiceImpl<HandlingSpeci
|
||||
return handlingSpecificationsMapper.getHandlingSpecificationsList(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public HandlingSpecificationsImportRespVO importList(List<HandlingSpecificationsImportVO> list, Boolean updateSupport) {
|
||||
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
throw exception(IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
HandlingSpecificationsImportRespVO respVO = HandlingSpecificationsImportRespVO.builder()
|
||||
.createUsernames(new ArrayList<>())
|
||||
.updateUsernames(new ArrayList<>())
|
||||
.failureUsernames(new HashMap<>()).build();
|
||||
|
||||
list.forEach(importUser -> {
|
||||
if (importUser.getFactoryName() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析工厂名称数据 格式为 id:name
|
||||
Long factoryId = Long.valueOf(importUser.getFactoryName().split(":")[0]);
|
||||
String factoryName = importUser.getFactoryName().split(":")[1];
|
||||
|
||||
//校验,判断是否有不符合的原因
|
||||
try {
|
||||
if (!updateSupport) {
|
||||
validateForCreate(factoryId, importUser.getSpecificationsName());
|
||||
}
|
||||
} catch (ServiceException ex) {
|
||||
respVO.getFailureUsernames().put(factoryName, ex.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
HandlingSpecificationsDO updateDo = new HandlingSpecificationsDO();
|
||||
// 设置工厂编号
|
||||
updateDo.setFactoryId(factoryId);
|
||||
// 设置规格名称
|
||||
updateDo.setSpecificationsName(importUser.getSpecificationsName());
|
||||
// 设置重量
|
||||
updateDo.setWeight(importUser.getWeight());
|
||||
// 设置单价
|
||||
updateDo.setUnitPrice(importUser.getUnitPrice());
|
||||
|
||||
Integer type = null;
|
||||
if (importUser.getType() != null) {
|
||||
// 解析类型数据
|
||||
type = Integer.valueOf(importUser.getType().split(":")[0]);
|
||||
updateDo.setType(type);
|
||||
}
|
||||
|
||||
// 判断如果不存在,在进行插入
|
||||
if (updateSupport) {
|
||||
HandlingSpecificationsDO handlingSpecificationsDO = handlingSpecificationsMapper.selectOne(new LambdaQueryWrapperX<HandlingSpecificationsDO>()
|
||||
.eqIfPresent(HandlingSpecificationsDO::getFactoryId, factoryId)
|
||||
.eqIfPresent(HandlingSpecificationsDO::getSpecificationsName, importUser.getSpecificationsName()));
|
||||
|
||||
updateDo.setId(handlingSpecificationsDO.getId());
|
||||
handlingSpecificationsMapper.updateById(updateDo);
|
||||
respVO.getUpdateUsernames().add(factoryName);
|
||||
return;
|
||||
}
|
||||
|
||||
// 插入用户
|
||||
handlingSpecificationsMapper.insert(updateDo);
|
||||
respVO.getCreateUsernames().add(factoryName);
|
||||
});
|
||||
|
||||
return respVO;
|
||||
}
|
||||
|
||||
private void validateForCreate(Long factoryId, String specificationsName) {
|
||||
|
||||
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
||||
DataPermissionUtils.executeIgnore(() -> {
|
||||
|
||||
// 校验用户名、身份证号是否已经存在
|
||||
Long cunt = handlingSpecificationsMapper.selectCount(new LambdaQueryWrapperX<HandlingSpecificationsDO>()
|
||||
.eqIfPresent(HandlingSpecificationsDO::getFactoryId, factoryId)
|
||||
.eqIfPresent(HandlingSpecificationsDO::getSpecificationsName, specificationsName));
|
||||
if (cunt > 0) {
|
||||
throw exception(FACTORY_HANDLING_SPECIFICATION_EXISTS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user