标准配置,领用申请

This commit is contained in:
hayu 2025-02-15 17:02:41 +08:00
parent eacf57e3ef
commit 0816be447e
18 changed files with 278 additions and 46 deletions

View File

@ -237,4 +237,17 @@ public class LeaseApplyInfo extends BaseEntity{
*/
@ApiModelProperty(value = "分包商单位委托书")
List<BmFileInfo> bmFileInfos;
/**
* 标准配置id
*/
@ApiModelProperty(value = "标准配置id")
private Long configId;
/**
* 是否为领用申请
*/
@ApiModelProperty(value = "是否为领用申请")
private Integer isLease;
}

View File

@ -9,7 +9,8 @@ import lombok.Getter;
*/
@Getter
public enum LeaseTaskStatusEnum {
//0-领用申请任务待审核其余为领料申请流程状态
LEASE_TASK_ZERO(0, "待审核"),
LEASE_TASK_TO_PUBLISHED(1, "待发布"),
LEASE_TASK_TO_AUDIT(2, "待审核"),
LEASE_TASK_IN_PROGRESS(3, "出库进行中"),

View File

@ -19,7 +19,8 @@ public enum TmTaskTypeEnum {
TM_TASK_REPAIR_INPUT(11, "修饰后入库任务"),
TM_TASK_PART_LEASE(12, "配件领料任务"),
TM_TASK_PART_TYPE(13, "配件新购"),
TM_TASK_REPAIR_NUM(14, "数量维修人员信息附件");
TM_TASK_REPAIR_NUM(14, "数量维修人员信息附件"),
TM_TASK_LEASE_INPUT(15, "领用任务");
private final Integer taskTypeId;
private final String taskTypeName;

View File

@ -264,4 +264,19 @@ public class LeaseApplyInfoController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(leaseApplyInfoService.deleteLeaseApplyInfoByIds(ids));
}
/**
* 领用任务批量审核
*/
@ApiOperation(value = "领用任务批量审核")
@PreventRepeatSubmit
@SysLog(title = "领用任务批量审核", businessType = OperaType.UPDATE, logType = 1,module = "领用审核->领用任务批量审核")
@PostMapping("/useExamine")
public AjaxResult useExamine(@RequestBody @NotNull(message = "任务信息不能为空") List<LeaseApplyInfo> leaseApplyInfos) {
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfos) {
leaseApplyInfoService.useExamine(leaseApplyInfo);
}
return success("审核完成");
}
}

View File

@ -135,4 +135,11 @@ public interface ILeaseApplyInfoService {
* @return
*/
AjaxResult leaseOutBack(LeaseOutDetails leaseOutDetails);
/**
* 领用任务批量审核
* @param leaseApplyInfo
* @return
*/
AjaxResult useExamine(LeaseApplyInfo leaseApplyInfo);
}

View File

@ -184,18 +184,26 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Override
public AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) {
if (null == leaseApplyRequestVo.getLeaseApplyInfo()) {
return AjaxResult.error("请先填写领料任务信息");
return AjaxResult.error("请先填写任务信息");
}
if (CollectionUtil.isEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) {
return AjaxResult.error("请先添加领料任务物资明细");
return AjaxResult.error("请先添加任务物资明细");
}
leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate());
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername());
try {
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
String taskCode = genderTaskCode(thisMonthMaxOrder);
Integer taskStatus;
if (leaseApplyRequestVo.getLeaseApplyInfo().getIsLease()!=null){
//领用申请任务
taskStatus=LeaseTaskStatusEnum.LEASE_TASK_ZERO.getStatus();
} else {
//领料申请任务
taskStatus=LeaseTaskStatusEnum.LEASE_TASK_TO_PUBLISHED.getStatus();
}
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(),
LeaseTaskStatusEnum.LEASE_TASK_TO_PUBLISHED.getStatus(),
taskStatus,
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(),thisMonthMaxOrder + 1, taskCode);
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(SecurityUtils.getUsername());
@ -270,6 +278,37 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
}
/**
* 领用任务审核
*/
@Override
public AjaxResult useExamine(LeaseApplyInfo leaseApplyInfo) {
if (leaseApplyInfo.getId() == null) {
return AjaxResult.error("ID为空,请完善后重新发布!");
}
if (leaseApplyInfo.getTaskId() == null) {
return AjaxResult.error("任务ID为空,请完善后重新发布!");
}
try {
int result = leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo);
if (result > 0) {
// 同步修改tm_task任务状态, 如果不需要审核改成 LEASE_TASK_IN_PROGRESS 如果需要审核改成 LEASE_TASK_TO_AUDIT
TmTask tmTask = new TmTask();
tmTask.setTaskType(TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
tmTask.setTaskId(leaseApplyInfo.getTaskId());
tmTask.setTaskStatus(LeaseTaskStatusEnum.LEASE_TASK_TO_PUBLISHED.getStatus());
tmTaskMapper.updateTmTask(tmTask);
return AjaxResult.success("审核成功");
}
return AjaxResult.error("审核失败");
} catch (DataAccessException e) {
// 抛出异常回滚数据
throw new RuntimeException();
} catch (Exception e) {
return AjaxResult.error("审核失败:" + e.getMessage());
}
}
private AjaxResult insertPurchaseCheckDetails(List<LeaseApplyDetails> leaseApplyDetailsList, Long parentId) {
if (!CollectionUtils.isEmpty(leaseApplyDetailsList)) {
for (LeaseApplyDetails details : leaseApplyDetailsList) {

View File

@ -6,6 +6,7 @@ import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.ma.domain.StandardConfigBean;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.StandardConfigDetailsVo;
@ -38,6 +39,17 @@ public class StandardConfigManageController extends BaseController {
return service.getConfigTreeSelect(configName, parentId);
}
/**
* 标准配置下拉选--只有二级数据
* @param bean
* @return
*/
@ApiOperation(value = "标准配置下拉选")
@PostMapping("getConfigLevelTwoList")
public AjaxResult getConfigLevelTwoList(@RequestBody StandardConfigBean bean){
return service.getConfigLevelTwoList(bean);
}
/**
* 根据左配置id查询右表格
*/
@ -85,15 +97,12 @@ public class StandardConfigManageController extends BaseController {
@SysLog(title = "机械设备标准配置管理", businessType = OperaType.INSERT, module = "机械设备标准配置管理->新增标准配置明细")
@PostMapping(value = "/addConfigDetails")
public AjaxResult addConfigDetails(@RequestBody StandardConfigDetailsVo bean) {
int result = service.addConfigDetails(bean);
if (result == 0){
return AjaxResult.error("操作失败!");
} else if (result == -2){
return AjaxResult.error("该类型下已存在该配置!");
} else if (result >0){
try {
service.addConfigDetails(bean);
return AjaxResult.success();
} else {
return AjaxResult.error("操作失败!");
} catch (Exception e) {
// 这里无需手动回滚因为@Transactional会自动处理
return AjaxResult.error(e.getMessage());
}
}

View File

@ -154,6 +154,17 @@ public class TypeController extends BaseController {
return success(listByMaType);
}
/**
* 查询物资类型3级--前端联动式下拉框
* 没有4级规格型号
*/
@ApiOperation(value = "获取物资类型连动式下拉框")
@GetMapping("/equipmentThreeType")
public AjaxResult equipmentThreeType(@RequestParam(required = false) Long typeId, @RequestParam(required = false) String typeName) {
List<Type> listByMaType = typeService.getEquipmentThreeType(typeId, typeName);
return success(listByMaType);
}
/**
* TODO : 后续优化代码逻辑

View File

@ -47,6 +47,9 @@ public class StandardConfigDetailsVo extends Type {
@ApiModelProperty(value = "规格ID")
private Long typeId;
@ApiModelProperty(value = "规格IDs")
private Long[] typeIds;
@ApiModelProperty(value = "规格型号")
private String typeModelName;

View File

@ -1,6 +1,7 @@
package com.bonus.material.ma.mapper;
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.material.common.domain.vo.SelectVo;
import com.bonus.material.ma.domain.MaTypeHistory;
import com.bonus.material.ma.domain.StandardConfigBean;
import com.bonus.material.ma.domain.Type;
@ -106,4 +107,11 @@ public interface StandardConfigManageMapper {
* @return
*/
int delConfigDetails(StandardConfigDetailsVo bean);
/**
* 标准配置下拉选--只有二级数据
* @param bean
* @return
*/
List<StandardConfigBean> getConfigLevelTwoList(StandardConfigBean bean);
}

View File

@ -24,6 +24,14 @@ public interface TypeMapper {
List<Type> selectMaTypeList(String typeName);
/**
* 查询物资类型3级--前端联动式下拉框
* 没有4级规格型号
* @param typeName
* @return
*/
List<Type> selectMaTypeThreeList(String typeName);
/**
* 查询物资类型
*
@ -174,4 +182,5 @@ public interface TypeMapper {
* @return
*/
int addMaTypeStockNum(@Param("record") LeaseOutDetails leaseOutDetails);
}

View File

@ -27,6 +27,15 @@ public interface ITypeService {
List<Type> getEquipmentType(Long typeId, String typeName);
/**
* 查询物资类型3级--前端联动式下拉框
* 没有4级规格型号
* @param typeId
* @param typeName
* @return
*/
List<Type> getEquipmentThreeType(Long typeId, String typeName);
List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId);
List<MaTypeVo> getListByParentId(Long typeId, MaTypeVo type);
@ -112,4 +121,5 @@ public interface ITypeService {
// AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto);
List<MaTypeVo> getMyTypeAndBindUsers(List<MaTypeVo> list,Long userId);
}

View File

@ -57,9 +57,10 @@ public interface StandardConfigManageService {
/**
* 新增机械设备标准配置管理明细
* @param bean
* @throws Exception
* @return
*/
int addConfigDetails(StandardConfigDetailsVo bean);
int addConfigDetails(StandardConfigDetailsVo bean) throws Exception;
/**
* 修改机械设备标准配置管理明细
@ -74,4 +75,11 @@ public interface StandardConfigManageService {
* @return
*/
AjaxResult delConfigDetails(StandardConfigDetailsVo bean);
/**
* 标准配置下拉选--只有二级数据
* @param bean
* @return
*/
AjaxResult getConfigLevelTwoList(StandardConfigBean bean);
}

View File

@ -9,6 +9,7 @@ import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.common.domain.vo.SelectVo;
import com.bonus.material.ma.domain.StandardConfigBean;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MaTypeVo;
@ -17,6 +18,7 @@ import com.bonus.material.ma.mapper.StandardConfigManageMapper;
import com.bonus.material.ma.mapper.TypeMapper;
import com.bonus.material.ma.service.StandardConfigManageService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
@ -57,13 +59,18 @@ public class StandardConfigManageServiceImpl implements StandardConfigManageServ
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
try {
//根据level层级和配置id 查询父级ID
List<Integer> parentIds = mapper.selectParentId(bean);
if (CollectionUtils.isEmpty(parentIds)) {
return AjaxResult.success(new ArrayList<>());
}
for (Integer parentId : parentIds) {
list.addAll(mapper.getListByParentId(parentId.longValue(), bean));
if (StringUtils.isNull(bean.getConfigId())){
//查全部
list.addAll(mapper.getListByParentId(null, bean));
}else {
//根据level层级和配置id 查询父级ID
List<Integer> parentIds = mapper.selectParentId(bean);
if (CollectionUtils.isEmpty(parentIds)) {
return AjaxResult.success(new ArrayList<>());
}
for (Integer parentId : parentIds) {
list.addAll(mapper.getListByParentId(parentId.longValue(), bean));
}
}
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
} catch (Exception e) {
@ -104,11 +111,11 @@ public class StandardConfigManageServiceImpl implements StandardConfigManageServ
if (StringUtils.isNull(bean.getConfigId())){
return AjaxResult.error("删除失败,缺少参数");
}
//根据configId查询删除类型下属是否有关联有关联无法删除
List<StandardConfigDetailsVo> list = mapper.selectByConfigId(bean.getConfigId());
if (list!=null && list.size()>0) {
return AjaxResult.error("该类型下有子类型,无法删除");
}
// //根据configId查询删除类型下属是否有关联有关联无法删除
// List<StandardConfigDetailsVo> list = mapper.selectByConfigId(bean.getConfigId());
// if (list!=null && list.size()>0) {
// return AjaxResult.error("该类型下有子类型,无法删除");
// }
bean.setUpdateTime(DateUtils.getNowDate());
bean.setUpdateBy(SecurityUtils.getUserId().toString());
int result = mapper.deleteConfigByConfigId(bean);
@ -119,21 +126,27 @@ public class StandardConfigManageServiceImpl implements StandardConfigManageServ
}
@Override
public int addConfigDetails(StandardConfigDetailsVo bean) {
try {
//根据configId和typeId 查询是否存在数据
int count = mapper.getCountById(bean);
if (count > 0) {
return -2;
@Transactional(rollbackFor = Exception.class)
public int addConfigDetails(StandardConfigDetailsVo bean) throws Exception {
if (bean.getTypeIds() != null && bean.getTypeIds().length > 0){
for (Long typeId : bean.getTypeIds()) {
// 根据configId和typeId 查询是否存在数据
StandardConfigDetailsVo bean1 = new StandardConfigDetailsVo();
bean1.setConfigId(bean.getConfigId());
bean1.setTypeId(typeId);
int count = mapper.getCountById(bean1);
if (count > 0) {
throw new Exception("该类型下已存在该配置!");
}
bean1.setCreateTime(DateUtils.getNowDate());
bean1.setCreateBy(SecurityUtils.getUserId().toString());
int result = mapper.addConfigDetails(bean1);
if(result <= 0){
throw new Exception("操作失败!");
}
}
bean.setCreateTime(DateUtils.getNowDate());
bean.setCreateBy(SecurityUtils.getUserId().toString());
int result = mapper.addConfigDetails(bean);
return result;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
return 1;
}
@Override
@ -163,6 +176,17 @@ public class StandardConfigManageServiceImpl implements StandardConfigManageServ
}
}
@Override
public AjaxResult getConfigLevelTwoList(StandardConfigBean bean) {
List<StandardConfigBean> list = new ArrayList<>();
try {
list = mapper.getConfigLevelTwoList(bean);
} catch (Exception e) {
return AjaxResult.success(new ArrayList());
}
return AjaxResult.success(list);
}
public List<TreeSelect> getConfigTree(String typeName, String parentId) {
List<StandardConfigBean> standardConfigs = mapper.selectStandardConfigTree();
List<StandardConfigBean> builtConfigList = buildConfigTree(standardConfigs);

View File

@ -99,6 +99,23 @@ public class TypeServiceImpl implements ITypeService {
return list;
}
@Override
public List<Type> getEquipmentThreeType(Long typeId, String typeName) {
List<Type> maTypes = typeMapper.selectMaTypeThreeList("");
List<Type> list = new ArrayList<>();
for (Type maType : maTypes) {
if (maType.getParentId() == 0) {
list.add(maType);
}
}
//根据父节点获取对应的儿子节点
for (Type maType : list) {
List<Type> child = getChild(maTypes, maType.getTypeId());
maType.setChildren(child);
}
return list;
}
@Override
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {

View File

@ -112,6 +112,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="leaseType != null and leaseType != ''"> and lai.lease_type = #{leaseType}</if>
<if test="estimateLeaseTime != null "> and lai.estimate_lease_time = #{estimateLeaseTime}</if>
<if test="costBearingParty != null and costBearingParty != ''"> and lai.cost_bearing_party = #{costBearingParty}</if>
<if test="isLease == null">and tt.task_status != '0'</if>
<if test="isLease != null">
and lai.config_id is not null
</if>
</where>
GROUP BY lai.id
ORDER BY tt.task_status,tt.create_time desc
@ -149,6 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="leaseType != null">lease_type,</if>
<if test="estimateLeaseTime != null">estimate_lease_time,</if>
<if test="costBearingParty != null">cost_bearing_party,</if>
<if test="configId != null">config_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
@ -175,6 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="leaseType != null">#{leaseType},</if>
<if test="estimateLeaseTime != null">#{estimateLeaseTime},</if>
<if test="costBearingParty != null">#{costBearingParty},</if>
<if test="configId != null">#{configId},</if>
</trim>
</insert>

View File

@ -60,11 +60,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="deleteConfigByConfigId">
update bm_standard_config
set
del_flag = 2,
update_by = #{updateBy},
update_time = #{updateTime}
where id = #{configId}
set del_flag = 2,
update_by = #{updateBy},
update_time = #{updateTime}
where id = #{configId};
update bm_standard_config_details
set del_flag = 2,
update_by = #{updateBy},
update_time = #{updateTime}
where config_id = #{configId}
</update>
<update id="updateConfigDetails">
update bm_standard_config_details
@ -154,8 +159,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt.del_flag = '0'
) a ON a.typeId = bscd.type_id
WHERE
bscd.config_id = #{configId}
AND bscd.del_flag = 0
bscd.del_flag = 0
<if test="configId != null and configId != ''">
AND bscd.config_id = #{configId}
</if>
<if test="bean.keyWord != null and bean.keyWord !=''">
AND (a.houseName like concat('%',#{bean.keyWord},'%')
or a.constructionType like concat('%',#{bean.keyWord},'%')
@ -165,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or bscd.remark like concat('%',#{bean.keyWord},'%')
)
</if>
order by bscd.type_id asc
</select>
<select id="queryByNameAndParentId" resultType="com.bonus.material.ma.domain.StandardConfigBean">
@ -195,4 +203,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND config_id = #{configId}
AND type_id = #{typeId}
</select>
<select id="getConfigLevelTwoList" resultType="com.bonus.material.ma.domain.StandardConfigBean">
SELECT
bsc.id AS configId,
bsc.`name` AS configName,
bsc.parent_id AS parentId,
bsc.`level` AS level
FROM
bm_standard_config bsc
WHERE
bsc.del_flag = 0
AND bsc.`level` = 2
</select>
</mapper>

View File

@ -523,6 +523,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectMaTypeThreeList" resultMap="TypeResult">
select DISTINCT m.type_id, m.type_name, m.parent_id, m.unit_id, m.unit_name, m.unit_value,m.manage_type,
m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num,
m.del_flag, m.create_by, m.create_time,
m.remark,m.type_id id , m.type_name label,
CASE m.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(m.storage_num, 0)
END as storage_num
from ma_type m
left join (SELECT mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count(mm.ma_id) num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id
<where>
m.del_flag = '0'
and m.level != '4'
<if test="typeName != null and typeName !=''">
AND m.type_name like concat('%',#{typeName},'%')
</if>
</where>
</select>
<select id="getListByTypeName" resultType="com.bonus.material.ma.domain.vo.MaTypeVo">
SELECT DISTINCT
m3.type_name AS itemType,