parent
cda41a7668
commit
2280a35d6b
29 changed files with 791 additions and 12 deletions
@ -0,0 +1,84 @@ |
||||
package org.springblade.modules.business.contraller.supplies; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import jakarta.validation.Valid; |
||||
import lombok.AllArgsConstructor; |
||||
import org.apache.commons.lang3.time.DateFormatUtils; |
||||
import org.springblade.common.cache.DeptCache; |
||||
import org.springblade.common.cache.UserCache; |
||||
import org.springblade.common.utils.LogUtil; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.BladeUser; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.modules.business.pojo.dto.supplies.ApplyDTO; |
||||
import org.springblade.modules.business.pojo.entity.supplies.Apply; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyDetail; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPerson; |
||||
import org.springblade.modules.business.pojo.entity.supplies.Goods; |
||||
import org.springblade.modules.business.pojo.entity.workorder.WorkOrder; |
||||
import org.springblade.modules.business.service.IWorkOrderService; |
||||
import org.springblade.modules.business.service.supplies.IApplyDetailService; |
||||
import org.springblade.modules.business.service.supplies.IApplyGoodsPersonService; |
||||
import org.springblade.modules.business.service.supplies.IApplyService; |
||||
import org.springblade.modules.business.service.supplies.IGoodsService; |
||||
import org.springblade.modules.system.pojo.entity.Dept; |
||||
import org.springblade.modules.system.pojo.entity.User; |
||||
import org.springblade.modules.system.service.IDeptService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* 物品申领表 控制器 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/applyGoodsPerson") |
||||
public class ApplyGoodsPersonController extends BladeController { |
||||
|
||||
private final IApplyGoodsPersonService applyGoodsPersonService; |
||||
private final IGoodsService goodsService; |
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* 物品申领表 分页 |
||||
*/ |
||||
@GetMapping("/list") |
||||
public R<IPage<ApplyGoodsPerson>> list(ApplyGoodsPerson applyGoodsPerson, Query query) { |
||||
LambdaQueryWrapper<ApplyGoodsPerson> wrapper = Wrappers.lambdaQuery(ApplyGoodsPerson.class); |
||||
wrapper.eq(ApplyGoodsPerson::getUserId,applyGoodsPerson.getUserId()); |
||||
IPage<ApplyGoodsPerson> pages = applyGoodsPersonService.page(Condition.getPage(query), wrapper); |
||||
if(CollectionUtil.isNotEmpty(pages.getRecords())){ |
||||
pages.getRecords().forEach(item ->{ |
||||
Goods goods = goodsService.getOne(Wrappers.lambdaQuery(Goods.class).eq(Goods::getInventoryId,item.getProductCode()).eq(BaseEntity::getIsDeleted,0)); |
||||
item.setGoodsId(goods.getId()); |
||||
item.setBrand(goods.getBrand()); |
||||
item.setXh(goods.getXh()); |
||||
item.setUnit(goods.getUnit()); |
||||
item.setRule(goods.getRule()); |
||||
item.setRemark(goods.getRemark()); |
||||
}); |
||||
} |
||||
return R.data(pages); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,68 @@ |
||||
package org.springblade.modules.business.contraller.supplies; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.common.cache.SysCache; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTask; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPerson; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPersonDetail; |
||||
import org.springblade.modules.business.pojo.entity.workorder.WorkOrder; |
||||
import org.springblade.modules.business.service.IMaintenanceTaskService; |
||||
import org.springblade.modules.business.service.IWorkOrderService; |
||||
import org.springblade.modules.business.service.supplies.IApplyGoodsPersonDetailService; |
||||
import org.springblade.modules.business.service.supplies.IApplyGoodsPersonService; |
||||
import org.springblade.modules.system.pojo.entity.Dept; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* 物品申领表 控制器 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/applyGoodsPersonDetail") |
||||
public class ApplyGoodsPersonDetailController extends BladeController { |
||||
|
||||
private final IApplyGoodsPersonDetailService applyGoodsPersonDetailService; |
||||
private final IWorkOrderService workOrderService; |
||||
private final IMaintenanceTaskService maintenanceTaskService; |
||||
|
||||
|
||||
/** |
||||
* 物品申领表 分页 |
||||
*/ |
||||
@GetMapping("/list") |
||||
public R<IPage<ApplyGoodsPersonDetail>> list(ApplyGoodsPersonDetail applyGoodsPersonDetail, Query query) { |
||||
LambdaQueryWrapper<ApplyGoodsPersonDetail> wrapper = Wrappers.lambdaQuery(ApplyGoodsPersonDetail.class); |
||||
wrapper.eq(ApplyGoodsPersonDetail::getProductCode,applyGoodsPersonDetail.getProductCode()); |
||||
IPage<ApplyGoodsPersonDetail> pages = applyGoodsPersonDetailService.page(Condition.getPage(query), wrapper); |
||||
if(CollectionUtil.isNotEmpty(pages.getRecords())){ |
||||
pages.getRecords().forEach(item ->{ |
||||
if("1".equals(item.getType())){ |
||||
WorkOrder workorder = workOrderService.getOne(Wrappers.lambdaQuery(WorkOrder.class).eq(BaseEntity::getId,item.getOrderId()).eq(BaseEntity::getIsDeleted,0)); |
||||
item.setRequirementCode(workorder.getRequirementCode()); |
||||
item.setRequirementUnit(SysCache.getDeptName(Long.parseLong(workorder.getReportUnit()))); |
||||
}else{ |
||||
MaintenanceTask task = maintenanceTaskService.getOne(Wrappers.lambdaQuery(MaintenanceTask.class).eq(BaseEntity::getId,item.getOrderId()).eq(BaseEntity::getIsDeleted,0)); |
||||
item.setRequirementCode(task.getTaskCode()); |
||||
item.setRequirementUnit(task.getDeptName()); |
||||
} |
||||
|
||||
}); |
||||
} |
||||
return R.data(pages); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package org.springblade.modules.business.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPerson; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPersonDetail; |
||||
|
||||
/** |
||||
* 物品申领表明细 Mapper 接口 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
public interface ApplyGoodsPersonDetailMapper extends BaseMapper<ApplyGoodsPersonDetail> { |
||||
|
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.springblade.modules.business.mapper.ApplyGoodsPersonDetailMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="applyGoodsPersonDetailResultMap" type="org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPersonDetail"> |
||||
<result column="id" property="id"/> |
||||
<result column="order_id" property="orderId"/> |
||||
<result column="type" property="type"/> |
||||
<result column="user_id" property="userId"/> |
||||
<result column="user_name" property="userName"/> |
||||
<result column="product_code" property="productCode"/> |
||||
<result column="product_name" property="productName"/> |
||||
<result column="num" property="num"/> |
||||
<result column="status" property="status"/> |
||||
<result column="create_user" property="createUser"/> |
||||
<result column="create_time" property="createTime"/> |
||||
<result column="update_time" property="updateTime"/> |
||||
<result column="create_dept" property="createDept"/> |
||||
<result column="update_user" property="updateUser"/> |
||||
<result column="is_deleted" property="isDeleted"/> |
||||
</resultMap> |
||||
|
||||
|
||||
|
||||
</mapper> |
||||
@ -0,0 +1,32 @@ |
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package org.springblade.modules.business.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPerson; |
||||
|
||||
/** |
||||
* 物品申领表明细 Mapper 接口 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
public interface ApplyGoodsPersonMapper extends BaseMapper<ApplyGoodsPerson> { |
||||
|
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.springblade.modules.business.mapper.ApplyGoodsPersonMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="applyGoodsPersonResultMap" type="org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPerson"> |
||||
<result column="id" property="id"/> |
||||
<result column="user_id" property="userId"/> |
||||
<result column="user_name" property="userName"/> |
||||
<result column="product_code" property="productCode"/> |
||||
<result column="product_name" property="productName"/> |
||||
<result column="num" property="num"/> |
||||
<result column="status" property="status"/> |
||||
<result column="create_user" property="createUser"/> |
||||
<result column="create_time" property="createTime"/> |
||||
<result column="update_time" property="updateTime"/> |
||||
<result column="create_dept" property="createDept"/> |
||||
<result column="update_user" property="updateUser"/> |
||||
<result column="is_deleted" property="isDeleted"/> |
||||
</resultMap> |
||||
|
||||
|
||||
|
||||
</mapper> |
||||
@ -0,0 +1,83 @@ |
||||
package org.springblade.modules.business.pojo.entity.supplies; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 物品申领表明细 实体类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
@Data |
||||
@TableName("lab_apply_goods_person") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class ApplyGoodsPerson extends BaseEntity { |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
private Long userId; |
||||
/** |
||||
* |
||||
*/ |
||||
private String userName; |
||||
/** |
||||
* |
||||
*/ |
||||
private String productCode; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
private String productName; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
private Integer num; |
||||
|
||||
|
||||
/** |
||||
* 单位 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String unit; |
||||
|
||||
/** |
||||
* 物品型号 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String xh; |
||||
|
||||
/** |
||||
* 品牌 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String brand; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String remark; |
||||
|
||||
/** |
||||
* 物品规格 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String rule; |
||||
|
||||
/** |
||||
* 物品规格 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private long goodsId; |
||||
} |
||||
@ -0,0 +1,65 @@ |
||||
package org.springblade.modules.business.pojo.entity.supplies; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
/** |
||||
* 物品申领表明细 实体类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
@Data |
||||
@TableName("lab_apply_goods_person_detail") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class ApplyGoodsPersonDetail extends BaseEntity { |
||||
/** |
||||
* |
||||
*/ |
||||
private Long orderId; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
private String type; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
private Long userId; |
||||
/** |
||||
* |
||||
*/ |
||||
private String userName; |
||||
/** |
||||
* |
||||
*/ |
||||
private String productCode; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
private String productName; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
private Integer num; |
||||
|
||||
|
||||
/** |
||||
* 需求单号 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String requirementCode; |
||||
|
||||
/** |
||||
* 提报单位 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String requirementUnit; |
||||
|
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
package org.springblade.modules.business.service.impl.supplies; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.modules.business.mapper.ApplyGoodsPersonDetailMapper; |
||||
import org.springblade.modules.business.mapper.ApplyGoodsPersonMapper; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPerson; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPersonDetail; |
||||
import org.springblade.modules.business.service.supplies.IApplyGoodsPersonDetailService; |
||||
import org.springblade.modules.business.service.supplies.IApplyGoodsPersonService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* 物品申领表明细 服务实现类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class ApplyGoodsPersonDetailServiceImpl extends BaseServiceImpl<ApplyGoodsPersonDetailMapper, ApplyGoodsPersonDetail> implements IApplyGoodsPersonDetailService { |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
package org.springblade.modules.business.service.impl.supplies; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.modules.business.mapper.ApplyGoodsPersonMapper; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPerson; |
||||
import org.springblade.modules.business.service.supplies.IApplyGoodsPersonService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* 物品申领表明细 服务实现类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class ApplyGoodsPersonServiceImpl extends BaseServiceImpl<ApplyGoodsPersonMapper, ApplyGoodsPerson> implements IApplyGoodsPersonService { |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
package org.springblade.modules.business.service.supplies; |
||||
|
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPersonDetail; |
||||
|
||||
/** |
||||
* 维修人员物品表 服务类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
public interface IApplyGoodsPersonDetailService extends BaseService<ApplyGoodsPersonDetail> { |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
package org.springblade.modules.business.service.supplies; |
||||
|
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.modules.business.pojo.entity.supplies.ApplyGoodsPerson; |
||||
|
||||
/** |
||||
* 维修人员物品表 服务类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2024-10-17 |
||||
*/ |
||||
public interface IApplyGoodsPersonService extends BaseService<ApplyGoodsPerson> { |
||||
|
||||
|
||||
} |
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue