问题修改
This commit is contained in:
parent
2ade019b92
commit
9b1c8f1fc6
|
|
@ -31,7 +31,7 @@ public class ApprovalInstanceController extends BaseController {
|
|||
* 查询审批实例列表
|
||||
*/
|
||||
@ApiOperation("查询审批实例列表")
|
||||
@RequiresPermissions("material:approval:instance:list")
|
||||
//@RequiresPermissions("material:approval:instance:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ApprovalInstance instance) {
|
||||
startPage();
|
||||
|
|
@ -43,7 +43,7 @@ public class ApprovalInstanceController extends BaseController {
|
|||
* 获取审批实例详细信息
|
||||
*/
|
||||
@ApiOperation("获取审批实例详细信息")
|
||||
@RequiresPermissions("material:approval:instance:query")
|
||||
//@RequiresPermissions("material:approval:instance:query")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(instanceService.selectInstanceById(id));
|
||||
|
|
@ -53,7 +53,7 @@ public class ApprovalInstanceController extends BaseController {
|
|||
* 根据业务类型和业务ID查询审批实例
|
||||
*/
|
||||
@ApiOperation("根据业务查询审批实例")
|
||||
@RequiresPermissions("material:approval:instance:query")
|
||||
//@RequiresPermissions("material:approval:instance:query")
|
||||
@GetMapping("/business/{businessType}/{businessId}")
|
||||
public AjaxResult getByBusiness(@PathVariable String businessType, @PathVariable String businessId) {
|
||||
return success(instanceService.selectInstanceByBusiness(businessType, businessId));
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class ApprovalProcessController extends BaseController {
|
|||
* 查询审批流程列表
|
||||
*/
|
||||
@ApiOperation("查询审批流程列表")
|
||||
@RequiresPermissions("material:approval:process:list")
|
||||
//@RequiresPermissions("material:approval:process:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ApprovalProcess process) {
|
||||
startPage();
|
||||
|
|
@ -43,7 +43,7 @@ public class ApprovalProcessController extends BaseController {
|
|||
* 获取审批流程详细信息
|
||||
*/
|
||||
@ApiOperation("获取审批流程详细信息")
|
||||
@RequiresPermissions("material:approval:process:query")
|
||||
//@RequiresPermissions("material:approval:process:query")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(processService.selectProcessById(id));
|
||||
|
|
@ -53,7 +53,7 @@ public class ApprovalProcessController extends BaseController {
|
|||
* 新增审批流程
|
||||
*/
|
||||
@ApiOperation("新增审批流程")
|
||||
@RequiresPermissions("material:approval:process:add")
|
||||
//@RequiresPermissions("material:approval:process:add")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ApprovalProcess process) {
|
||||
return toAjax(processService.insertProcess(process));
|
||||
|
|
@ -63,7 +63,7 @@ public class ApprovalProcessController extends BaseController {
|
|||
* 修改审批流程
|
||||
*/
|
||||
@ApiOperation("修改审批流程")
|
||||
@RequiresPermissions("material:approval:process:edit")
|
||||
//@RequiresPermissions("material:approval:process:edit")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ApprovalProcess process) {
|
||||
return toAjax(processService.updateProcess(process));
|
||||
|
|
@ -73,7 +73,7 @@ public class ApprovalProcessController extends BaseController {
|
|||
* 删除审批流程
|
||||
*/
|
||||
@ApiOperation("删除审批流程")
|
||||
@RequiresPermissions("material:approval:process:remove")
|
||||
// @RequiresPermissions("material:approval:process:remove")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(processService.deleteProcessByIds(ids));
|
||||
|
|
@ -83,7 +83,7 @@ public class ApprovalProcessController extends BaseController {
|
|||
* 启用流程
|
||||
*/
|
||||
@ApiOperation("启用流程")
|
||||
@RequiresPermissions("material:approval:process:edit")
|
||||
//@RequiresPermissions("material:approval:process:edit")
|
||||
@PutMapping("/enable/{id}")
|
||||
public AjaxResult enable(@PathVariable Long id) {
|
||||
return toAjax(processService.enableProcess(id));
|
||||
|
|
@ -93,7 +93,7 @@ public class ApprovalProcessController extends BaseController {
|
|||
* 停用流程
|
||||
*/
|
||||
@ApiOperation("停用流程")
|
||||
@RequiresPermissions("material:approval:process:edit")
|
||||
//@RequiresPermissions("material:approval:process:edit")
|
||||
@PutMapping("/disable/{id}")
|
||||
public AjaxResult disable(@PathVariable Long id) {
|
||||
return toAjax(processService.disableProcess(id));
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class ApprovalTaskController extends BaseController {
|
|||
* 查询我的待办审批列表
|
||||
*/
|
||||
@ApiOperation("查询我的待办审批列表")
|
||||
@RequiresPermissions("material:approval:task:todo")
|
||||
//@RequiresPermissions("material:approval:task:todo")
|
||||
@GetMapping("/todo")
|
||||
public TableDataInfo todoList() {
|
||||
startPage();
|
||||
|
|
@ -48,7 +48,7 @@ public class ApprovalTaskController extends BaseController {
|
|||
* 查询我的已办审批列表
|
||||
*/
|
||||
@ApiOperation("查询我的已办审批列表")
|
||||
@RequiresPermissions("material:approval:task:done")
|
||||
//@RequiresPermissions("material:approval:task:done")
|
||||
@GetMapping("/done")
|
||||
public TableDataInfo doneList() {
|
||||
startPage();
|
||||
|
|
@ -60,7 +60,7 @@ public class ApprovalTaskController extends BaseController {
|
|||
* 获取审批详情(包含审批记录)
|
||||
*/
|
||||
@ApiOperation("获取审批详情")
|
||||
@RequiresPermissions("material:approval:task:query")
|
||||
//@RequiresPermissions("material:approval:task:query")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getDetail(@PathVariable("id") Long id) {
|
||||
return success(approvalEngineService.getApprovalDetail(id));
|
||||
|
|
@ -70,7 +70,7 @@ public class ApprovalTaskController extends BaseController {
|
|||
* 执行审批操作
|
||||
*/
|
||||
@ApiOperation("执行审批操作")
|
||||
@RequiresPermissions("material:approval:task:approve")
|
||||
//@RequiresPermissions("material:approval:task:approve")
|
||||
@PostMapping("/approve")
|
||||
public AjaxResult approve(
|
||||
@ApiParam(value = "实例ID", required = true) @RequestParam Long instanceId,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import java.util.Date;
|
|||
|
||||
/**
|
||||
* 审批节点配置实体
|
||||
*
|
||||
*
|
||||
* @author bonus
|
||||
* @date 2024-11-18
|
||||
*/
|
||||
|
|
@ -64,5 +64,7 @@ public class ApprovalNode implements Serializable {
|
|||
@ApiModelProperty("更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
private String name;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class BackChangeServiceImpl implements BackChangeService {
|
|||
String typeName = details.getTypeName();
|
||||
|
||||
// 构建错误信息
|
||||
String errorMsg = String.format("%s,已有在途单据,在途数量%s,本次申请数量%s", typeName, totalOccupyNumStr,applyNumStr);
|
||||
String errorMsg = String.format("%s,已有在途单据,在途数量%s,本次申请数量%s", typeName, totalOccupyNumStr, applyNumStr);
|
||||
|
||||
// 记录日志:包含关键参数,便于问题排查
|
||||
log.warn("业务校验失败:{},已使用数量={},在途数量={},本次申请数量={}",
|
||||
|
|
@ -210,10 +210,12 @@ public class BackChangeServiceImpl implements BackChangeService {
|
|||
|
||||
|
||||
// ========== 工具方法:封装BigDecimal格式化逻辑(复用性高) ==========
|
||||
|
||||
/**
|
||||
* 格式化BigDecimal为字符串,避免科学计数法,处理空值
|
||||
* @param value 待格式化的BigDecimal(可为null)
|
||||
* @param scale 保留小数位数
|
||||
*
|
||||
* @param value 待格式化的BigDecimal(可为null)
|
||||
* @param scale 保留小数位数
|
||||
* @param roundingMode 舍入模式(推荐使用枚举,更直观)
|
||||
* @return 格式化后的字符串
|
||||
*/
|
||||
|
|
@ -474,7 +476,7 @@ public class BackChangeServiceImpl implements BackChangeService {
|
|||
}
|
||||
// 判断在用数量是否有为0的,若有,不予审核通过
|
||||
if (csDeviceDetails.getUseNum().compareTo(BigDecimal.ZERO) == 0) {
|
||||
throw new RuntimeException("该条单据中存在在用数量为0的设备,无法审核通过,请驳回后进行修改");
|
||||
return AjaxResult.error("该条单据中存在在用数量为0的设备,无法审核通过,请驳回后进行修改", AjaxResult.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.material.cityScreen.entity.DeviceInfoEntity;
|
|||
import com.bonus.material.cityScreen.mapper.CityScreenMapper;
|
||||
import com.bonus.material.equipment.domain.DeptConfigRateSummary;
|
||||
import com.bonus.material.equipment.service.ISysDeptService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -58,7 +59,7 @@ public class CityScreenServiceImpl implements CityScreenService {
|
|||
titleVO.setAllocationRate(StringHelper.isNullOrEmptyString(String.valueOf(item.getConfigRate())) ? "0" : String.valueOf(item.getConfigRate()));
|
||||
}
|
||||
});
|
||||
if (titleVO.getAllocationRate().trim().isEmpty() || "null".equals(titleVO.getAllocationRate())) {
|
||||
if (ObjectUtils.isEmpty(titleVO.getAllocationRate()) || "null".equals(titleVO.getAllocationRate())) {
|
||||
titleVO.setAllocationRate("0");
|
||||
}
|
||||
//查询今日出入库设备数
|
||||
|
|
|
|||
|
|
@ -83,4 +83,12 @@ public class ComprehensiveController extends BaseController {
|
|||
public AjaxResult orderReject(@PathVariable String orderId) {
|
||||
return orderService.orderReject(orderId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "订单确认--驳回")
|
||||
@GetMapping("/getCategoryList")
|
||||
public AjaxResult getCategoryList(String keyWord) {
|
||||
return orderService.getCategoryList(keyWord);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
@Override
|
||||
public List<DevChangeVo> selectDevInfoList(DevChangeVo devInfo) {
|
||||
try {
|
||||
|
||||
List<DevChangeVo> list = mapper.selectDevInfoList(devInfo);
|
||||
for (DevChangeVo vo : list) {
|
||||
List<DevInfoPropertyVo> devInfoPropertyVos = mapper.getDevPropertyList(vo);
|
||||
|
|
@ -229,7 +230,6 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
try {
|
||||
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
dto.setCompanyId(thisLoginUserDeptId);
|
||||
|
||||
return mapper.getDevDetailsInfo(dto);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
@ -254,7 +254,7 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
public AjaxResult addDevDetails(CsDeviceVo csDeviceVo) {
|
||||
try {
|
||||
if (csDeviceVo == null || csDeviceVo.getDevInfo() == null || CollectionUtils.isEmpty(csDeviceVo.getDevDetailsList())) {
|
||||
return AjaxResult.error("请选择需要添加的设备");
|
||||
return AjaxResult.error("请选择需要添加的设备", AjaxResult.class);
|
||||
}
|
||||
// 判断提交的数据csDeviceVo.getDevDetailsList()中是否存在相同编号或者数量设备typeId相同的数据
|
||||
Set<String> devCodeSet = new HashSet<>();
|
||||
|
|
@ -267,14 +267,14 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
// 编码重复
|
||||
String devCode = details.getDevCode();
|
||||
if (!devCode.equals("/") && StringUtils.isNotBlank(devCode) && devCodeSet.contains(devCode)) {
|
||||
return AjaxResult.error("添加的列表中设备编号存在重复:" + devCode);
|
||||
return AjaxResult.error("添加的列表中设备编号存在重复:" + devCode, AjaxResult.class);
|
||||
} else if (StringUtils.isNotBlank(devCode)) {
|
||||
devCodeSet.add(devCode);
|
||||
}
|
||||
// typeId重复
|
||||
Long typeId = details.getTypeId();
|
||||
if (typeId != null && typeIdSet.contains(typeId)) {
|
||||
return AjaxResult.error("添加的列表中设备类型存在重复!");
|
||||
return AjaxResult.error("添加的列表中设备类型存在重复!", AjaxResult.class);
|
||||
} else if (typeId != null && "1".equals(details.getManageType())) {
|
||||
typeIdSet.add(typeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public interface DevMergeMapper {
|
|||
|
||||
void updateDeviceStatus(List<DevMergeVo> o);
|
||||
|
||||
int updateDevice(List<MapBean> list);
|
||||
int updateDevice(@Param("list")List<MapBean> list,@Param("status")String status);
|
||||
|
||||
int updateChangeStatus(List<MapBean> list);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import java.nio.charset.Charset;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -145,7 +146,7 @@ public class DevMergeServiceImpl implements DevMergeService {
|
|||
devMergeMapper.updateChangeStatus(list);
|
||||
}
|
||||
|
||||
int i = devMergeMapper.updateDevice(list);
|
||||
int i = devMergeMapper.updateDevice(list, o.getStatus());
|
||||
//判断有没有审批完
|
||||
int b = devMergeMapper.getDevNoCheck(o.getId());
|
||||
if (b == 0) {
|
||||
|
|
@ -444,7 +445,7 @@ public class DevMergeServiceImpl implements DevMergeService {
|
|||
|
||||
// 2. 过滤null元素
|
||||
list = list.stream().filter(Objects::nonNull)
|
||||
.filter(item-> StringUtils.hasText(item.getProfession()) || isCoreFieldHasValue(item))
|
||||
.filter(item -> StringUtils.hasText(item.getProfession()) || isCoreFieldHasValue(item))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2.1 过滤装备类目都没选择的数据
|
||||
|
|
@ -489,7 +490,11 @@ public class DevMergeServiceImpl implements DevMergeService {
|
|||
|
||||
// 4.4 校验日期格式(若框架未自动处理,可添加)
|
||||
// 示例:校验productionDate是否为有效日期(根据实际需求调整)
|
||||
if (item.getProductionDate() != null && item.getPurchaseDate() != null && item.getProductionDate().after(item.getPurchaseDate())) {
|
||||
LocalDate productionDate = item.getProductionDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate purchaseDate = item.getPurchaseDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
if (productionDate.isAfter(purchaseDate)) {
|
||||
rowError.append("生产日期不能晚于采购日期;");
|
||||
}
|
||||
Integer typeId = devMergeMapper.getTypeId(item.getProfession());
|
||||
|
|
@ -1156,7 +1161,7 @@ public class DevMergeServiceImpl implements DevMergeService {
|
|||
return typePropertiesMap;
|
||||
}
|
||||
|
||||
private boolean isCoreFieldHasValue(EquipmentImportDTO item){
|
||||
private boolean isCoreFieldHasValue(EquipmentImportDTO item) {
|
||||
return StringUtils.hasText(item.getEquipmentName())
|
||||
|| StringUtils.hasText(item.getSpecification())
|
||||
|| item.getOriginalValue() != null
|
||||
|
|
@ -1170,6 +1175,4 @@ public class DevMergeServiceImpl implements DevMergeService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class SysDeptController extends BaseController {
|
|||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list"))
|
||||
//@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list"))
|
||||
@GetMapping("/deptTree")
|
||||
public AjaxResult deptTree(SysDept dept) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
maLeaseInfo.setOrderUser(String.valueOf(userId));
|
||||
maLeaseInfo.setOrderCompany(String.valueOf(companyId));
|
||||
maLeaseInfo.setOrderTime(DateUtils.getNowDate());
|
||||
|
|
@ -564,6 +564,7 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
|
||||
/**
|
||||
* 最需装备二级页面
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -583,6 +584,7 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
|
||||
/**
|
||||
* 判断MaLeaseOnlyInfo对象是否包含关键字
|
||||
*
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
|
|
@ -620,7 +622,7 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
maLeaseInfo.setLeaseStatus(LeaseInfoEnum.LEASE_PENDING_ORDER.getStatus());
|
||||
maLeaseInfo.setStartTime(DateUtils.getNowDate());
|
||||
maLeaseInfo.setPublishUser(String.valueOf(userId));
|
||||
maLeaseInfo.setPublishCompany(String.valueOf(SecurityUtils.getLoginUser().getSysUser().getCompanyId()));
|
||||
maLeaseInfo.setPublishCompany(String.valueOf(SecurityUtils.getLoginUser().getSysUser().getDeptId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.bonus.material.order.domain.OrderInfoDto;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
|
|
@ -78,4 +79,7 @@ public interface OrderMapper {
|
|||
* 订单驳回
|
||||
*/
|
||||
int orderReject(String orderId);
|
||||
|
||||
|
||||
List<Map<String, Object>> getCategoryList(String keyWord);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,4 +48,6 @@ public interface OrderService {
|
|||
AjaxResult orderConfirm(String orderId);
|
||||
|
||||
AjaxResult orderReject(String orderId);
|
||||
|
||||
AjaxResult getCategoryList(String keyWord);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -637,4 +637,13 @@ public class OrderServiceImpl implements OrderService {
|
|||
return AjaxResult.error("操作成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getCategoryList(String keyWord) {
|
||||
return AjaxResult.success(orderMapper.getCategoryList(keyWord));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,24 +75,24 @@ public class RepairServiceImpl implements RepairService {
|
|||
String username = getCurrentUsername();
|
||||
|
||||
Long changeId;
|
||||
if (bean.getChangeId() == null) {
|
||||
if (bean.getChangeId()==null){
|
||||
// 1. 创建维修任务
|
||||
changeId = createRepairTask(username);
|
||||
//将申请的设备状态都改为维修
|
||||
// for (ToBeRepair detail : list) {
|
||||
// if ("编码管理".equals(detail.getManageMode()) && !StringHelper.isNullOrEmptyString(detail.getCode())) {
|
||||
// //1、如果是编码管理,将设备状态改为维修状态
|
||||
// if ("装备".equals(detail.getType())) {
|
||||
// int re1 = mapper.updateDevStatus(detail);
|
||||
// } else if ("工具".equals(detail.getType())) {
|
||||
// int re2 = mapper.updateToolStatus(detail);
|
||||
// }
|
||||
// } else if ("数量管理".equals(detail.getManageMode())) {
|
||||
// //目前数量管理的设备都是工具
|
||||
// //将在库数量减掉增加维修数量
|
||||
// int re3 = mapper.updateToolNum(detail);
|
||||
// }
|
||||
// }
|
||||
for (ToBeRepair detail : list){
|
||||
if ("编码管理".equals(detail.getManageMode()) && !StringHelper.isNullOrEmptyString(detail.getCode())){
|
||||
//1、如果是编码管理,将设备状态改为维修状态
|
||||
if ("装备".equals(detail.getType())){
|
||||
int re1 = mapper.updateDevStatus(detail);
|
||||
} else if ("工具".equals(detail.getType())){
|
||||
int re2 = mapper.updateToolStatus(detail);
|
||||
}
|
||||
} else if ("数量管理".equals(detail.getManageMode())){
|
||||
//目前数量管理的设备都是工具
|
||||
//将在库数量减掉增加维修数量
|
||||
int re3 = mapper.updateToolNum(detail);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//退料维修任务提交
|
||||
changeId = bean.getChangeId();
|
||||
|
|
@ -121,7 +121,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult updateRepairData(ToBeRepair bean) {
|
||||
try {
|
||||
if (bean.getChangeId() == null) {
|
||||
if (bean.getChangeId()==null){
|
||||
throw new Exception("缺少任务ID");
|
||||
}
|
||||
if (bean.getToBeRepairList().size() <= 0) {
|
||||
|
|
@ -135,19 +135,19 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
String username = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||
//先删除详情中被驳回的数据
|
||||
int re1 = mapper.deleteChangeDetailsByChangeId(bean);
|
||||
int re1 = mapper.deleteChangeDetailsByChangeId(bean);
|
||||
if (re1 < 1) {
|
||||
throw new Exception("删除设备详情失败");
|
||||
}
|
||||
for (ToBeRepair toBeRepair : bean.getToBeRepairList()) {
|
||||
if (!StringHelper.isNullOrEmptyString(toBeRepair.getStatus()) && "通过".equals(toBeRepair.getStatus())) {
|
||||
if (!StringHelper.isNullOrEmptyString(toBeRepair.getStatus()) && "通过".equals(toBeRepair.getStatus())){
|
||||
//过滤掉通过的数据
|
||||
continue;
|
||||
}
|
||||
toBeRepair.setChangeId(bean.getChangeId());
|
||||
toBeRepair.setCreateUser(username);
|
||||
if (!StringHelper.isNullOrEmptyString(toBeRepair.getIsScrap())) {
|
||||
if (toBeRepair.getBmFileInfos() != null && toBeRepair.getBmFileInfos().size() > 0) {
|
||||
if (toBeRepair.getBmFileInfos()!=null && toBeRepair.getBmFileInfos().size() > 0) {
|
||||
if ("0".equals(toBeRepair.getIsScrap())) {
|
||||
toBeRepair.setRepairUrl(toBeRepair.getBmFileInfos().get(0).getFileUrl());
|
||||
} else {
|
||||
|
|
@ -314,9 +314,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
public List<ToBeRepair> getRepairDetailsList(ToBeRepair bean) {
|
||||
try {
|
||||
List<ToBeRepair> list = mapper.getRepairDetailsList(bean);
|
||||
if (!list.isEmpty()) {
|
||||
for (ToBeRepair toBeRepair : list) {
|
||||
if (!StringHelper.isNullOrEmptyString(toBeRepair.getUrl())) {
|
||||
if (!list.isEmpty()){
|
||||
for (ToBeRepair toBeRepair : list){
|
||||
if (!StringHelper.isNullOrEmptyString(toBeRepair.getUrl())){
|
||||
List<BmFileInfo> bmFileInfos = new ArrayList<>();
|
||||
BmFileInfo fileInfo = new BmFileInfo();
|
||||
fileInfo.setFileUrl(toBeRepair.getUrl());
|
||||
|
|
@ -347,29 +347,28 @@ public class RepairServiceImpl implements RepairService {
|
|||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
for (ToBeRepair toBeRepair : bean.getToBeRepairList()) {
|
||||
//查询设备是否已经处理过
|
||||
if ("编码管理".equals(toBeRepair.getManageMode())) {
|
||||
if ("编码管理".equals(toBeRepair.getManageMode())){
|
||||
//1、如果是编码管理,查询状态是否为维修状态
|
||||
if ("装备".equals(toBeRepair.getType())) {
|
||||
if ("装备".equals(toBeRepair.getType())){
|
||||
ToBeRepair bean1 = mapper.selectMaDevInfoByTypeIdAndCode(toBeRepair);
|
||||
if (bean1 == null || !"5".equals(bean1.getStatus())) {
|
||||
return AjaxResult.error(toBeRepair.getCode() + "编码设备已经处理过",AjaxResult.class);
|
||||
if (bean1==null || !"5".equals(bean1.getStatus())){
|
||||
return AjaxResult.error(toBeRepair.getCode()+"编码设备已经处理过");
|
||||
}
|
||||
} else if ("工具".equals(toBeRepair.getType())) {
|
||||
} else if ("工具".equals(toBeRepair.getType())){
|
||||
ToBeRepair bean1 = mapper.selectByTypeIdAndCode(toBeRepair);
|
||||
if (bean1 == null || !"2".equals(bean1.getStatus())) {
|
||||
return AjaxResult.error(toBeRepair.getCode() + "编码设备已经处理过",AjaxResult.class);
|
||||
|
||||
if (bean1==null || !"2".equals(bean1.getStatus())){
|
||||
return AjaxResult.error(toBeRepair.getCode()+"编码设备已经处理过");
|
||||
}
|
||||
}
|
||||
} else if ("数量管理".equals(toBeRepair.getManageMode())) {
|
||||
} else if ("数量管理".equals(toBeRepair.getManageMode())){
|
||||
//2、如果是数量管理,查询剩余的维修数量是否够
|
||||
//todo 目前数量管理的设备都是工具
|
||||
ToBeRepair bean1 = mapper.selectByTypeIdAndCode(toBeRepair);
|
||||
if (bean1 == null || bean1.getRepairNum().compareTo(toBeRepair.getRepairNum()) < 0) {
|
||||
return AjaxResult.error(toBeRepair.getTypeModelName() + "剩余维修设备数量不足",AjaxResult.class);
|
||||
if (bean1==null || bean1.getRepairNum().compareTo(toBeRepair.getRepairNum())<0){
|
||||
return AjaxResult.error(toBeRepair.getTypeModelName()+"剩余维修设备数量不足");
|
||||
}
|
||||
}
|
||||
if (!StringHelper.isNullOrEmptyString(toBeRepair.getAuditStatus())) {
|
||||
if (!StringHelper.isNullOrEmptyString(toBeRepair.getAuditStatus())){
|
||||
toBeRepair.setCreateUser(username);
|
||||
int res = mapper.auditData(toBeRepair);
|
||||
if (res <= 0) {
|
||||
|
|
@ -385,15 +384,15 @@ public class RepairServiceImpl implements RepairService {
|
|||
throw new Exception("审核主表数据失败");
|
||||
}
|
||||
//如果是审核通过,需要增加周期表数据以及更新台账信息
|
||||
if ("2".equals(toBeRepair.getAuditStatus())) {
|
||||
if ("工具".equals(toBeRepair.getType())) {
|
||||
if ("2".equals(toBeRepair.getAuditStatus())){
|
||||
if ("工具".equals(toBeRepair.getType())){
|
||||
//根据typeId和code查询台账信息
|
||||
ToBeRepair bean1 = mapper.selectByTypeIdAndCode(toBeRepair);
|
||||
if (bean1 != null && bean1.getId() > 0) {
|
||||
if (bean1 != null && bean1.getId() > 0){
|
||||
//1、添加周期表数据
|
||||
ToBeRepair bean2 = new ToBeRepair();
|
||||
bean2.setId(bean1.getId());
|
||||
bean2.setCreateBy(userId + "");
|
||||
bean2.setCreateBy(userId+"");
|
||||
bean2.setCreateUser(username);
|
||||
bean2.setCode(toBeRepair.getCode());
|
||||
bean2.setRepairNum(toBeRepair.getRepairNum());
|
||||
|
|
@ -409,40 +408,25 @@ public class RepairServiceImpl implements RepairService {
|
|||
throw new Exception("更新台账信息失败");
|
||||
}
|
||||
}
|
||||
} else if ("装备".equals(toBeRepair.getType())) {
|
||||
} else if ("装备".equals(toBeRepair.getType())){
|
||||
//更新台账信息
|
||||
toBeRepair.setCreateBy(userId + "");
|
||||
toBeRepair.setCreateBy(userId+"");
|
||||
toBeRepair.setIsScrapFilter(Integer.valueOf(toBeRepair.getIsScrap()));
|
||||
int re3 = mapper.updateMaDevInfo(toBeRepair);
|
||||
if (re3 <= 0) {
|
||||
if (re3<=0){
|
||||
throw new Exception("更新台账信息失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ("编码管理".equals(bean.getManageMode()) && !StringHelper.isNullOrEmptyString(bean.getCode())) {
|
||||
//1、如果是编码管理,将设备状态改为维修状态
|
||||
if ("装备".equals(bean.getType())) {
|
||||
int re1 = mapper.updateDevStatus(bean);
|
||||
} else if ("工具".equals(bean.getType())) {
|
||||
int re2 = mapper.updateToolStatus(bean);
|
||||
}
|
||||
} else if ("数量管理".equals(bean.getManageMode())) {
|
||||
//目前数量管理的设备都是工具
|
||||
//将在库数量减掉增加维修数量
|
||||
int re3 = mapper.updateToolNum(bean);
|
||||
|
||||
} else {
|
||||
throw new Exception("缺少审核状态");
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
throw new Exception("缺少审核状态");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("审核成功");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("审批通过回调执行失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("审核失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -486,7 +470,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
throw new Exception("缺少合格状态数据");
|
||||
}
|
||||
fillFileUrl(detail);
|
||||
if ("1".equals(detail.getIsScrap()) && "数量管理".equals(detail.getManageMode())) {
|
||||
if ("1".equals(detail.getIsScrap()) && "数量管理".equals(detail.getManageMode())){
|
||||
saveScrapAndQualified(detail);
|
||||
} else {
|
||||
insertDetail(detail);
|
||||
|
|
@ -526,6 +510,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理文件
|
||||
*/
|
||||
|
|
@ -543,7 +528,6 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
/**
|
||||
* 生成任务编号
|
||||
*
|
||||
* @param thisMonthMaxOrder
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.scrap.domain;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.material.devchange.domain.MaDevFile;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -126,7 +127,7 @@ public class ToBeScrap {
|
|||
/**
|
||||
* 附件
|
||||
*/
|
||||
private List<BmFileInfo> bmFileInfos;
|
||||
private List<MaDevFile> bmFileInfos;
|
||||
|
||||
/**
|
||||
* 退役明细列表
|
||||
|
|
@ -176,5 +177,5 @@ public class ToBeScrap {
|
|||
@ApiModelProperty(value = "所属公司id")
|
||||
private Long companyId;
|
||||
|
||||
|
||||
private String reasonUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.scrap.service.impl;
|
||||
|
||||
import cn.hutool.core.net.URLDecoder;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
|
|
@ -10,11 +11,13 @@ import com.bonus.material.approval.annotation.ApprovalRequired;
|
|||
import com.bonus.material.common.constants.TypeConstants;
|
||||
import com.bonus.material.common.enums.TypeEnums;
|
||||
import com.bonus.material.devchange.domain.CsDeviceInfo;
|
||||
import com.bonus.material.devchange.domain.MaDevFile;
|
||||
import com.bonus.material.repair.domain.ToBeRepair;
|
||||
import com.bonus.material.scrap.domain.ToBeScrap;
|
||||
import com.bonus.material.scrap.mapper.ScrapMapper;
|
||||
import com.bonus.material.scrap.service.ToBeScrapService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -23,6 +26,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -82,7 +86,7 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
if (Objects.equals("工具", toBeScrap.getType())) {
|
||||
// 根据typeId和code查询台账信息
|
||||
ToBeScrap bean1 = scrapMapper.selectByTypeIdAndCode(toBeScrap);
|
||||
if (bean1 != null && bean1.getId() > 0){
|
||||
if (bean1 != null && bean1.getId() > 0) {
|
||||
//1、添加周期表数据
|
||||
ToBeScrap bean2 = new ToBeScrap();
|
||||
bean2.setId(bean1.getId());
|
||||
|
|
@ -108,7 +112,7 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
toBeScrap.setCreateBy(userId);
|
||||
toBeScrap.setIsScrapFilter(1);
|
||||
int updateDevInfos = scrapMapper.updateMaDevInfo(toBeScrap);
|
||||
if (updateDevInfos <= 0){
|
||||
if (updateDevInfos <= 0) {
|
||||
throw new ServiceException("更新台账信息失败");
|
||||
}
|
||||
} else {
|
||||
|
|
@ -167,7 +171,6 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// 如果是编辑操作,那么就直接把之前的任务删掉重新建立
|
||||
if (Objects.equals("edit", bean.getOperationType())) {
|
||||
scrapMapper.deleteChangeInfo(bean.getId());
|
||||
|
|
@ -200,6 +203,10 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
// ========== 步骤2:计算总占用数量(在途 + 本次申请) ==========
|
||||
BigDecimal totalOccupyNum = onWayNum.add(applyNum);
|
||||
|
||||
toBeScrap.getBmFileInfos().forEach(item -> {
|
||||
toBeScrap.setScrapUrl(item.getFileUrl());
|
||||
});
|
||||
|
||||
// ========== 步骤3:业务校验(usedNum < totalOccupyNum 时触发错误) ==========
|
||||
if (usedNum.compareTo(totalOccupyNum) < 0) {
|
||||
// 格式化数值:根据业务场景选择舍入模式(此处以保留2位小数、四舍五入为例,可调整)
|
||||
|
|
@ -209,7 +216,7 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
String typeName = toBeScrap.getTypeName();
|
||||
|
||||
// 构建错误信息
|
||||
String errorMsg = String.format("%s,已有在途单据,在途数量%s,本次申请数量%s", typeName, totalOccupyNumStr,applyNumStr);
|
||||
String errorMsg = String.format("%s,已有在途单据,在途数量%s,本次申请数量%s", typeName, totalOccupyNumStr, applyNumStr);
|
||||
|
||||
// 记录日志:包含关键参数,便于问题排查
|
||||
// 返回错误结果
|
||||
|
|
@ -217,7 +224,6 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
toBeScrap.setChangeId(changeId);
|
||||
toBeScrap.setCreateUser(username);
|
||||
|
||||
|
|
@ -241,6 +247,7 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
|
||||
/**
|
||||
* 生成退役任务编号
|
||||
*
|
||||
* @param thisMonthMaxOrder 本月最大单号
|
||||
* @return 任务单号
|
||||
*/
|
||||
|
|
@ -285,17 +292,16 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
|
||||
try {
|
||||
List<ToBeScrap> list = scrapMapper.getScrapDetailsList(bean);
|
||||
if (!list.isEmpty()) {
|
||||
for (ToBeScrap toBeScrap : list) {
|
||||
if (!StringHelper.isNullOrEmptyString(toBeScrap.getScrapUrl())) {
|
||||
List<BmFileInfo> bmFileInfos = new ArrayList<>();
|
||||
BmFileInfo fileInfo = new BmFileInfo();
|
||||
fileInfo.setFileUrl(toBeScrap.getScrapUrl());
|
||||
bmFileInfos.add(fileInfo);
|
||||
toBeScrap.setBmFileInfos(bmFileInfos);
|
||||
}
|
||||
list.forEach(item -> {
|
||||
if(ObjectUtils.isNotEmpty(item.getScrapUrl())){
|
||||
MaDevFile maDevFile = new MaDevFile();
|
||||
maDevFile.setFileUrl(item.getScrapUrl());
|
||||
maDevFile.setFileName(getFileNameFromUrl(item.getReasonUrl()));
|
||||
item.setBmFileInfos(new ArrayList<>());
|
||||
item.getBmFileInfos().add(maDevFile);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -304,6 +310,34 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从标准文件URL中提取文件名(适配你的场景)
|
||||
*
|
||||
* @param urlStr item.getReasonUrl() 返回的URL字符串
|
||||
* @return 提取的文件名(如 36448a87-a53a-4d49-aa78-1639ca72440d.png)
|
||||
*/
|
||||
public static String getFileNameFromUrl(String urlStr) {
|
||||
// 1. 空值校验
|
||||
if (urlStr == null || urlStr.trim().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 2. 移除URL中的参数和锚点(你的场景无参数/锚点,仅做兼容)
|
||||
String cleanUrl = urlStr.split("\\?")[0].split("#")[0];
|
||||
|
||||
// 3. 提取最后一个"/"后的内容(核心步骤)
|
||||
int lastSlashIndex = cleanUrl.lastIndexOf('/');
|
||||
if (lastSlashIndex == -1 || lastSlashIndex == cleanUrl.length() - 1) {
|
||||
return ""; // 无"/"或以"/"结尾,返回空
|
||||
}
|
||||
String fileName = cleanUrl.substring(lastSlashIndex + 1);
|
||||
|
||||
// 4. 解码URL编码(你的场景无编码,但保留以兼容扩展)
|
||||
return URLDecoder.decode(fileName, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -46,15 +46,13 @@ public class MaSupplierController extends BaseController {
|
|||
@ApiOperation("新增")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MaSupplier bean) {
|
||||
int i = maSupplierService.add(bean);
|
||||
return i > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
|
||||
return maSupplierService.add(bean);
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MaSupplier bean) {
|
||||
int i = maSupplierService.edit(bean);
|
||||
return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
|
||||
return maSupplierService.edit(bean);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ public interface MaSupplierMapper {
|
|||
int deleteById(@Param("supplierId") Long supplierId);
|
||||
|
||||
List<MaSupplier> listEnabled();
|
||||
|
||||
int getNum(MaSupplier supplier);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.supplier.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.supplier.domain.MaSupplier;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -9,9 +10,9 @@ public interface MaSupplierService {
|
|||
|
||||
List<MaSupplier> list(MaSupplier query);
|
||||
|
||||
int add(MaSupplier supplier);
|
||||
AjaxResult add(MaSupplier supplier);
|
||||
|
||||
int edit(MaSupplier supplier);
|
||||
AjaxResult edit(MaSupplier supplier);
|
||||
|
||||
int remove(Long supplierId);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.supplier.service.impl;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.supplier.domain.MaSupplier;
|
||||
import com.bonus.material.supplier.mapper.MaSupplierMapper;
|
||||
import com.bonus.material.supplier.service.MaSupplierService;
|
||||
|
|
@ -25,13 +26,31 @@ public class MaSupplierServiceImpl implements MaSupplierService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int add(MaSupplier supplier) {
|
||||
return maSupplierMapper.insert(supplier);
|
||||
public AjaxResult add(MaSupplier supplier) {
|
||||
try {
|
||||
int num = maSupplierMapper.getNum(supplier);
|
||||
if (num > 0) {
|
||||
return AjaxResult.error("统一社会信用代码已存在");
|
||||
}
|
||||
int insert = maSupplierMapper.insert(supplier);
|
||||
return insert > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int edit(MaSupplier supplier) {
|
||||
return maSupplierMapper.update(supplier);
|
||||
public AjaxResult edit(MaSupplier supplier) {
|
||||
try {
|
||||
int num = maSupplierMapper.getNum(supplier);
|
||||
if (num > 0) {
|
||||
return AjaxResult.error("统一社会信用代码已存在");
|
||||
}
|
||||
int update = maSupplierMapper.update(supplier);
|
||||
return update > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ import java.time.LocalDateTime;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.ADMIN_ID;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.PROVINCE_COMPANY_DEPT_ID;
|
||||
|
||||
@Service
|
||||
public class ToolServiceImpl implements ToolService {
|
||||
private static final Logger log = LoggerFactory.getLogger(ToolServiceImpl.class);
|
||||
|
|
@ -47,6 +50,7 @@ public class ToolServiceImpl implements ToolService {
|
|||
*/
|
||||
@Override
|
||||
public List<ToolEntity> list(ToolEntity entity) {
|
||||
|
||||
return toolMapper.list(entity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public interface ToolLedgerMapper {
|
|||
|
||||
String getCode();
|
||||
|
||||
ToolLedgerEntity getByType(Long typeId);
|
||||
ToolLedgerEntity getByType(@Param("typeId") Long typeId, @Param("companyId") Long companyId);
|
||||
|
||||
Integer updateByTypeAndId(ToolLedgerEntity entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,19 @@ public class ToolApplyController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工具录入删除
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "工具录入删除")
|
||||
@PostMapping("/deleteTool")
|
||||
public AjaxResult deleteTool(Integer id) {
|
||||
return toolApplyService.deleteTool(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工具录入申请单表格
|
||||
*
|
||||
|
|
@ -139,6 +152,19 @@ public class ToolApplyController extends BaseController {
|
|||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工具录入申请单表格
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return 表格
|
||||
*/
|
||||
@ApiOperation(value = "工具录入申请单表格")
|
||||
@GetMapping("/listWarehousingToolByApplyId")
|
||||
public AjaxResult listWarehousingToolByApplyId(ToolApplyDetailsEntity entity) {
|
||||
return toolApplyService.listWarehousingToolByApplyId(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具录入新增
|
||||
*
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ public class ToolApplyDetailsEntity extends ToolEntity {
|
|||
* 数据库类型:decimal(10,2) DEFAULT NULL
|
||||
*/
|
||||
private BigDecimal toolPrice;
|
||||
|
||||
private BigDecimal originCost;
|
||||
/**
|
||||
* 出厂日期(对应字段:production_date)
|
||||
* 数据库类型:datetime DEFAULT NULL
|
||||
|
|
@ -94,6 +96,9 @@ public class ToolApplyDetailsEntity extends ToolEntity {
|
|||
*/
|
||||
private List<MaDevFile> purchaseInvoices;
|
||||
|
||||
private String unitName;
|
||||
|
||||
private Long toolId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,5 +122,10 @@ public interface ToolApplyMapper {
|
|||
List<Long> selectAllDetailIdsByApplyId(ToolApplyDetailsEntity entity);
|
||||
|
||||
List<ToolApplyDetailsEntity> listById(@Param("ids") List<Long> ids);
|
||||
|
||||
|
||||
Integer deleteTool(Integer id);
|
||||
|
||||
List<ToolApplyDetailsEntity> listWarehousingToolByApplyId(ToolApplyDetailsEntity entity);
|
||||
|
||||
void updateByToolId(ToolApplyDetailsEntity item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.toolProcess.service.Impl;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.devchange.mapper.MaDevInfoMapper;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.bonus.material.device.mapper.DevMergeMapper;
|
||||
import com.bonus.material.tool.domain.ToolEntity;
|
||||
import com.bonus.material.toolLedger.domain.ToolLedgerEntity;
|
||||
|
|
@ -101,7 +102,13 @@ public class ToolApplyServiceImpl implements ToolApplyService {
|
|||
*/
|
||||
@Override
|
||||
public List<ToolApplyDetailsEntity> listByApplyId(ToolApplyDetailsEntity entity) {
|
||||
return toolApplyMapper.listByApplyId(entity);
|
||||
List<ToolApplyDetailsEntity> toolApplyDetailsEntities = toolApplyMapper.listByApplyId(entity);
|
||||
toolApplyDetailsEntities.forEach(item -> {
|
||||
item.setCertificates(maDevInfoMapper.getFileList(item.getId() + 200000, 2));
|
||||
item.setInspectionReports(maDevInfoMapper.getFileList(item.getId() + 200000, 3));
|
||||
item.setPurchaseInvoices(maDevInfoMapper.getFileList(item.getId() + 200000, 4));
|
||||
});
|
||||
return toolApplyDetailsEntities;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,6 +138,7 @@ public class ToolApplyServiceImpl implements ToolApplyService {
|
|||
public AjaxResult addDetail(List<ToolApplyDetailsEntity> entity) {
|
||||
try {
|
||||
for (ToolApplyDetailsEntity detail : entity) {
|
||||
toolApplyMapper.deleteTool(detail.getId());
|
||||
Integer num = toolApplyMapper.addDetail(detail);
|
||||
if (num > 0) {
|
||||
detail.getCertificates().forEach(item -> {
|
||||
|
|
@ -279,8 +287,10 @@ public class ToolApplyServiceImpl implements ToolApplyService {
|
|||
file.setCreator(Math.toIntExact(SecurityUtils.getLoginUser().getUserid()));
|
||||
devMergeMapper.interFile(file);
|
||||
});
|
||||
item.setToolId(toolLedgerEntity.getId());
|
||||
toolApplyMapper.updateByToolId(item);
|
||||
} else {
|
||||
ToolLedgerEntity byType = toolLedgerMapper.getByType(item.getTypeId());
|
||||
ToolLedgerEntity byType = toolLedgerMapper.getByType(item.getTypeId(),SecurityUtils.getLoginUser().getSysUser().getDeptId());
|
||||
if (byType != null) {
|
||||
BigDecimal totalNum = byType.getTotalNum();
|
||||
BigDecimal applyNum = item.getApplyNum();
|
||||
|
|
@ -294,6 +304,8 @@ public class ToolApplyServiceImpl implements ToolApplyService {
|
|||
byType.setAvailableNum(availableNum.add(applyNum));
|
||||
byType.setOriginCost(item.getToolPrice());
|
||||
toolLedgerMapper.updateByTypeAndId(byType);
|
||||
item.setToolId(byType.getId());
|
||||
toolApplyMapper.updateByToolId(item);
|
||||
} else {
|
||||
ToolLedgerEntity toolLedgerEntity = new ToolLedgerEntity();
|
||||
toolLedgerEntity.setTypeId(item.getTypeId());
|
||||
|
|
@ -334,6 +346,9 @@ public class ToolApplyServiceImpl implements ToolApplyService {
|
|||
file.setCreator(Math.toIntExact(SecurityUtils.getLoginUser().getUserid()));
|
||||
devMergeMapper.interFile(file);
|
||||
});
|
||||
|
||||
item.setToolId(toolLedgerEntity.getId());
|
||||
toolApplyMapper.updateByToolId(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -393,6 +408,36 @@ public class ToolApplyServiceImpl implements ToolApplyService {
|
|||
return toolApplyMapper.listEncoding(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteTool(Integer id) {
|
||||
try {
|
||||
Integer num = toolApplyMapper.deleteTool(id);
|
||||
return num > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult listWarehousingToolByApplyId(ToolApplyDetailsEntity entity) {
|
||||
List<ToolApplyDetailsEntity> toolApplyDetailsEntities = toolApplyMapper.listWarehousingToolByApplyId(entity);
|
||||
toolApplyDetailsEntities.forEach(item -> {
|
||||
item.setCertificates(maDevInfoMapper.getFileList(item.getId() + 200000, 2));
|
||||
item.setInspectionReports(maDevInfoMapper.getFileList(item.getId() + 200000, 3));
|
||||
item.setPurchaseInvoices(maDevInfoMapper.getFileList(item.getId() + 200000, 4));
|
||||
});
|
||||
return AjaxResult.success(toolApplyDetailsEntities);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归为父节点添加子节点
|
||||
|
|
|
|||
|
|
@ -104,4 +104,8 @@ public interface ToolApplyService {
|
|||
List<ToolApplyEntity> listReview(ToolApplyEntity entity);
|
||||
|
||||
List<ToolApplyDetailsEntity> listEncoding(ToolApplyDetailsEntity entity);
|
||||
|
||||
AjaxResult deleteTool(Integer id);
|
||||
|
||||
AjaxResult listWarehousingToolByApplyId(ToolApplyDetailsEntity entity);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,4 +346,6 @@ public class EquipmentEntity {
|
|||
@ApiModelProperty(value = "是否改价")
|
||||
private Boolean isChangePrice;
|
||||
|
||||
|
||||
private Long companyId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.upOrDown.equipment.service.impl;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity;
|
||||
import com.bonus.material.upOrDown.equipment.mapper.UpOrDownEquipmentMapper;
|
||||
import com.bonus.material.upOrDown.equipment.service.UpOrDownEquipmentService;
|
||||
|
|
@ -12,6 +13,9 @@ import javax.annotation.Resource;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.ADMIN_ID;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.PROVINCE_COMPANY_DEPT_ID;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
|
|
@ -26,11 +30,29 @@ public class UpOrDownEquipmentServiceImpl implements UpOrDownEquipmentService {
|
|||
|
||||
@Override
|
||||
public List<EquipmentEntity> list(EquipmentEntity entity) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 管理员和省公司可查看所有数据
|
||||
if (userId != null && deptId != null
|
||||
&& !userId.equals(ADMIN_ID)
|
||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||
entity.setCompanyId(deptId);
|
||||
}
|
||||
|
||||
return upOrDownEquipmentMapper.list(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipmentEntity> listByDown(EquipmentEntity entity) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 管理员和省公司可查看所有数据
|
||||
if (userId != null && deptId != null
|
||||
&& !userId.equals(ADMIN_ID)
|
||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||
entity.setCompanyId(deptId);
|
||||
}
|
||||
|
||||
return upOrDownEquipmentMapper.listByDown(entity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,4 +193,5 @@ public class ToolEntity {
|
|||
|
||||
@ApiModelProperty(value = "是否改价")
|
||||
private Boolean isChangePrice;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.upOrDown.tool.service.impl;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.upOrDown.tool.entity.ToolEntity;
|
||||
import com.bonus.material.upOrDown.tool.mapper.UpOrDownToolMapper;
|
||||
import com.bonus.material.upOrDown.tool.service.UpOrDownToolService;
|
||||
|
|
@ -12,6 +13,9 @@ import javax.annotation.Resource;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.ADMIN_ID;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.PROVINCE_COMPANY_DEPT_ID;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
|
|
@ -31,11 +35,27 @@ public class UpOrDownToolServiceImpl implements UpOrDownToolService {
|
|||
|
||||
@Override
|
||||
public List<ToolEntity> list(ToolEntity entity) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 管理员和省公司可查看所有数据
|
||||
if (userId != null && deptId != null
|
||||
&& !userId.equals(ADMIN_ID)
|
||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||
entity.setCompanyId(deptId);
|
||||
}
|
||||
return upOrDownToolMapper.list(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ToolEntity> listByNumber(ToolEntity entity) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 管理员和省公司可查看所有数据
|
||||
if (userId != null && deptId != null
|
||||
&& !userId.equals(ADMIN_ID)
|
||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||
entity.setCompanyId(deptId);
|
||||
}
|
||||
return upOrDownToolMapper.listByNumber(entity);
|
||||
}
|
||||
|
||||
|
|
@ -46,6 +66,14 @@ public class UpOrDownToolServiceImpl implements UpOrDownToolService {
|
|||
|
||||
@Override
|
||||
public List<ToolEntity> listByCode(ToolEntity entity) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 管理员和省公司可查看所有数据
|
||||
if (userId != null && deptId != null
|
||||
&& !userId.equals(ADMIN_ID)
|
||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||
entity.setCompanyId(deptId);
|
||||
}
|
||||
return upOrDownToolMapper.listByCode(entity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@ package com.bonus.material.warehousing.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.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.warehousing.domain.WarehousingEntity;
|
||||
import com.bonus.material.warehousing.service.WarehousingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -48,8 +47,8 @@ public class WarehousingController extends BaseController {
|
|||
* @param warehousing 入库实体
|
||||
* @return 是否成功
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public AjaxResult add(WarehousingEntity warehousing) {
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody WarehousingEntity warehousing) {
|
||||
return service.add(warehousing);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +70,7 @@ public class WarehousingController extends BaseController {
|
|||
* @return 是否成功
|
||||
*/
|
||||
@PostMapping("/updateById")
|
||||
public AjaxResult updateById(WarehousingEntity warehousing) {
|
||||
public AjaxResult updateById(@RequestBody WarehousingEntity warehousing) {
|
||||
return service.updateById(warehousing);
|
||||
}
|
||||
|
||||
|
|
@ -86,5 +85,45 @@ public class WarehousingController extends BaseController {
|
|||
return service.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchSubmission/{ids}")
|
||||
public AjaxResult batchSubmission(@PathVariable("ids") Integer[] ids) {
|
||||
return service.batchSubmission(ids);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchApproval/{ids}")
|
||||
public AjaxResult batchApproval(@PathVariable("ids") Integer[] ids) {
|
||||
return service.batchApproval(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchRejection/{ids}")
|
||||
public AjaxResult batchRejection(@PathVariable("ids") Integer[] ids) {
|
||||
return service.batchRejection(ids);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getDevDetails")
|
||||
public AjaxResult getDevDetails(Integer id) {
|
||||
return service.getDevDetails(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.warehousing.domain;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
@ -45,7 +46,10 @@ public class WarehousingEntity implements Serializable {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss", // 日期格式
|
||||
timezone = "GMT+8" // 时区(避免东八区时间偏移)
|
||||
)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -56,6 +60,29 @@ public class WarehousingEntity implements Serializable {
|
|||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss", // 日期格式
|
||||
timezone = "GMT+8" // 时区(避免东八区时间偏移)
|
||||
)
|
||||
private Date approvalTime;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 装数量
|
||||
*/
|
||||
private Integer maNum;
|
||||
/**
|
||||
* 工具数量
|
||||
*/
|
||||
private Integer toolNum;
|
||||
|
||||
private Long companyId;
|
||||
|
||||
private Long userId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.bonus.material.warehousing.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class WarehousingRecordEntity implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 工具类型
|
||||
*/
|
||||
private String devType;
|
||||
/**
|
||||
* 原始编码
|
||||
*/
|
||||
private String identifyCode;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 类目
|
||||
*/
|
||||
private String category;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String devModel;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss", // 日期格式
|
||||
timezone = "GMT+8" // 时区(避免东八区时间偏移)
|
||||
)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 审批人
|
||||
*/
|
||||
private String approvalUser;
|
||||
|
||||
/**
|
||||
* 审批时间
|
||||
*/
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss", // 日期格式
|
||||
timezone = "GMT+8" // 时区(避免东八区时间偏移)
|
||||
)
|
||||
private Date approvalTime;
|
||||
}
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
package com.bonus.material.warehousing.mapper;
|
||||
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeVo;
|
||||
import com.bonus.material.devchange.domain.DevChangeVo;
|
||||
import com.bonus.material.devchange.domain.MapBean;
|
||||
import com.bonus.material.warehousing.domain.WarehousingEntity;
|
||||
import com.bonus.material.warehousing.domain.WarehousingRecordEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -45,4 +50,38 @@ public interface WarehousingMapper {
|
|||
* @return 入库记录列表
|
||||
*/
|
||||
List<WarehousingEntity> selectList(WarehousingEntity warehousing);
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Integer batchSubmission(@Param("array") Integer[] ids);
|
||||
|
||||
/**
|
||||
* 批量驳回
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Integer batchRejection(@Param("array") Integer[] ids);
|
||||
|
||||
/**
|
||||
* 批量同意
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Integer batchApproval(@Param("array") Integer[] ids, @Param("nickName") String nickName);
|
||||
|
||||
/**
|
||||
* 查询出库单
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<WarehousingRecordEntity> getDevDetails(Integer id);
|
||||
|
||||
List<String> getMaIds(String orderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
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.devchange.domain.MapBean;
|
||||
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 com.bonus.material.warehousing.service.WarehousingService;
|
||||
|
|
@ -11,12 +17,20 @@ import org.springframework.stereotype.Service;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.ADMIN_ID;
|
||||
import static com.bonus.common.biz.constant.MaterialConstants.PROVINCE_COMPANY_DEPT_ID;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WarehousingServiceImpl implements WarehousingService {
|
||||
@Resource
|
||||
private WarehousingMapper mapper;
|
||||
@Resource
|
||||
private ToolApplyService toolApplyService;
|
||||
@Resource
|
||||
private DevMergeService devMergeService;
|
||||
|
||||
/**
|
||||
* 新增入库记录
|
||||
|
|
@ -27,8 +41,10 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
@Override
|
||||
public AjaxResult add(WarehousingEntity warehousing) {
|
||||
try {
|
||||
warehousing.setCreateUser(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
warehousing.setUserId(SecurityUtils.getLoginUser().getUserid());
|
||||
int insert = mapper.insert(warehousing);
|
||||
return insert > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
return insert > 0 ? AjaxResult.success(warehousing) : AjaxResult.error();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
|
|
@ -95,6 +111,14 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
@Override
|
||||
public List<WarehousingEntity> list(WarehousingEntity warehousing) {
|
||||
try {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 管理员和省公司可查看所有数据
|
||||
if (userId != null && deptId != null
|
||||
&& !userId.equals(ADMIN_ID)
|
||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||
warehousing.setCompanyId(deptId);
|
||||
}
|
||||
List<WarehousingEntity> warehousingEntities = mapper.selectList(warehousing);
|
||||
return ObjectUtils.isNotEmpty(warehousingEntities) ? warehousingEntities : new ArrayList<WarehousingEntity>();
|
||||
} catch (Exception e) {
|
||||
|
|
@ -102,4 +126,104 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|||
return new ArrayList<WarehousingEntity>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult batchSubmission(Integer[] ids) {
|
||||
try {
|
||||
// 1. 空值/空数组校验:提前终止无效请求
|
||||
if (ObjectUtils.isEmpty(ids) || ids.length == 0) {
|
||||
return AjaxResult.error("批量提交失败:未选择数据");
|
||||
}
|
||||
for (Integer id : ids) {
|
||||
WarehousingEntity entity = mapper.selectById(id);
|
||||
if (entity.getMaNum() == 0 && entity.getToolNum() == 0) {
|
||||
return AjaxResult.error("存在装备数和工具数均为0的申请单,提交失败");
|
||||
}
|
||||
}
|
||||
Integer num = mapper.batchSubmission(ids);
|
||||
return num > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量同意
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult batchApproval(Integer[] ids) {
|
||||
try {
|
||||
String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||
Integer num = mapper.batchApproval(ids, nickName);
|
||||
if (num > 0) {
|
||||
for (Integer id : ids) {
|
||||
WarehousingEntity entity = mapper.selectById(id);
|
||||
if (ObjectUtils.isNotEmpty(entity)) {
|
||||
if (ObjectUtils.isNotEmpty(entity.getApplyId())) {
|
||||
ToolApplyDetailsEntity toolApplyDetailsEntity = new ToolApplyDetailsEntity();
|
||||
toolApplyDetailsEntity.setApplyId(Long.valueOf(entity.getApplyId()));
|
||||
toolApplyDetailsEntity.setStatus("2");
|
||||
toolApplyService.updateAllDetail(toolApplyDetailsEntity);
|
||||
}
|
||||
|
||||
if (ObjectUtils.isNotEmpty(entity.getOrderId())) {
|
||||
if (ObjectUtils.isNotEmpty(entity.getOrderId())) {
|
||||
DevMergeVo devMergeVo = new DevMergeVo();
|
||||
devMergeVo.setId(entity.getOrderId());
|
||||
devMergeVo.setStatus("1");
|
||||
List<String> list = mapper.getMaIds(entity.getOrderId());
|
||||
String maIdsStr = list.stream()
|
||||
.filter(str -> str != null && !str.trim().isEmpty()) // 可选:过滤空值/空白符
|
||||
.collect(Collectors.joining(","));
|
||||
devMergeVo.setDevIds(maIdsStr);
|
||||
devMergeService.checkDevice(devMergeVo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return num > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量驳回
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult batchRejection(Integer[] ids) {
|
||||
try {
|
||||
Integer num = mapper.batchRejection(ids);
|
||||
return num > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getDevDetails(Integer id) {
|
||||
return AjaxResult.success(mapper.getDevDetails(id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.warehousing.service;
|
|||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.warehousing.domain.WarehousingEntity;
|
||||
import com.bonus.material.warehousing.domain.WarehousingRecordEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -45,4 +46,35 @@ public interface WarehousingService {
|
|||
* @return 入库记录列表
|
||||
*/
|
||||
List<WarehousingEntity> list(WarehousingEntity warehousing);
|
||||
|
||||
/**
|
||||
* 批量提交
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
AjaxResult batchSubmission(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 批量同意
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
AjaxResult batchApproval(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 批量驳回
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
AjaxResult batchRejection(Integer[] ids);
|
||||
|
||||
|
||||
|
||||
AjaxResult getDevDetails(Integer id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.material.approval.mapper.ApprovalNodeMapper">
|
||||
|
||||
<resultMap id="ApprovalNodeResult" type="com.bonus.material.approval.domain.ApprovalNode">
|
||||
|
|
@ -18,18 +18,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="name" column="name"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectNodeVo">
|
||||
select id, process_id, node_code, node_name, node_order, approver_type, approver_ids,
|
||||
approve_mode, auto_pass, create_by, create_time, update_by, update_time
|
||||
select id,
|
||||
process_id,
|
||||
node_code,
|
||||
node_name,
|
||||
node_order,
|
||||
approver_type,
|
||||
approver_ids,
|
||||
approve_mode,
|
||||
auto_pass,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from bm_approval_node
|
||||
</sql>
|
||||
|
||||
<select id="selectNodeListByProcessId" parameterType="Long" resultMap="ApprovalNodeResult">
|
||||
<include refid="selectNodeVo"/>
|
||||
where process_id = #{processId}
|
||||
order by node_order asc
|
||||
SELECT ban.id,
|
||||
ban.process_id,
|
||||
ban.node_code,
|
||||
ban.node_name,
|
||||
ban.node_order,
|
||||
ban.approver_type,
|
||||
ban.approver_ids,
|
||||
ban.approve_mode,
|
||||
ban.auto_pass,
|
||||
ban.create_by,
|
||||
ban.create_time,
|
||||
ban.update_by,
|
||||
ban.update_time,
|
||||
-- 拼接多个人/角色名称,无匹配则返回'未配置'
|
||||
COALESCE(
|
||||
CASE
|
||||
WHEN ban.approver_type = '1' THEN
|
||||
(SELECT GROUP_CONCAT(su.nick_name)
|
||||
FROM sys_user su
|
||||
WHERE FIND_IN_SET(su.user_id, ban.approver_ids))
|
||||
WHEN ban.approver_type = '2' THEN
|
||||
(SELECT GROUP_CONCAT(sr.role_name)
|
||||
FROM sys_role sr
|
||||
WHERE FIND_IN_SET(sr.role_id, ban.approver_ids))
|
||||
END,
|
||||
'未配置'
|
||||
) AS name
|
||||
FROM bm_approval_node ban
|
||||
where ban.process_id = #{processId}
|
||||
order by ban.node_order asc
|
||||
</select>
|
||||
|
||||
<select id="selectNodeById" parameterType="Long" resultMap="ApprovalNodeResult">
|
||||
|
|
@ -43,7 +82,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertNode" parameterType="com.bonus.material.approval.domain.ApprovalNode" useGeneratedKeys="true" keyProperty="id">
|
||||
<insert id="insertNode" parameterType="com.bonus.material.approval.domain.ApprovalNode" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into bm_approval_node
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="processId != null">process_id,</if>
|
||||
|
|
@ -87,20 +127,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteNodeById" parameterType="Long">
|
||||
delete from bm_approval_node where id = #{id}
|
||||
delete
|
||||
from bm_approval_node
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteNodeByProcessId" parameterType="Long">
|
||||
delete from bm_approval_node where process_id = #{processId}
|
||||
delete
|
||||
from bm_approval_node
|
||||
where process_id = #{processId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertNode" parameterType="java.util.List">
|
||||
insert into bm_approval_node (process_id, node_code, node_name, node_order, approver_type,
|
||||
approver_ids, approve_mode, auto_pass, create_by, create_time)
|
||||
insert into bm_approval_node (process_id, node_code, node_name, node_order, approver_type,
|
||||
approver_ids, approve_mode, auto_pass, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.processId}, #{item.nodeCode}, #{item.nodeName}, #{item.nodeOrder}, #{item.approverType},
|
||||
#{item.approverIds}, #{item.approveMode}, #{item.autoPass}, #{item.createBy}, now())
|
||||
#{item.approverIds}, #{item.approveMode}, #{item.autoPass}, #{item.createBy}, now())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@
|
|||
mdi.item_type_model AS typeModelName,
|
||||
mdi.manage_type AS manageType,
|
||||
mdi.code AS devCode,
|
||||
SUM(CASE WHEN mdi.ma_status = 2 THEN 1 ELSE 0 END) AS useNum,
|
||||
SUM(CASE WHEN mdi.ma_status = 2 || mdi.ma_status = 3 THEN 1 ELSE 0 END) AS useNum,
|
||||
1 AS devType,
|
||||
mdi.type_id AS typeId,
|
||||
mdi.ma_id AS id
|
||||
|
|
@ -485,7 +485,7 @@
|
|||
tt.type_name as typeModelName,
|
||||
tl.manage_mode as manageType,
|
||||
IFNULL(tl.tool_code,'/') as devCode,
|
||||
tl.in_num as useNum,
|
||||
(tl.in_num + tl.share_num) as useNum,
|
||||
2 as devType,
|
||||
tl.type_id as typeId,
|
||||
tl.id as id
|
||||
|
|
|
|||
|
|
@ -341,22 +341,6 @@
|
|||
</select>
|
||||
|
||||
<select id="getDevDetailsInfo" resultType="com.bonus.material.devchange.domain.CsDeviceDetails">
|
||||
<!-- 装备部分:原有递归查询逻辑不变 -->
|
||||
WITH RECURSIVE category_tree AS (
|
||||
SELECT type_id FROM ma_type
|
||||
WHERE type_id = #{categoryEquipment}
|
||||
UNION ALL
|
||||
SELECT t.type_id FROM ma_type t
|
||||
INNER JOIN category_tree ct ON t.parent_id = ct.type_id
|
||||
),
|
||||
-- 工具分类递归查询(独立CTE)
|
||||
tool_category_tree AS (
|
||||
SELECT type_id FROM tool_type
|
||||
WHERE type_id = #{toolTypeId}
|
||||
UNION ALL
|
||||
SELECT t.type_id FROM tool_type t
|
||||
INNER JOIN tool_category_tree tct ON t.parent_id = tct.type_id
|
||||
)
|
||||
-- 装备表查询(原有逻辑不变)
|
||||
SELECT
|
||||
CASE
|
||||
|
|
@ -473,6 +457,7 @@
|
|||
AND 1=0
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
d.is_active = '1' AND d.ma_status='1'
|
||||
AND d.up_down_status = '1'
|
||||
<if test="maType != null and maType != ''">
|
||||
AND mtv.maxTypeId = #{maType}
|
||||
</if>
|
||||
)
|
||||
UNION ALL
|
||||
-- 第二个子查询:工具表数据
|
||||
|
|
@ -186,6 +189,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
|
||||
WHERE
|
||||
tl.up_down_status = '1' AND tl.available_num >0
|
||||
<if test="toolType != null and toolType != ''">
|
||||
AND tt4.type_id = #{toolType}
|
||||
</if>
|
||||
)
|
||||
) t
|
||||
-- 外层筛选条件:所有动态和固定筛选条件集中在这里
|
||||
|
|
@ -323,15 +329,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
OR LOCATE(#{keyWord}, t.companyName) > 0 -- 对应sd.dept_name
|
||||
)
|
||||
</if>
|
||||
-- 7. 设备类型筛选(设备表=mtv.maxTypeId,工具表=tt4.type_id)
|
||||
<if test="maType != null and maType != ''">
|
||||
AND t.maType = #{maType}
|
||||
</if>
|
||||
-- 8. 工具类型筛选(仅对工具表生效,设备表该字段为NULL,自动过滤)
|
||||
<if test="toolType != null and toolType != ''">
|
||||
|
||||
AND t.toolType = #{toolType}
|
||||
</if>
|
||||
<if test="updateTimeOrderBy == null">
|
||||
ORDER BY t.updateTime DESC
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -158,7 +158,8 @@
|
|||
now(),
|
||||
'1')
|
||||
</insert>
|
||||
<insert parameterType="com.bonus.material.devchange.domain.MaDevInfoXlsx" id="interDeviceXlsx" useGeneratedKeys="true"
|
||||
<insert parameterType="com.bonus.material.devchange.domain.MaDevInfoXlsx" id="interDeviceXlsx"
|
||||
useGeneratedKeys="true"
|
||||
keyProperty="maId">
|
||||
INSERT INTO ma_dev_info (
|
||||
<!-- 必选字段:若业务要求必须传值,可去掉if判断 -->
|
||||
|
|
@ -237,14 +238,21 @@
|
|||
</delete>
|
||||
|
||||
<update id="updateDevice">
|
||||
<foreach collection="list" item="data" separator=";">
|
||||
UPDATE ma_dev_info SET entry_status = #{data.value} WHERE ma_id = #{data.key}
|
||||
UPDATE ma_dev_info
|
||||
<!-- 这里可根据实际需求修改要更新的字段,比如change_status/entry_status/ma_status -->
|
||||
SET entry_status = #{status}
|
||||
WHERE ma_id IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item.key} <!-- MapBean中的key属性对应ma_id -->
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateChangeStatus">
|
||||
<foreach collection="list" item="data" separator=";">
|
||||
UPDATE ma_dev_info SET change_status ='1',ma_status = '1' WHERE ma_id = #{data.key}
|
||||
UPDATE ma_dev_info
|
||||
SET change_status = '1', ma_status = '1'
|
||||
WHERE ma_id IN
|
||||
<foreach collection="list" item="data" open="(" separator="," close=")">
|
||||
#{data.key}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
|
@ -318,7 +326,7 @@
|
|||
JOIN ma_type t2 ON t1.type_id = t2.parent_id
|
||||
OR t1.type_id = (SELECT parent_id FROM ma_type WHERE type_id = t2.parent_id)
|
||||
WHERE t1.type_id = #{firstLevelId} -- 一级类型ID
|
||||
AND t1.parent_id = '0' -- 确保t1是一级类型
|
||||
AND t1.parent_id = '0' -- 确保t1是一级类型
|
||||
AND t2.del_flag = '0'
|
||||
</select>
|
||||
|
||||
|
|
@ -328,42 +336,37 @@
|
|||
SELECT *
|
||||
FROM (
|
||||
-- 先通过子查询生成包含child_count的中间结果
|
||||
SELECT
|
||||
t.type_id AS value,
|
||||
t.level,
|
||||
t.type_name AS label,
|
||||
t.parent_id AS parentId,
|
||||
-- 子查询统计:根据当前层级,统计对应下一级的数量(4级→5级,5级→6级,6级→0)
|
||||
CASE
|
||||
WHEN t.level = 4 THEN (
|
||||
SELECT COUNT(*)
|
||||
FROM ma_type t2
|
||||
WHERE t2.parent_id = t.type_id
|
||||
AND t2.del_flag = '0'
|
||||
AND t2.level = 5
|
||||
)
|
||||
WHEN t.level = 5 THEN (
|
||||
SELECT COUNT(*)
|
||||
FROM ma_type t2
|
||||
WHERE t2.parent_id = t.type_id
|
||||
AND t2.del_flag = '0'
|
||||
AND t2.level = 6
|
||||
)
|
||||
WHEN t.level = 6 THEN 0 -- 6级没有下一级,数量为0
|
||||
END AS child_count
|
||||
SELECT t.type_id AS value,
|
||||
t.level,
|
||||
t.type_name AS label,
|
||||
t.parent_id AS parentId,
|
||||
-- 子查询统计:根据当前层级,统计对应下一级的数量(4级→5级,5级→6级,6级→0)
|
||||
CASE
|
||||
WHEN t.level = 4 THEN (SELECT COUNT(*)
|
||||
FROM ma_type t2
|
||||
WHERE t2.parent_id = t.type_id
|
||||
AND t2.del_flag = '0'
|
||||
AND t2.level = 5)
|
||||
WHEN t.level = 5 THEN (SELECT COUNT(*)
|
||||
FROM ma_type t2
|
||||
WHERE t2.parent_id = t.type_id
|
||||
AND t2.del_flag = '0'
|
||||
AND t2.level = 6)
|
||||
WHEN t.level = 6 THEN 0 -- 6级没有下一级,数量为0
|
||||
END AS child_count
|
||||
FROM ma_type t3
|
||||
JOIN ma_type t ON
|
||||
t3.type_id = t.parent_id
|
||||
OR t3.type_id = (SELECT parent_id FROM ma_type WHERE type_id = t.parent_id)
|
||||
OR t3.type_id = (SELECT parent_id FROM ma_type WHERE type_id = (SELECT parent_id FROM ma_type WHERE type_id = t.parent_id))
|
||||
WHERE
|
||||
t3.type_id = #{thirdLevelId} -- 三级类型ID
|
||||
OR t3.type_id = (SELECT parent_id
|
||||
FROM ma_type
|
||||
WHERE type_id = (SELECT parent_id FROM ma_type WHERE type_id = t.parent_id))
|
||||
WHERE t3.type_id = #{thirdLevelId} -- 三级类型ID
|
||||
AND t.del_flag = '0'
|
||||
AND t.level IN (4, 5, 6) -- 仅保留4、5、6级
|
||||
) AS temp
|
||||
-- 外层WHERE筛选:4级且子级数量≠0,5、6级正常显示(可根据需求调整)
|
||||
WHERE
|
||||
(temp.level = 4 AND temp.child_count != 0)
|
||||
WHERE (temp.level = 4 AND temp.child_count != 0)
|
||||
OR temp.level IN (5, 6); -- 保留5、6级(若不需要可删除此条件)
|
||||
</select>
|
||||
<select id="getSecondToFifthLevelTypes" resultType="java.util.Map">
|
||||
|
|
@ -648,7 +651,7 @@
|
|||
</if>
|
||||
|
||||
<if test="entryStatus != null and entryStatus != ''">
|
||||
and mdi.entry_status = #{entryStatus}
|
||||
and mdi.entry_status = #{entryStatus}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -84,21 +84,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN (SELECT max( next_check_time) next_check_time,ma_id from ma_dev_qc GROUP BY ma_id ) mdq on
|
||||
m2.ma_id=mdq.ma_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
ma_id,
|
||||
qc_time
|
||||
FROM (
|
||||
-- 内层:按ma_id分组,给next_check_time降序排名
|
||||
SELECT
|
||||
ma_id,
|
||||
qc_time,
|
||||
ROW_NUMBER() OVER (PARTITION BY ma_id ORDER BY qc_time DESC) AS rn
|
||||
SELECT ma_id , MAX(qc_time) AS qc_time
|
||||
FROM ma_dev_qc
|
||||
-- 过滤掉next_check_time为NULL的记录(可选,根据业务需求)
|
||||
WHERE qc_time IS NOT NULL
|
||||
) t
|
||||
-- 筛选排名为2的记录(第二大)
|
||||
WHERE t.rn = 2
|
||||
WHERE qc_time < (
|
||||
SELECT MAX(qc_time) FROM ma_dev_qc)
|
||||
) mdq1 ON m2.ma_id = mdq1.ma_id
|
||||
<where>
|
||||
m2.is_active = '1' and m2.entry_status = '1' AND m2.ma_status != '99'
|
||||
|
|
@ -131,11 +120,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</when>
|
||||
<!-- 筛选“一月内到期” -->
|
||||
<when test="alert == '一月内到期'">
|
||||
and (mdq.next_check_time >= CURRENT_DATE() and mdq.next_check_time <= DATE_ADD(CURRENT_DATE(), INTERVAL 1 MONTH))
|
||||
and (mdq.next_check_time >= CURRENT_DATE() and mdq.next_check_time <=
|
||||
DATE_ADD(CURRENT_DATE(), INTERVAL 1 MONTH))
|
||||
</when>
|
||||
<!-- 筛选“正常” -->
|
||||
<when test="alert == '正常'">
|
||||
and (mdq.next_check_time > DATE_ADD(CURRENT_DATE(), INTERVAL 1 MONTH) or mdq.next_check_time is null)
|
||||
and (mdq.next_check_time > DATE_ADD(CURRENT_DATE(), INTERVAL 1 MONTH) or mdq.next_check_time
|
||||
is null)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -252,9 +252,10 @@
|
|||
-- 自用申请数量(类型2:自用申请)
|
||||
IFNULL(SUM(CASE WHEN cdc.type = '2' THEN cdcd.num ELSE 0 END),0) AS selfUseApplyNum,
|
||||
-- 自用出库数量(类型2的实际出库数)
|
||||
IFNULL(SUM(CASE WHEN cdc.type = '2' THEN cdcd.real_num ELSE 0 END),0) AS selfUseOutNum,
|
||||
IFNULL(SUM(CASE WHEN cdc.type = '2' AND cdcd.dev_type ='1' THEN cdcd.real_num ELSE 0 END),0) AS selfUseOutNum,
|
||||
-- 自用审核数量(类型2+审核通过状态2的申请数)
|
||||
IFNULL(SUM(CASE WHEN cdc.review_status = 2 AND cdc.type = '2' THEN cdcd.num ELSE 0 END),0) AS selfUseAuditNum,
|
||||
IFNULL(SUM(CASE WHEN cdc.review_status = 2 AND cdc.type = '2' AND cdcd.dev_type ='2' THEN cdcd.real_num ELSE 0
|
||||
END),0) AS selfUseAuditNum,
|
||||
-- 退库审核数量(类型1+审核通过状态2的申请数)
|
||||
IFNULL(SUM(CASE WHEN cdc.review_status = 2 AND cdc.type = '1' THEN cdcd.num ELSE 0 END),0) AS
|
||||
returnAuditApplyNum,
|
||||
|
|
@ -267,10 +268,10 @@
|
|||
-- 类型4:待维修数量(未审核通过/审核中 + 申请数)
|
||||
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdc.review_status != 2 THEN cdcd.num ELSE 0 END),0) AS repairPendingNum,
|
||||
-- 类型4:维修退役数量(审核通过 + 实际退役数)
|
||||
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdc.review_status = 2 THEN cdcd.real_num ELSE 0 END),0) AS
|
||||
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdcd.is_scrap = '1' THEN cdcd.real_num ELSE 0 END),0) AS
|
||||
repairRetireNum,
|
||||
-- 类型4:维修合格数量(审核通过 + 申请数-实际退役数,即可入库/复用数量)
|
||||
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdc.review_status = 2 THEN (cdcd.num - cdcd.real_num) ELSE 0 END),0) AS
|
||||
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdcd.is_scrap = '0' THEN (cdcd.real_num) ELSE 0 END),0) AS
|
||||
repairQualifiedNum
|
||||
FROM
|
||||
cs_device_change cdc
|
||||
|
|
@ -327,39 +328,42 @@
|
|||
</choose>
|
||||
</select>
|
||||
<select id="getShare" resultType="java.util.Map">
|
||||
SELECT COUNT(1) AS buyerNum,
|
||||
SUM(IF(devType = '0', real_num, 0)) AS sellerNum,
|
||||
SUM(IF(devType = '1', real_num, 0)) AS toolNum
|
||||
FROM(
|
||||
SELECT
|
||||
-- 1. 出售方订单数:companyId为空时统计所有,否则统计指定公司
|
||||
SUM(CASE
|
||||
WHEN #{companyId} IS NULL OR #{companyId} = '' THEN 1
|
||||
WHEN a.sellerDeptId = #{companyId} THEN 1
|
||||
ELSE 0
|
||||
END) AS sellerNum,
|
||||
-- 2. 购买方订单数:companyId为空时统计所有,否则统计指定公司
|
||||
SUM(CASE
|
||||
WHEN #{companyId} IS NULL OR #{companyId} = '' THEN 1
|
||||
WHEN a.buyerCompanyName = #{companyId} THEN 1
|
||||
ELSE 0
|
||||
END) AS buyerNum,
|
||||
-- 3. 出售设备总数:companyId为空时统计所有,否则统计指定公司的设备数
|
||||
SUM(CASE
|
||||
WHEN #{companyId} IS NULL OR #{companyId} = '' THEN a.equipmentTotalNum
|
||||
WHEN a.sellerDeptId = #{companyId} THEN a.equipmentTotalNum
|
||||
ELSE 0
|
||||
END) AS toolNum
|
||||
FROM (
|
||||
-- 内层查询:按订单维度统计出售方、购买方、设备总数(原逻辑不变)
|
||||
SELECT up.dept_id AS sellerDeptId,
|
||||
moi.buyer_company AS buyerCompanyName,
|
||||
SUM(hh.num) AS equipmentTotalNum
|
||||
FROM ma_order_details hh
|
||||
LEFT JOIN ma_order_info moi ON moi.order_id = hh.order_id
|
||||
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
|
||||
LEFT JOIN sys_dept up ON up.dept_id = mdi.on_company
|
||||
|
||||
WHERE DATE_FORMAT(moi.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
|
||||
GROUP BY hh.order_id,
|
||||
up.dept_id,
|
||||
moi.buyer_company) a
|
||||
CASE
|
||||
WHEN hh.devType = '0' THEN up.dept_id
|
||||
WHEN hh.devType = '1' THEN up1.dept_id
|
||||
ELSE NULL
|
||||
END AS dept_id,
|
||||
hh.real_num,
|
||||
hh.devType
|
||||
FROM
|
||||
ma_order_details hh
|
||||
-- 左连接mdi(仅devType=0时生效)
|
||||
LEFT JOIN ma_dev_info mdi
|
||||
ON hh.ma_id = mdi.ma_id
|
||||
AND hh.devType = '0'
|
||||
-- 左连接tl(仅devType=1时生效)
|
||||
LEFT JOIN tool_ledger tl
|
||||
ON tl.id = hh.ma_id
|
||||
AND hh.devType = '1'
|
||||
-- 关联mdi对应的部门表
|
||||
LEFT JOIN sys_dept up
|
||||
ON up.dept_id = mdi.on_company
|
||||
-- 关联tl对应的部门表
|
||||
LEFT JOIN sys_dept up1
|
||||
ON up1.dept_id = tl.company_id
|
||||
-- 可选:过滤无效devType(如果需要)
|
||||
WHERE hh.devType IN ('0', '1')
|
||||
) a
|
||||
<where>
|
||||
<if test="companyId != null">
|
||||
and dept_id = #{companyId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getDeviceByDeptEX" resultType="com.bonus.material.index.domain.CompanyDevToolStatisticsExport">
|
||||
SELECT sd.dept_abbreviation AS companyName, -- 公司名称
|
||||
|
|
|
|||
|
|
@ -489,6 +489,7 @@
|
|||
|
||||
<select id="getDevInfoById" resultType="com.bonus.material.lease.domain.MaLeaseInfo">
|
||||
SELECT mli.*,
|
||||
sd.dept_id AS publishCompany,
|
||||
sd.dept_name as publishCompanyName,
|
||||
sd2.dept_name as orderCompanyName
|
||||
FROM ma_lease_info mli
|
||||
|
|
|
|||
|
|
@ -579,4 +579,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where sd2.dept_name is not null
|
||||
order by moi.buyer_company
|
||||
</select>
|
||||
<select id="getCategoryList" resultType="java.util.Map">
|
||||
SELECT DISTINCT
|
||||
t.equipmentName,
|
||||
t.devType,
|
||||
-- 新增:高亮标记后的名称(关键字用{{}}包裹)
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
REPLACE(t.equipmentName, #{keyWord}, CONCAT('{{', #{keyWord}, '}}')) AS highlightEquipmentName
|
||||
</if>
|
||||
<if test="keyWord == null or keyWord == ''">
|
||||
t.equipmentName AS highlightEquipmentName
|
||||
</if>
|
||||
FROM (
|
||||
-- 原SQL的第一部分:设备(5/6级节点)
|
||||
SELECT
|
||||
CASE
|
||||
WHEN mtv.actual_level = 5 THEN CONCAT_WS('>', mtv.proType, mtv.mainGx, mtv.childGx,mtv.devCategory,mtv.devSubcategory)
|
||||
WHEN mtv.actual_level = 6 THEN CONCAT_WS('>', mtv.proType, mtv.mainGx, mtv.childGx, mtv.devCategory,mtv.devSubcategory,mtv.devName)
|
||||
ELSE CONCAT_WS('>', mtv.proType, mtv.mainGx, mtv.childGx,mtv.devCategory,mtv.devSubcategory)
|
||||
END AS equipmentName,
|
||||
'施工装备' as devType
|
||||
FROM ma_type_view mtv
|
||||
UNION ALL
|
||||
-- 原SQL的第二部分:工具(4级节点)
|
||||
SELECT
|
||||
CONCAT_WS('>', tt4.type_name,tt3.type_name, tt2.type_name, tt1.type_name) AS equipmentName,
|
||||
if(tt.manage_type =0,'编码工具','数量工具') as devType
|
||||
FROM tool_type tt
|
||||
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
LEFT JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
LEFT JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
WHERE tt.LEVEL = 5
|
||||
AND tt.del_flag ='0'
|
||||
AND tt1.del_flag ='0'
|
||||
AND tt2.del_flag ='0'
|
||||
AND tt3.del_flag ='0'
|
||||
AND tt4.del_flag ='0'
|
||||
) t
|
||||
<where>
|
||||
<!-- 筛选equipmentName:模糊查询 -->
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND t.equipmentName LIKE CONCAT('%', #{keyWord}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -127,8 +127,8 @@
|
|||
<update id="updateRepairTask">
|
||||
update cs_device_change
|
||||
set
|
||||
review_status = #{status},
|
||||
update_time = NOW()
|
||||
review_status = #{status},
|
||||
update_time = NOW()
|
||||
where id = #{changeId}
|
||||
</update>
|
||||
|
||||
|
|
@ -263,21 +263,21 @@
|
|||
</select>
|
||||
<select id="getRepairList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
||||
SELECT cdc.id,
|
||||
cdc.`code`,
|
||||
SUM(CASE cdcd.dev_type
|
||||
WHEN 1 THEN cdcd.num
|
||||
ELSE 0
|
||||
END) as equipmentNum,
|
||||
SUM(CASE cdcd.dev_type
|
||||
WHEN 2 THEN cdcd.num
|
||||
ELSE 0
|
||||
END) as toolNum,
|
||||
cdc.create_user as createUser,
|
||||
cdc.create_time as createTime,
|
||||
cdc.review_status as status,
|
||||
cdc.company_id as companyId
|
||||
cdc.`code`,
|
||||
SUM(CASE cdcd.dev_type
|
||||
WHEN 1 THEN cdcd.num
|
||||
ELSE 0
|
||||
END) as equipmentNum,
|
||||
SUM(CASE cdcd.dev_type
|
||||
WHEN 2 THEN cdcd.num
|
||||
ELSE 0
|
||||
END) as toolNum,
|
||||
cdc.create_user as createUser,
|
||||
cdc.create_time as createTime,
|
||||
cdc.review_status as status,
|
||||
cdc.company_id as companyId
|
||||
FROM cs_device_change cdc
|
||||
LEFT JOIN cs_device_change_details cdcd ON cdcd.change_id = cdc.id
|
||||
LEFT JOIN cs_device_change_details cdcd ON cdcd.change_id = cdc.id
|
||||
WHERE cdc.type = '4'
|
||||
and cdc.del_flag = '0'
|
||||
and cdcd.del_flag = '0'
|
||||
|
|
@ -306,7 +306,7 @@
|
|||
tt5.type_name as typeModelName,
|
||||
cdcd.dev_type_id as typeId,
|
||||
CASE
|
||||
WHEN cdcd.dev_code is null or cdcd.dev_code = '/' THEN
|
||||
WHEN cdcd.dev_code is null THEN
|
||||
'数量管理'
|
||||
ELSE
|
||||
'编码管理'
|
||||
|
|
@ -360,7 +360,7 @@
|
|||
mdi.item_type_model as typeModelName,
|
||||
cdcd.dev_type_id as typeId,
|
||||
CASE
|
||||
WHEN cdcd.dev_code is null THEN
|
||||
WHEN cdcd.dev_code is null THEN
|
||||
'数量管理'
|
||||
ELSE
|
||||
'编码管理'
|
||||
|
|
@ -423,8 +423,7 @@
|
|||
tool_ledger tl
|
||||
WHERE
|
||||
tl.type_id=#{typeId}
|
||||
and tl.status='2'
|
||||
<if test="code != null and code!="/"">
|
||||
<if test="code != null and code!=''">
|
||||
and tl.tool_code=#{code}
|
||||
</if>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@
|
|||
repair_url
|
||||
ELSE
|
||||
reason_url
|
||||
END url,
|
||||
END scrapUrl,
|
||||
tl.available_num as inStockNum
|
||||
|
||||
FROM cs_device_change_details cdcd
|
||||
|
|
|
|||
|
|
@ -59,6 +59,14 @@
|
|||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
<select id="getNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1)
|
||||
FROM ma_supplier
|
||||
WHERE supplier_code = #{supplierCode}
|
||||
<if test="supplierId != null and supplierId != ''">
|
||||
and supplier_id not in (#{supplierId})
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="supplierId">
|
||||
insert into ma_supplier (
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
<if test="typeName != null and typeName != ''">
|
||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
GROUP BY tl.type_id
|
||||
GROUP BY tl.type_id,tl.company_id
|
||||
ORDER BY
|
||||
tl.create_time DESC
|
||||
</select>
|
||||
|
|
@ -136,6 +136,7 @@
|
|||
update_time AS updateTime
|
||||
from tool_ledger
|
||||
WHERE type_id = #{typeId}
|
||||
AND company_id = #{companyId}
|
||||
</select>
|
||||
<select id="getCode" resultType="java.lang.String">
|
||||
SELECT CONCAT(
|
||||
|
|
|
|||
|
|
@ -75,6 +75,16 @@
|
|||
and status = '1'
|
||||
and del_flag = '0'
|
||||
</update>
|
||||
<update id="deleteTool">
|
||||
UPDATE tool_apply_details
|
||||
set del_flag = '1'
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<update id="updateByToolId">
|
||||
UPDATE tool_apply_details
|
||||
set tool_id = #{toolId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 1. 查询 updateDetail 要修改的 ID -->
|
||||
<select id="selectDetailIdsByCondition" resultType="java.lang.Long">
|
||||
|
|
@ -148,8 +158,12 @@
|
|||
SUM(tad.apply_num) AS applyNum,
|
||||
tt.level AS level,
|
||||
tad.id AS id,
|
||||
tt.unit_name AS unitName,
|
||||
tad.status AS status,
|
||||
tad.tool_price as toolPrice,
|
||||
tad.supplier_id AS supplierId,
|
||||
tad.tool_price as originCost,
|
||||
tad.identify_code AS identifyCode,
|
||||
tad.production_date AS productionDate,
|
||||
tt1.type_name AS parentTypeName, -- 1级父节点名称
|
||||
tt2.type_name AS grandparentTypeName, -- 2级父节点名称
|
||||
tt3.type_name AS greatGrandparentName, -- 3级父节点名称
|
||||
|
|
@ -230,7 +244,7 @@
|
|||
tad.status AS status,
|
||||
tad.identify_code AS identifyCode,
|
||||
ms.supplier_name AS supplierName,
|
||||
tad.tool_price AS toolPrice,
|
||||
tad.tool_price AS originCost,
|
||||
tad.production_date AS productionDate,
|
||||
tt1.type_name AS parentTypeName, -- 1级父节点名称
|
||||
tt2.type_name AS grandparentTypeName, -- 2级父节点名称
|
||||
|
|
@ -275,7 +289,7 @@
|
|||
tad.identify_code AS identifyCode,
|
||||
tad.supplier_id AS supplierId,
|
||||
tad.apply_num AS applyNum,
|
||||
tad.tool_price AS toolPrice,
|
||||
tad.tool_price AS originCost,
|
||||
tad.production_date AS productionDate
|
||||
FROM tool_apply_details tad
|
||||
INNER JOIN tool_type tt
|
||||
|
|
@ -294,4 +308,50 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="listWarehousingToolByApplyId"
|
||||
resultType="com.bonus.material.toolProcess.domain.ToolApplyDetailsEntity">
|
||||
SELECT tt.type_id AS typeId,
|
||||
tt.type_name AS typeName,
|
||||
tt.manage_type AS manageType,
|
||||
tad.apply_num AS applyNum,
|
||||
tt.level AS level,
|
||||
tad.id AS id,
|
||||
tt.unit_name AS unitName,
|
||||
tad.status AS status,
|
||||
tad.supplier_id AS supplierId,
|
||||
tad.tool_price as originCost,
|
||||
tad.identify_code AS identifyCode,
|
||||
tad.production_date AS productionDate,
|
||||
tt1.type_name AS parentTypeName, -- 1级父节点名称
|
||||
tt2.type_name AS grandparentTypeName, -- 2级父节点名称
|
||||
tt3.type_name AS greatGrandparentName, -- 3级父节点名称
|
||||
tt4.type_name AS fourthParentName -- 4级父节点名称
|
||||
FROM tool_apply_details tad
|
||||
LEFT JOIN tool_type tt ON tad.type_id = tt.type_id
|
||||
-- 关联1级父节点(直接父节点)
|
||||
INNER JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
-- 关联2级父节点(祖父节点)
|
||||
INNER JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
-- 关联3级父节点(曾祖父节点)
|
||||
INNER JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
-- 关联4级父节点
|
||||
INNER JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
WHERE tad.del_flag = '0'
|
||||
AND tt.del_flag = '0'
|
||||
AND tt1.del_flag = '0'
|
||||
AND tt2.del_flag = '0'
|
||||
AND tt3.del_flag = '0'
|
||||
AND tt4.del_flag = '0'
|
||||
AND tad.apply_id = #{applyId}
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
<if test="parentTypeName != null and parentTypeName != ''">
|
||||
AND tt1.type_name LIKE CONCAT('%', #{parentTypeName}, '%')
|
||||
</if>
|
||||
<if test="manageType != null and manageType != ''">
|
||||
AND tt.manage_type = #{manageType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -198,8 +198,9 @@
|
|||
<if test="subProcess != null and subProcess != ''">
|
||||
and mtv.childGx like concat('%', #{subProcess}, '%')
|
||||
</if>
|
||||
|
||||
|
||||
<if test="companyId != null and companyId != ''">
|
||||
and mdi.on_company = #{companyId}
|
||||
</if>
|
||||
|
||||
|
||||
</where>
|
||||
|
|
@ -291,6 +292,9 @@
|
|||
<if test="status != null and status != ''">
|
||||
AND mdi.change_status=#{status}
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
and mdi.on_company = #{companyId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
AND tt2.del_flag = '0'
|
||||
AND tt3.del_flag = '0'
|
||||
AND tt4.del_flag = '0'
|
||||
and tl.id is not null
|
||||
and tl.id is not null
|
||||
<if test="fourthParentName != null and fourthParentName != ''">
|
||||
AND tt4.type_name LIKE CONCAT('%', #{fourthParentName}, '%')
|
||||
</if>
|
||||
|
|
@ -88,6 +88,10 @@
|
|||
<if test="typeName != null and typeName != ''">
|
||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND tl.company_id = #{companyId}
|
||||
</if>
|
||||
|
||||
GROUP BY tl.id
|
||||
ORDER BY
|
||||
tl.create_time DESC
|
||||
|
|
@ -146,6 +150,9 @@
|
|||
<if test="typeName != null and typeName != ''">
|
||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND tl.company_id = #{companyId}
|
||||
</if>
|
||||
GROUP BY tl.id
|
||||
ORDER BY
|
||||
tl.create_time DESC
|
||||
|
|
@ -215,6 +222,9 @@
|
|||
<if test="toolCode != null and toolCode != ''">
|
||||
AND tl.tool_code LIKE CONCAT('%', #{toolCode}, '%')
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND tl.company_id = #{companyId}
|
||||
</if>
|
||||
GROUP BY tl.id
|
||||
ORDER BY
|
||||
tl.create_time DESC
|
||||
|
|
|
|||
|
|
@ -10,8 +10,20 @@
|
|||
<insert id="insert" parameterType="com.bonus.material.warehousing.domain.WarehousingEntity" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
INSERT INTO bm_warehousing (code, order_id, apply_id,
|
||||
status, create_user)
|
||||
VALUES (#{code}, #{orderId}, #{applyId}, #{status}, #{createUser})
|
||||
create_user, user_id)
|
||||
VALUES (CONCAT(
|
||||
DATE_FORMAT(NOW(), '%Y%m%d'), -- 日期前缀:yyyyMMdd
|
||||
'-', -- 添加分隔符
|
||||
LPAD(
|
||||
-- 外层子查询规避 MySQL 表引用限制
|
||||
(SELECT inner_count + 1
|
||||
FROM (SELECT COUNT(*) AS inner_count
|
||||
FROM bm_warehousing
|
||||
WHERE DATE(create_time) = CURDATE()
|
||||
AND is_deleted = '0') AS temp_table),
|
||||
4, '0' -- 序号补0到3位(可调整为4位:LPAD(...,4,'0'))
|
||||
)
|
||||
), #{orderId}, #{applyId}, #{createUser}, #{userId})
|
||||
</insert>
|
||||
|
||||
<!-- 逻辑删除 -->
|
||||
|
|
@ -26,66 +38,184 @@
|
|||
UPDATE bm_warehousing
|
||||
<set>
|
||||
<if test="code != null">code = #{code},</if>
|
||||
<if test="equipmentOrderId != null">order_id = #{orderId},</if>
|
||||
<if test="quantityToolOrderId != null">apply_id = #{applyId},</if>
|
||||
<if test="orderId != null">order_id = #{orderId},</if>
|
||||
<if test="applyId != null">apply_id = #{applyId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createUser != null">create_user = #{createUser},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="approvalUser != null">approval_user = #{approvalUser},</if>
|
||||
<if test="approvalTime != null">approval_time = #{approvalTime},</if>
|
||||
<if test="isDeleted != null">is_deleted = #{isDeleted},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<update id="batchSubmission">
|
||||
update bm_warehousing
|
||||
set status ='1'
|
||||
WHERE status in ('0','3') and id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="batchRejection">
|
||||
update bm_warehousing
|
||||
set status ='3'
|
||||
WHERE status ='1' and id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="batchApproval">
|
||||
update bm_warehousing
|
||||
set status ='2',
|
||||
approval_time = now(),
|
||||
approval_user = #{nickName}
|
||||
WHERE status ='1' and id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 -->
|
||||
<select id="selectById" parameterType="Integer"
|
||||
resultType="com.bonus.material.warehousing.domain.WarehousingEntity">
|
||||
SELECT id,
|
||||
code,
|
||||
order_id,
|
||||
apply_id,
|
||||
status,
|
||||
create_user,
|
||||
create_time,
|
||||
approval_user,
|
||||
approval_time,
|
||||
is_deleted
|
||||
FROM bm_warehousing
|
||||
SELECT bw.id AS id,
|
||||
bw.code AS code,
|
||||
bw.order_id AS orderId,
|
||||
bw.apply_id AS applyId,
|
||||
bw.status AS status,
|
||||
bw.create_user AS createUser,
|
||||
-- 空值处理:避免create_time为空时DATE_FORMAT返回NULL
|
||||
DATE_FORMAT(IFNULL(bw.create_time, '1970-01-01 00:00:00'), '%Y-%m-%d %H:%i:%s') AS createTime,
|
||||
bw.approval_user AS approvalUser,
|
||||
-- 空值处理:approval_time可能为空,统一格式
|
||||
DATE_FORMAT(IFNULL(bw.approval_time, '1970-01-01 00:00:00'), '%Y-%m-%d %H:%i:%s') AS approvalTime,
|
||||
-- 替换子查询为LEFT JOIN,避免逐行子查询的性能损耗
|
||||
COALESCE(ma_detail.maNum, 0) AS maNum,
|
||||
COALESCE(tool_detail.toolNum, 0) AS toolNum
|
||||
FROM bm_warehousing bw
|
||||
-- 预计算ma_apply_details的计数,关联一次即可
|
||||
LEFT JOIN (SELECT cs_id, COUNT(1) AS maNum
|
||||
FROM ma_apply_details
|
||||
GROUP BY cs_id) ma_detail ON ma_detail.cs_id = bw.order_id
|
||||
-- 预计算tool_apply_details的计数,关联一次即可
|
||||
LEFT JOIN (SELECT apply_id, SUM(apply_num) AS toolNum
|
||||
FROM tool_apply_details
|
||||
WHERE del_flag = '0'
|
||||
GROUP BY apply_id) tool_detail ON tool_detail.apply_id = bw.apply_id
|
||||
WHERE id = #{id}
|
||||
AND is_deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 条件查询列表 -->
|
||||
<select id="selectList" parameterType="com.bonus.material.warehousing.domain.WarehousingEntity" resultType="com.bonus.material.warehousing.domain.WarehousingEntity">
|
||||
<select id="selectList" parameterType="com.bonus.material.warehousing.domain.WarehousingEntity"
|
||||
resultType="com.bonus.material.warehousing.domain.WarehousingEntity">
|
||||
SELECT
|
||||
id AS id,
|
||||
code AS code,
|
||||
order_id AS orderId,
|
||||
apply_id AS applyId,
|
||||
status AS status,
|
||||
create_user AS createUser,
|
||||
create_time AS createTime,
|
||||
approval_user AS approvalUser,
|
||||
approval_time AS approvalTime
|
||||
FROM bm_warehousing
|
||||
bw.id AS id,
|
||||
bw.code AS code,
|
||||
bw.order_id AS orderId,
|
||||
bw.apply_id AS applyId,
|
||||
bw.status AS status,
|
||||
bw.create_user AS createUser,
|
||||
-- 空值处理:避免create_time为空时DATE_FORMAT返回NULL
|
||||
DATE_FORMAT(IFNULL(bw.create_time, '1970-01-01 00:00:00'), '%Y-%m-%d %H:%i:%s') AS createTime,
|
||||
bw.approval_user AS approvalUser,
|
||||
-- 空值处理:approval_time可能为空,统一格式
|
||||
DATE_FORMAT(IFNULL(bw.approval_time, '1970-01-01 00:00:00'), '%Y-%m-%d %H:%i:%s') AS approvalTime,
|
||||
-- 替换子查询为LEFT JOIN,避免逐行子查询的性能损耗
|
||||
COALESCE(ma_detail.maNum, 0) AS maNum,
|
||||
COALESCE(tool_detail.toolNum, 0) AS toolNum
|
||||
FROM bm_warehousing bw
|
||||
LEFT JOIN sys_user su ON su.user_id = bw.user_id
|
||||
-- 预计算ma_apply_details的计数,关联一次即可
|
||||
LEFT JOIN (
|
||||
SELECT cs_id, COUNT(1) AS maNum
|
||||
FROM ma_apply_details
|
||||
GROUP BY cs_id
|
||||
) ma_detail ON ma_detail.cs_id = bw.order_id
|
||||
-- 预计算tool_apply_details的计数,关联一次即可
|
||||
LEFT JOIN (
|
||||
SELECT apply_id, SUM(apply_num) AS toolNum
|
||||
FROM tool_apply_details WHERE del_flag ='0'
|
||||
GROUP BY apply_id
|
||||
) tool_detail ON tool_detail.apply_id = bw.apply_id
|
||||
<where>
|
||||
is_deleted = 0
|
||||
<if test="code != null and code != ''">
|
||||
AND code LIKE CONCAT('%', #{code}, '%')
|
||||
AND bw.code LIKE CONCAT('%', #{code}, '%')
|
||||
</if>
|
||||
<if test="createUser != null and createUser != ''">
|
||||
AND create_user LIKE CONCAT('%', #{code}, '%')
|
||||
AND bw.create_user LIKE CONCAT('%', #{createUser}, '%')
|
||||
</if>
|
||||
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
AND bw.status = #{status}
|
||||
</if>
|
||||
<if test="startCreateTime != null and endCreateTime != null ">
|
||||
and createTime >= #{startCreateTime}
|
||||
and createTime < DATE_ADD(#{endCreateTime}, INTERVAL 1 DAY)
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND su.dept_id = #{companyId}
|
||||
</if>
|
||||
<if test="startTime != null and endTime != null ">
|
||||
and bw.create_time >= #{startTime}
|
||||
and bw.create_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
||||
</if>
|
||||
</where>
|
||||
order by bw.create_time DESC,bw.status
|
||||
</select>
|
||||
<select id="getDevDetails" resultType="com.bonus.material.warehousing.domain.WarehousingRecordEntity">
|
||||
SELECT bw.code AS code,
|
||||
dev.item_type_model AS devModel,
|
||||
dev.device_name AS name,
|
||||
dev.CODE AS devCode,
|
||||
'施工装备' AS devType,
|
||||
CASE
|
||||
WHEN mt.actual_level = 5 THEN CONCAT_WS('>', mt.proType, mt.mainGx, mt.childGx, mt.devCategory)
|
||||
WHEN mt.actual_level = 6 THEN CONCAT_WS('>', mt.proType, mt.mainGx, mt.childGx, mt.devCategory,
|
||||
mt.devSubcategory)
|
||||
ELSE CONCAT_WS('>', mt.proType, mt.mainGx, mt.childGx, mt.devCategory, mt.devSubcategory)
|
||||
END AS category,
|
||||
dev.identify_code AS identifyCode,
|
||||
'1' AS num,
|
||||
bw.create_user AS createUser,
|
||||
-- 空值处理:避免create_time为空时DATE_FORMAT返回NULL
|
||||
DATE_FORMAT(IFNULL(bw.create_time, '1970-01-01 00:00:00'), '%Y-%m-%d %H:%i:%s') AS createTime,
|
||||
bw.approval_user AS approvalUser,
|
||||
-- 空值处理:approval_time可能为空,统一格式
|
||||
DATE_FORMAT(IFNULL(bw.approval_time, '1970-01-01 00:00:00'), '%Y-%m-%d %H:%i:%s') AS approvalTime
|
||||
FROM bm_warehousing bw
|
||||
LEFT JOIN ma_apply_details mad ON mad.cs_id = bw.order_id
|
||||
LEFT JOIN ma_dev_info dev ON mad.dev_id = dev.ma_id
|
||||
INNER JOIN ma_type_view mt ON mt.typeId = dev.type_id
|
||||
WHERE bw.id = #{id}
|
||||
UNION ALL
|
||||
|
||||
SELECT bw.code AS code,
|
||||
tt.type_name AS devModel,
|
||||
tt1.type_name AS name,
|
||||
ifnull(tl.tool_code, '/') AS devCode,
|
||||
if(tt.manage_type = '1', '数量工具', '编码工具') AS devType,
|
||||
CONCAT_WS('>', tt3.type_name, tt2.type_name, tt1.type_name) AS category,
|
||||
ifnull(tl.identify_code, '/') AS identifyCode,
|
||||
dc.apply_num AS num,
|
||||
bw.create_user AS createUser,
|
||||
-- 空值处理:避免create_time为空时DATE_FORMAT返回NULL
|
||||
DATE_FORMAT(IFNULL(bw.create_time, '1970-01-01 00:00:00'), '%Y-%m-%d %H:%i:%s') AS createTime,
|
||||
bw.approval_user AS approvalUser,
|
||||
-- 空值处理:approval_time可能为空,统一格式
|
||||
DATE_FORMAT(IFNULL(bw.approval_time, '1970-01-01 00:00:00'), '%Y-%m-%d %H:%i:%s') AS approvalTime
|
||||
FROM bm_warehousing bw -- 关联工具台账(变更详情的设备编码 = 工具编码)
|
||||
LEFT JOIN tool_apply_details dc on dc.apply_id = bw.apply_id
|
||||
LEFT JOIN tool_ledger tl ON tl.id = dc.tool_id
|
||||
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
||||
LEFT JOIN tool_type tt1 on tt.parent_id = tt1.type_id
|
||||
LEFT JOIN tool_type tt2 on tt1.parent_id = tt2.type_id
|
||||
LEFT JOIN tool_type tt3 on tt2.parent_id = tt3.type_id
|
||||
LEFT JOIN tool_type tt4 on tt3.parent_id = tt4.type_id AND tt.del_flag = '0'
|
||||
WHERE bw.id = #{id}
|
||||
</select>
|
||||
<select id="getMaIds" resultType="java.lang.String">
|
||||
SELECT dev_id AS `key`
|
||||
FROM ma_apply_details
|
||||
where cs_id = #{orderId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue