Merge remote-tracking branch 'origin/ah-simple-test' into ah-simple-test
This commit is contained in:
commit
95b272a178
|
|
@ -351,13 +351,22 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService {
|
|||
*/
|
||||
private void executeCallback(ApprovalInstance instance, String status) {
|
||||
try {
|
||||
log.info("开始执行审批回调,业务类型:{},审批状态:{}", instance.getBusinessType(), status);
|
||||
log.info("当前注册的回调处理器:{}", callbackMap.keySet());
|
||||
|
||||
IApprovalCallback callback = callbackMap.get(instance.getBusinessType());
|
||||
if (callback != null) {
|
||||
log.info("找到回调处理器,开始执行,业务类型:{}", instance.getBusinessType());
|
||||
if (ApprovalStatusEnum.APPROVED.getCode().equals(status)) {
|
||||
log.info("执行审批通过回调");
|
||||
callback.onApproved(instance);
|
||||
} else if (ApprovalStatusEnum.REJECTED.getCode().equals(status)) {
|
||||
log.info("执行审批驳回回调");
|
||||
callback.onRejected(instance);
|
||||
}
|
||||
log.info("审批回调执行成功,业务类型:{}", instance.getBusinessType());
|
||||
} else {
|
||||
log.warn("未找到业务类型[{}]的回调处理器", instance.getBusinessType());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("执行审批回调失败,实例编号:{},业务类型:{}", instance.getInstanceCode(), instance.getBusinessType(), e);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,124 @@
|
|||
package com.bonus.material.approval.strategy.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.approval.domain.ApprovalInstance;
|
||||
import com.bonus.material.approval.strategy.IApprovalCallback;
|
||||
import com.bonus.material.device.domain.vo.DevMergeVo;
|
||||
import com.bonus.material.device.service.DevMergeService;
|
||||
import com.bonus.material.toolProcess.domain.ToolApplyDetailsEntity;
|
||||
import com.bonus.material.toolProcess.service.ToolApplyService;
|
||||
import com.bonus.material.warehousing.domain.WarehousingEntity;
|
||||
import com.bonus.material.warehousing.mapper.WarehousingMapper;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 入库审批回调
|
||||
*
|
||||
* @author syruan
|
||||
*/
|
||||
@Component("EQUIPMENT_PUT")
|
||||
public class WarehousingApprovalCallback implements IApprovalCallback {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(WarehousingApprovalCallback.class);
|
||||
|
||||
@Resource
|
||||
private WarehousingMapper warehousingMapper;
|
||||
|
||||
@Resource
|
||||
private ToolApplyService toolApplyService;
|
||||
|
||||
@Resource
|
||||
private DevMergeService devMergeService;
|
||||
|
||||
/**
|
||||
* 审批通过回调
|
||||
* 执行入库业务逻辑:更新入库状态、更新工具申请状态、更新装备状态等
|
||||
*/
|
||||
@Override
|
||||
public void onApproved(ApprovalInstance instance) {
|
||||
try {
|
||||
log.info("入库审批通过,开始执行入库业务逻辑,业务ID:{}", instance.getBusinessId());
|
||||
|
||||
// 1. 获取入库ID
|
||||
Integer warehousingId = Integer.valueOf(instance.getBusinessId());
|
||||
|
||||
// 2. 查询入库记录
|
||||
WarehousingEntity entity = warehousingMapper.selectById(warehousingId);
|
||||
if (entity == null) {
|
||||
log.error("入库审批通过,但未找到入库记录,业务ID:{}", instance.getBusinessId());
|
||||
throw new RuntimeException("未找到入库记录");
|
||||
}
|
||||
|
||||
// 3. 更新入库状态为已通过(状态2)
|
||||
entity.setStatus("2");
|
||||
warehousingMapper.updateById(entity);
|
||||
|
||||
// 4. 如果有关联的工具申请,更新工具申请详情状态
|
||||
if (ObjectUtils.isNotEmpty(entity.getApplyId())) {
|
||||
ToolApplyDetailsEntity toolApplyDetailsEntity = new ToolApplyDetailsEntity();
|
||||
toolApplyDetailsEntity.setApplyId(Long.valueOf(entity.getApplyId()));
|
||||
toolApplyDetailsEntity.setStatus("2");
|
||||
toolApplyService.updateAllDetail(toolApplyDetailsEntity);
|
||||
log.info("入库审批通过,已更新工具申请详情状态,申请ID:{}", entity.getApplyId());
|
||||
}
|
||||
|
||||
// 5. 如果有关联的装备订单,更新装备状态
|
||||
if (ObjectUtils.isNotEmpty(entity.getOrderId())) {
|
||||
DevMergeVo devMergeVo = new DevMergeVo();
|
||||
devMergeVo.setId(entity.getOrderId());
|
||||
devMergeVo.setStatus("1");
|
||||
List<String> maIdsList = warehousingMapper.getMaIds(entity.getOrderId());
|
||||
String maIdsStr = maIdsList.stream()
|
||||
.filter(str -> str != null && !str.trim().isEmpty())
|
||||
.collect(Collectors.joining(","));
|
||||
devMergeVo.setDevIds(maIdsStr);
|
||||
devMergeService.checkDevice(devMergeVo);
|
||||
log.info("入库审批通过,已更新装备状态,订单ID:{}", entity.getOrderId());
|
||||
}
|
||||
|
||||
log.info("入库审批通过,业务逻辑执行成功,业务ID:{}", instance.getBusinessId());
|
||||
} catch (Exception e) {
|
||||
log.error("入库审批通过回调失败", e);
|
||||
throw new RuntimeException("入库审批通过回调失败:" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批驳回回调
|
||||
* 更新入库状态为"已驳回"
|
||||
*/
|
||||
@Override
|
||||
public void onRejected(ApprovalInstance instance) {
|
||||
try {
|
||||
log.info("入库审批驳回,开始执行入库业务驳回逻辑,业务ID:{}", instance.getBusinessId());
|
||||
|
||||
// 1. 获取入库ID
|
||||
Integer warehousingId = Integer.valueOf(instance.getBusinessId());
|
||||
|
||||
// 2. 查询入库记录
|
||||
WarehousingEntity entity = warehousingMapper.selectById(warehousingId);
|
||||
if (entity == null) {
|
||||
log.error("入库审批驳回,但未找到入库记录,业务ID:{}", instance.getBusinessId());
|
||||
throw new RuntimeException("未找到入库记录");
|
||||
}
|
||||
|
||||
// 3. 更新入库状态为已驳回(状态3)
|
||||
entity.setStatus("3");
|
||||
warehousingMapper.updateById(entity);
|
||||
|
||||
log.info("入库审批驳回,业务逻辑执行成功,业务ID:{}", instance.getBusinessId());
|
||||
} catch (Exception e) {
|
||||
log.error("入库审批驳回回调失败", e);
|
||||
throw new RuntimeException("入库审批驳回回调失败:" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,15 +90,9 @@ public class BackChangeServiceImpl implements BackChangeService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ApprovalRequired(
|
||||
businessType = "EQUIPMENT_RETURN",
|
||||
businessIdExpr = "#result['data']",
|
||||
businessDataExpr = "#csDeviceVo"
|
||||
)
|
||||
@ApprovalRequired(businessType = "EQUIPMENT_RETURN", businessIdExpr = "#result['data']", businessDataExpr = "#csDeviceVo")
|
||||
public AjaxResult addDevDetails(BackCsDeviceVo csDeviceVo) {
|
||||
try {
|
||||
|
||||
|
||||
if (csDeviceVo == null || csDeviceVo.getDevInfo() == null || CollectionUtils.isEmpty(csDeviceVo.getDevDetailsList())) {
|
||||
return AjaxResult.error("请选择需要添加的设备");
|
||||
}
|
||||
|
|
@ -608,6 +602,7 @@ public class BackChangeServiceImpl implements BackChangeService {
|
|||
deviceInfo.setReviewStatus("5");
|
||||
deviceInfo.setCreateUser(username);
|
||||
deviceInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
|
||||
deviceInfo.setSource("0");
|
||||
int result = repairMapper.addDeviceChange(deviceInfo);
|
||||
if (result < 1) {
|
||||
throw new Exception("添加任务失败");
|
||||
|
|
|
|||
|
|
@ -103,4 +103,9 @@ public class CsDeviceInfo {
|
|||
|
||||
@ApiModelProperty(value = "所属公司id")
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 来源(维修:0-退料,1-在库)
|
||||
*/
|
||||
private String source;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ public class MaDevFile {
|
|||
*/
|
||||
private String fileUrl;
|
||||
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
* 数据库字段:creator
|
||||
|
|
|
|||
|
|
@ -229,9 +229,12 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
public List<CsDeviceDetails> getDevDetailsInfo(CsDeviceDetails dto) {
|
||||
try {
|
||||
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
dto.setCompanyId(thisLoginUserDeptId);
|
||||
if (ADMIN_ID.equals(SecurityUtils.getLoginUser().getSysUser().getUserId())) {
|
||||
dto.setCompanyId(null);
|
||||
} else {
|
||||
dto.setCompanyId(thisLoginUserDeptId);
|
||||
}
|
||||
return mapper.getDevDetailsInfo(dto);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -213,6 +213,17 @@ public class DevMergeController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "装备台账-删除增单个设备草稿")
|
||||
@PostMapping("/delDeviceByMaIds")
|
||||
public AjaxResult delDeviceByMaIds(@RequestBody Long[] maIds) {
|
||||
try {
|
||||
return toAjax(service.deleteDevInfoByMaIds(maIds));
|
||||
} catch (Exception e) {
|
||||
logger.error("报错啦", e);
|
||||
return AjaxResult.error("调用异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交设备台账
|
||||
|
|
|
|||
|
|
@ -325,5 +325,7 @@ public interface DevInfoMapper {
|
|||
DevInfoVo selectToolByMaId(Long maId);
|
||||
|
||||
DevInfo getMaStatusByToolId(@Param("id") Long id, @Param("num") Integer num);
|
||||
|
||||
int delMaApplyDetails(@Param("maIds") Long[] maIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,4 +88,12 @@ public interface DevMergeService {
|
|||
* @return Map<装备类型名称, 特征项列表>
|
||||
*/
|
||||
Map<String, List<EquipmentProperty>> getAllTypePropertiesMap();
|
||||
|
||||
/**
|
||||
* 批量删除设备信息
|
||||
*
|
||||
* @param maIds 需要删除的设备信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteDevInfoByMaIds(Long[] maIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -492,13 +492,45 @@ public class DevMergeServiceImpl implements DevMergeService {
|
|||
|
||||
// 4.4 校验日期格式(若框架未自动处理,可添加)
|
||||
// 示例:校验productionDate是否为有效日期(根据实际需求调整)
|
||||
LocalDate productionDate = item.getProductionDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate purchaseDate = item.getPurchaseDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
if (productionDate.isAfter(purchaseDate)) {
|
||||
rowError.append("生产日期不能晚于采购日期;");
|
||||
Date prodDate = item.getProductionDate();
|
||||
Date purDate = item.getPurchaseDate();
|
||||
|
||||
if (prodDate != null && purDate != null) {
|
||||
LocalDate productionDate = prodDate.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
LocalDate purchaseDate = purDate.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
|
||||
if (productionDate.isAfter(purchaseDate)) {
|
||||
rowError.append("生产日期不能晚于采购日期;");
|
||||
}
|
||||
}
|
||||
|
||||
//校验装备名称、规格型号、资产原值、生产厂家、下次维保日期、最大使用年限、计数单位等字段必填
|
||||
if (StringUtils.isBlank(item.getEquipmentName())){
|
||||
rowError.append("装备名称不能为空;");
|
||||
}
|
||||
if (StringUtils.isBlank(item.getSpecification())){
|
||||
rowError.append("规格型号不能为空;");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(item.getOriginalValue())){
|
||||
rowError.append("资产原值不能为空;");
|
||||
}
|
||||
if (StringUtils.isBlank(item.getManufacturer())){
|
||||
rowError.append("生产厂家不能为空;");
|
||||
}
|
||||
if (item.getNextMaintenanceDate() == null) {
|
||||
rowError.append("下次维保日期不能为空;");
|
||||
}
|
||||
if (StringUtils.isBlank(item.getUnit())){
|
||||
rowError.append("计数单位不能为空;");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(item.getMaxServiceYears())){
|
||||
rowError.append("最大使用年限不能为空;");
|
||||
}
|
||||
|
||||
Integer typeId = devMergeMapper.getTypeId(item.getProfession());
|
||||
if (ObjectUtil.isEmpty(typeId)) {
|
||||
rowError.append("请选择类别");
|
||||
|
|
@ -1163,6 +1195,20 @@ public class DevMergeServiceImpl implements DevMergeService {
|
|||
return typePropertiesMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备信息
|
||||
*
|
||||
* @param maIds 需要删除的设备信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteDevInfoByMaIds(Long[] maIds) {
|
||||
devInfoMapper.batchDeleteDevInfoProperties(maIds);
|
||||
devInfoMapper.deleteDevInfoByMaIds(maIds);
|
||||
return devInfoMapper.delMaApplyDetails(maIds);
|
||||
}
|
||||
|
||||
private boolean isCoreFieldHasValue(EquipmentImportDTO item) {
|
||||
return StringUtils.hasText(item.getEquipmentName())
|
||||
|| StringUtils.hasText(item.getSpecification())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class Project {
|
|||
int sequence;
|
||||
|
||||
//工程id 主键
|
||||
private Integer id;
|
||||
private String id;
|
||||
|
||||
//工程编号
|
||||
@Excel(name = "项目编号", width = 25, sort = 2)
|
||||
|
|
|
|||
|
|
@ -62,5 +62,5 @@ public interface ProjectMapper {
|
|||
|
||||
int countByProjectCode(String proCode);
|
||||
|
||||
int countByProjectNameById(@Param("proName")String proName, @Param("id") Integer id);
|
||||
int countByProjectNameById(@Param("proName")String proName, @Param("id") String id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.repair.controller;
|
|||
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.devchange.domain.CsDeviceInfo;
|
||||
import com.bonus.material.devchange.domain.CsDeviceVo;
|
||||
import com.bonus.material.repair.domain.ToBeRepair;
|
||||
|
|
@ -33,10 +34,11 @@ public class RepairController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "获取待修工具和装备列表")
|
||||
@GetMapping("/getToBeRepairList")
|
||||
public AjaxResult list(ToBeRepair bean)
|
||||
public TableDataInfo list(ToBeRepair bean)
|
||||
{
|
||||
startPage();
|
||||
List<ToBeRepair> list = service.getToBeRepairList(bean);
|
||||
return AjaxResult.success(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -150,4 +150,9 @@ public class ToBeRepair {
|
|||
|
||||
@ApiModelProperty(value = "是否是审核")
|
||||
private int isAudit;
|
||||
|
||||
/**
|
||||
* 来源(维修:0-退料,1-在库)
|
||||
*/
|
||||
private String source;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -458,6 +458,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
deviceInfo.setReviewStatus("0");
|
||||
deviceInfo.setCreateUser(username);
|
||||
deviceInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
|
||||
deviceInfo.setSource("1");
|
||||
int result = mapper.addDeviceChange(deviceInfo);
|
||||
if (result < 1) {
|
||||
throw new Exception("添加任务失败");
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
toBeScrap.setCreateUser(username);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(toBeScrap.getBmFileInfos())) {
|
||||
toBeScrap.setScrapUrl(toBeScrap.getBmFileInfos().get(0).getFileUrl());
|
||||
toBeScrap.setScrapUrl(toBeScrap.getBmFileInfos().get(0).getUrl());
|
||||
}
|
||||
int res = scrapMapper.addScrapChangeApplyDetails(toBeScrap);
|
||||
if (res <= 0) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.approval.domain.ApprovalInstance;
|
||||
import com.bonus.material.approval.mapper.ApprovalInstanceMapper;
|
||||
import com.bonus.material.approval.service.IApprovalEngineService;
|
||||
import com.bonus.material.warehousing.domain.WarehousingEntity;
|
||||
import com.bonus.material.warehousing.service.WarehousingService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -22,6 +25,12 @@ public class WarehousingController extends BaseController {
|
|||
@Resource
|
||||
private WarehousingService service;
|
||||
|
||||
@Resource
|
||||
private IApprovalEngineService approvalEngineService;
|
||||
|
||||
@Resource
|
||||
private ApprovalInstanceMapper approvalInstanceMapper;
|
||||
|
||||
/**
|
||||
* 工具类型表格
|
||||
*
|
||||
|
|
@ -98,25 +107,75 @@ public class WarehousingController extends BaseController {
|
|||
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
* 批量审批通过
|
||||
* 通过审批引擎处理审批操作
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
* @param ids 入库ID列表
|
||||
* @return 审批结果
|
||||
*/
|
||||
@PostMapping("/batchApproval/{ids}")
|
||||
public AjaxResult batchApproval(@PathVariable("ids") Integer[] ids) {
|
||||
return service.batchApproval(ids);
|
||||
try {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return AjaxResult.error("未选择数据");
|
||||
}
|
||||
|
||||
// 对每个入库ID进行审批
|
||||
for (Integer id : ids) {
|
||||
// 查询该入库对应的审批实例
|
||||
ApprovalInstance instance = approvalInstanceMapper.selectInstanceByBusiness("EQUIPMENT_PUT", String.valueOf(id));
|
||||
if (instance == null) {
|
||||
return AjaxResult.error("入库ID:" + id + " 对应的审批实例不存在");
|
||||
}
|
||||
|
||||
// 调用审批引擎进行审批通过(1表示通过)
|
||||
AjaxResult result = approvalEngineService.doApprove(instance.getId(), "1", "");
|
||||
if (!result.isSuccess()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success("审批通过");
|
||||
} catch (Exception e) {
|
||||
logger.error("批量审批失败", e);
|
||||
return AjaxResult.error("批量审批失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
* 批量审批驳回
|
||||
* 通过审批引擎处理驳回操作
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
* @param ids 入库ID列表
|
||||
* @return 驳回结果
|
||||
*/
|
||||
@PostMapping("/batchRejection/{ids}")
|
||||
public AjaxResult batchRejection(@PathVariable("ids") Integer[] ids) {
|
||||
return service.batchRejection(ids);
|
||||
try {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return AjaxResult.error("未选择数据");
|
||||
}
|
||||
|
||||
// 对每个入库ID进行驳回
|
||||
for (Integer id : ids) {
|
||||
// 查询该入库对应的审批实例
|
||||
ApprovalInstance instance = approvalInstanceMapper.selectInstanceByBusiness("EQUIPMENT_PUT", String.valueOf(id));
|
||||
if (instance == null) {
|
||||
return AjaxResult.error("入库ID:" + id + " 对应的审批实例不存在");
|
||||
}
|
||||
|
||||
// 调用审批引擎进行驳回(2表示驳回)
|
||||
AjaxResult result = approvalEngineService.doApprove(instance.getId(), "2", "");
|
||||
if (!result.isSuccess()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success("审批驳回");
|
||||
} catch (Exception e) {
|
||||
logger.error("批量驳回失败", e);
|
||||
return AjaxResult.error("批量驳回失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.warehousing.service.Impl;
|
|||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.approval.annotation.ApprovalRequired;
|
||||
import com.bonus.material.devchange.domain.MapBean;
|
||||
import com.bonus.material.device.domain.vo.DevMergeVo;
|
||||
import com.bonus.material.device.service.DevMergeService;
|
||||
|
|
@ -120,7 +121,7 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
// warehousing.setCompanyId(deptId);
|
||||
// }
|
||||
if(ADMIN_ID.equals(userId)){
|
||||
warehousing.setCompanyId(1L);
|
||||
warehousing.setCompanyId(null);
|
||||
}else{
|
||||
warehousing.setCompanyId(deptId);
|
||||
}
|
||||
|
|
@ -128,17 +129,19 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
return ObjectUtils.isNotEmpty(warehousingEntities) ? warehousingEntities : new ArrayList<WarehousingEntity>();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return new ArrayList<WarehousingEntity>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
* 提交后会自动创建审批流实例
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ApprovalRequired(businessType = "EQUIPMENT_PUT", businessIdExpr = "#result['data']", businessDataExpr = "#ids")
|
||||
public AjaxResult batchSubmission(Integer[] ids) {
|
||||
try {
|
||||
// 1. 空值/空数组校验:提前终止无效请求
|
||||
|
|
@ -152,10 +155,11 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
}
|
||||
}
|
||||
Integer num = mapper.batchSubmission(ids);
|
||||
return num > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
// 返回第一个ID作为业务ID(用于审批流)
|
||||
return num > 0 ? AjaxResult.success("批量提交成功,等待审批", ids[0]) : AjaxResult.error("批量提交失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
return AjaxResult.error("批量提交失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@
|
|||
WHERE
|
||||
is_active = 1
|
||||
AND dcd.change_id = #{id}
|
||||
and dcd.del_flag='0'
|
||||
|
||||
<if test="type!=null and type==2">
|
||||
AND dcd.real_num is NOT null
|
||||
|
|
@ -327,6 +328,7 @@
|
|||
WHERE
|
||||
dcd.change_id = #{id}
|
||||
and dcd.dev_type='2'
|
||||
and dcd.del_flag='0'
|
||||
<if test="type!=null and type==2">
|
||||
AND dcd.real_num is NOT null
|
||||
</if>
|
||||
|
|
@ -411,7 +413,14 @@
|
|||
AND mdi.code LIKE CONCAT('%',#{devCode},'%')
|
||||
</if>
|
||||
<if test="companyId!=null">
|
||||
AND mdi.on_company = #{companyId}
|
||||
AND mdi.on_company
|
||||
in (
|
||||
select dept_id from sys_dept where dept_id= #{companyId}
|
||||
union
|
||||
select dept_id from sys_dept where parent_id= #{companyId}
|
||||
union
|
||||
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||
)
|
||||
</if>
|
||||
<if test='devType == "2"'>
|
||||
AND 1=0
|
||||
|
|
|
|||
|
|
@ -698,6 +698,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{maId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="delMaApplyDetails">
|
||||
delete from ma_apply_details where dev_id in
|
||||
<foreach item="maId" collection="maIds" open="(" separator="," close=")">
|
||||
#{maId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="insertDevInfoProperties">
|
||||
insert into
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@
|
|||
WHEN 'EQUIPMENT_REPAIR' THEN '设备维修'
|
||||
WHEN 'EQUIPMENT_RETURN' THEN '设备退库'
|
||||
WHEN 'EQUIPMENT_OUT' THEN '设备出库'
|
||||
WHEN 'EQUIPMENT_PUT' THEN '设备入库'
|
||||
ELSE '未知业务类型'
|
||||
END AS businessName,
|
||||
'申请' AS statusType,
|
||||
|
|
@ -93,6 +94,7 @@
|
|||
WHEN 'EQUIPMENT_REPAIR' THEN '设备维修'
|
||||
WHEN 'EQUIPMENT_RETURN' THEN '设备退库'
|
||||
WHEN 'EQUIPMENT_OUT' THEN '设备出库'
|
||||
WHEN 'EQUIPMENT_PUT' THEN '设备入库'
|
||||
ELSE '未知业务类型'
|
||||
END AS businessName,
|
||||
'审核' AS statusType,
|
||||
|
|
@ -110,7 +112,7 @@
|
|||
<select id="getDeviceByDept" resultType="java.util.Map">
|
||||
SELECT
|
||||
sd.dept_id AS companyId,
|
||||
sd.dept_abbreviation AS companyName, -- 公司名称
|
||||
ifnull(sd.dept_abbreviation, sd.dept_name) AS companyName, -- 公司名称
|
||||
-- 工具数量:无数据则为0,取整
|
||||
ROUND(IFNULL(SUM(temp.toolNum), 0)) AS toolNum,
|
||||
-- 设备数量:无数据则为0,取整
|
||||
|
|
@ -167,7 +169,7 @@
|
|||
GROUP BY on_company) t
|
||||
-- 按公司ID合并数据,避免同一公司多条记录
|
||||
GROUP BY company_id) temp ON sd.dept_id = temp.company_id -- 公司ID关联
|
||||
WHERE sd.is_show = '1'
|
||||
WHERE sd.is_show = '1' and sd.del_flag='0'
|
||||
-- 按公司ID分组,确保每个公司只显示一行
|
||||
GROUP BY sd.dept_id,
|
||||
sd.dept_name
|
||||
|
|
@ -324,6 +326,7 @@
|
|||
WHEN 'EQUIPMENT_REPAIR' THEN '设备维修'
|
||||
WHEN 'EQUIPMENT_RETURN' THEN '设备退库'
|
||||
WHEN 'EQUIPMENT_OUT' THEN '设备出库'
|
||||
WHEN 'EQUIPMENT_PUT' THEN '设备入库'
|
||||
ELSE '未知业务类型'
|
||||
END AS businessName
|
||||
FROM
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.bonus.material.repair.mapper.RepairMapper">
|
||||
<insert id="addDeviceChange" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into cs_device_change(type, code, review_status, create_user, create_time, del_flag, company_id)
|
||||
values (#{type}, #{code}, #{reviewStatus}, #{createUser}, NOW(), '0', #{companyId})
|
||||
insert into cs_device_change(type, code, review_status, create_user, create_time, del_flag, company_id, source)
|
||||
values (#{type}, #{code}, #{reviewStatus}, #{createUser}, NOW(), '0', #{companyId},#{source})
|
||||
</insert>
|
||||
<insert id="addRepairData">
|
||||
insert into cs_device_change_details(
|
||||
|
|
@ -276,6 +276,7 @@
|
|||
cdc.create_user as createUser,
|
||||
cdc.create_time as createTime,
|
||||
cdc.review_status as status,
|
||||
cdc.source,
|
||||
cdc.company_id as companyId
|
||||
FROM cs_device_change cdc
|
||||
LEFT JOIN cs_device_change_details cdcd ON cdcd.change_id = cdc.id
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
<?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="com.bonus.material.toolLedger.mapper.ToolLedgerMapper">
|
||||
<insert id="add" parameterType="com.bonus.material.toolLedger.domain.ToolLedgerEntity"
|
||||
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
<insert id="add" parameterType="com.bonus.material.toolLedger.domain.ToolLedgerEntity" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
INSERT INTO tool_ledger
|
||||
<!--
|
||||
trim 标签核心作用:
|
||||
|
|
@ -27,8 +26,8 @@
|
|||
<if test="productionDate != null">production_date,</if>
|
||||
<if test="lastCheckDate != null">last_check_date,</if>
|
||||
<if test="nextCheckDate != null">next_check_date,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
'1',
|
||||
<if test="status != null and status != ''">`status`,</if>
|
||||
up_down_status,
|
||||
<if test="companyId != null">company_id,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
|
||||
|
|
@ -53,7 +52,7 @@
|
|||
<if test="lastCheckDate != null">#{lastCheckDate},</if>
|
||||
<if test="nextCheckDate != null">#{nextCheckDate},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="upDownStatus != null and upDownStatus != ''">#{upDownStatus},</if>
|
||||
'1',
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<!-- 对应上面的兜底字段,确保参数列表和字段列表数量一致 -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue