Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
071181eb4d
|
|
@ -27,4 +27,22 @@ public enum PurchaseTaskStatusEnum {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.statusName = statusName;
|
this.statusName = statusName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static PurchaseTaskStatusEnum getByStatus(Integer status) {
|
||||||
|
for (PurchaseTaskStatusEnum statusEnum : values()) {
|
||||||
|
if (statusEnum.status.equals(status)) {
|
||||||
|
return statusEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatusName() {
|
||||||
|
return statusName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.bonus.material.purchase.controller;
|
||||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
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.annotation.SysLog;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
// 检查是否全部为 1
|
// 检查是否全部为 1
|
||||||
boolean allOnes = true;
|
boolean allOnes = true;
|
||||||
for (String manageType : split) {
|
for (String manageType : split) {
|
||||||
if (!MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType.trim())) {
|
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(Integer.valueOf(manageType.trim()))) {
|
||||||
allOnes = false;
|
allOnes = false;
|
||||||
// 发现不是 1,跳出循环
|
// 发现不是 1,跳出循环
|
||||||
break;
|
break;
|
||||||
|
|
@ -74,53 +74,10 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//extracted(list);
|
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 远程调用方法抽取
|
|
||||||
* @param list
|
|
||||||
*/
|
|
||||||
// private void extracted(List<PurchaseVo> list) {
|
|
||||||
// Long[] array = list.stream()
|
|
||||||
// // 提取 createBy 字段
|
|
||||||
// .map(PurchaseVo::getCreateBy)
|
|
||||||
// .map(createBy -> {
|
|
||||||
// try {
|
|
||||||
// // 转换为 Long
|
|
||||||
// return Long.parseLong(createBy);
|
|
||||||
// } catch (NumberFormatException e) {
|
|
||||||
// // 处理转换失败的情况,可以返回 null
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// // 过滤掉 null 值
|
|
||||||
// .filter(value -> value != null)
|
|
||||||
// // 转换为 Long[] 数组
|
|
||||||
// .toArray(Long[]::new);
|
|
||||||
// //Map<Long, String> nickNameMap = remoteConfig.getUserName(array);
|
|
||||||
// Map<String, String> labelMap = remoteConfig.getDictValue("purchase_task_status");
|
|
||||||
// // 更新 list 中每个 PurchaseVo 对象的 name 字段
|
|
||||||
// list.forEach(purchaseVo -> {
|
|
||||||
// // 更新 createBy 为 nickName
|
|
||||||
//// String createBy = purchaseVo.getCreateBy();
|
|
||||||
//// if (StringUtils.isNotBlank(createBy)) {
|
|
||||||
//// Long createById = Long.parseLong(createBy);
|
|
||||||
//// String nickName = nickNameMap.get(createById);
|
|
||||||
//// purchaseVo.setCreateBy(nickName != null ? nickName : createBy);
|
|
||||||
//// purchaseVo.setCreateBy(nickName != null ? nickName : createBy); // 设置为 nickName 或原值
|
|
||||||
//// }
|
|
||||||
// // 更新状态名称
|
|
||||||
// Integer status = purchaseVo.getStatus();
|
|
||||||
// if (status != null) {
|
|
||||||
// String dictValue = labelMap.get(status.toString());
|
|
||||||
// purchaseVo.setStatusName(dictValue);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询绑定信息
|
* 查询绑定信息
|
||||||
* @param dto
|
* @param dto
|
||||||
|
|
|
||||||
|
|
@ -53,50 +53,14 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
@Override
|
@Override
|
||||||
public List<PurchaseVo> selectAll(PurchaseDto dto) {
|
public List<PurchaseVo> selectAll(PurchaseDto dto) {
|
||||||
List<PurchaseVo> list = purchaseStorageMapper.selectAll(dto);
|
List<PurchaseVo> list = purchaseStorageMapper.selectAll(dto);
|
||||||
extracted(list);
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
for (PurchaseVo purchaseVo : list) {
|
||||||
|
purchaseVo.setStatusName(String.valueOf(PurchaseTaskStatusEnum.getByStatus(purchaseVo.getStatus())));
|
||||||
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 远程调用方法抽取
|
|
||||||
* @param list
|
|
||||||
*/
|
|
||||||
private void extracted(List<PurchaseVo> list) {
|
|
||||||
Long[] array = list.stream()
|
|
||||||
// 提取 createBy 字段
|
|
||||||
.map(PurchaseVo::getCreateBy)
|
|
||||||
.map(createBy -> {
|
|
||||||
try {
|
|
||||||
// 转换为 Long
|
|
||||||
return Long.parseLong(createBy);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
// 处理转换失败的情况,可以返回 null
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// 过滤掉 null 值
|
|
||||||
.filter(value -> value != null)
|
|
||||||
.toArray(Long[]::new);// 转换为 Long[] 数组
|
|
||||||
Map<Long, String> nickNameMap = remoteConfig.getUserName(array);
|
|
||||||
Map<String, String> labelMap = remoteConfig.getDictValue("purchase_task_status");
|
|
||||||
// 更新 list 中每个 PurchaseVo 对象的 name 字段
|
|
||||||
list.forEach(purchaseVo -> {
|
|
||||||
// 更新 createBy 为 nickName
|
|
||||||
String createBy = purchaseVo.getCreateBy();
|
|
||||||
if (StringUtils.isNotBlank(createBy)) {
|
|
||||||
Long createById = Long.parseLong(createBy);
|
|
||||||
String nickName = nickNameMap.get(createById);
|
|
||||||
purchaseVo.setCreateBy(nickName != null ? nickName : createBy); // 设置为 nickName 或原值
|
|
||||||
}
|
|
||||||
// 更新状态名称
|
|
||||||
Integer status = purchaseVo.getStatus();
|
|
||||||
if (status != null) {
|
|
||||||
String dictValue = labelMap.get(status.toString());
|
|
||||||
purchaseVo.setStatusName(dictValue);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询二级明细详情
|
* 查询二级明细详情
|
||||||
* @param dto
|
* @param dto
|
||||||
|
|
@ -161,17 +125,21 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private AjaxResult rejectByPurchaseIds(PurchaseDto purchaseDto) {
|
private AjaxResult rejectByPurchaseIds(PurchaseDto purchaseDto) {
|
||||||
|
List<Integer> purchaseIdList = parseIds(purchaseDto.getPurchaseId());
|
||||||
purchaseDto.setStatus(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus());
|
purchaseDto.setStatus(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus());
|
||||||
int result = 0;
|
int result = 0;
|
||||||
try {
|
try {
|
||||||
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
|
for (Integer purchaseId : purchaseIdList) {
|
||||||
if (CollectionUtils.isNotEmpty(details)) {
|
purchaseDto.setPurchaseId(String.valueOf(purchaseId));
|
||||||
result += updateRejectAndStatus(Integer.parseInt(purchaseDto.getPurchaseId()));
|
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
|
||||||
List<PurchaseVo> statusList = purchaseStorageMapper.select(details.get(0).getTaskId().toString());
|
if (CollectionUtils.isNotEmpty(details)) {
|
||||||
result += updateTaskStatus(statusList);
|
result += updateRejectAndStatus(purchaseId);
|
||||||
}
|
List<PurchaseVo> statusList = purchaseStorageMapper.select(details.get(0).getTaskId().toString());
|
||||||
if (result > 0) {
|
result += updateTaskStatus(statusList);
|
||||||
return AjaxResult.success("驳回成功");
|
}
|
||||||
|
if (result > 0) {
|
||||||
|
return AjaxResult.success("驳回成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
@ -229,7 +197,7 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
try {
|
try {
|
||||||
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
|
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
|
||||||
if (CollectionUtils.isNotEmpty(details)) {
|
if (CollectionUtils.isNotEmpty(details)) {
|
||||||
result += updatePurchaseInfoAndDetails(details.get(0), Integer.parseInt(purchaseDto.getPurchaseId()));
|
result += updatePurchaseInfoAndDetails(details, details.get(0), Integer.parseInt(purchaseDto.getPurchaseId()));
|
||||||
List<PurchaseVo> statusList = purchaseStorageMapper.select(details.get(0).getTaskId().toString());
|
List<PurchaseVo> statusList = purchaseStorageMapper.select(details.get(0).getTaskId().toString());
|
||||||
result += updateTaskStatus(statusList);
|
result += updateTaskStatus(statusList);
|
||||||
}
|
}
|
||||||
|
|
@ -248,10 +216,12 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
* @param purchaseId
|
* @param purchaseId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private int updatePurchaseInfoAndDetails(PurchaseVo detail, int purchaseId) {
|
private int updatePurchaseInfoAndDetails(List<PurchaseVo> details, PurchaseVo detail, int purchaseId) {
|
||||||
int result = purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), purchaseId);
|
int result = purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), purchaseId);
|
||||||
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
|
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
|
||||||
result += purchaseStorageMapper.insertMachine(detail);
|
for (PurchaseVo purchaseVo : details) {
|
||||||
|
result += purchaseStorageMapper.insertMachine(purchaseVo);
|
||||||
|
}
|
||||||
} else if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
|
} else if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
|
||||||
result += purchaseStorageMapper.updateStorageNum(detail.getBindNum(), detail.getTypeId());
|
result += purchaseStorageMapper.updateStorageNum(detail.getBindNum(), detail.getTypeId());
|
||||||
}
|
}
|
||||||
|
|
@ -320,10 +290,10 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
||||||
Integer id = entry.getKey();
|
Integer id = entry.getKey();
|
||||||
List<Integer> statusList = entry.getValue();
|
List<Integer> statusList = entry.getValue();
|
||||||
if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) || statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())) {
|
if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) || statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())) {
|
||||||
return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, id.toString());
|
return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), id.toString());
|
||||||
} else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())
|
} else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())
|
||||||
&& statusList.contains(PurchaseTaskStatusEnum.IN_STORE.getStatus())) {
|
&& statusList.stream().allMatch(status -> status.equals(PurchaseTaskStatusEnum.IN_STORE.getStatus()))) {
|
||||||
return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), id.toString());
|
return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus(), id.toString());
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}).sum();
|
}).sum();
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ms.supplier AS supplierName,
|
ms.supplier AS supplierName,
|
||||||
pcd.production_time AS productDate,
|
pcd.production_time AS productDate,
|
||||||
mt.manage_type AS manageType,
|
mt.manage_type AS manageType,
|
||||||
pcd.`status` AS STATUS
|
pcd.`status` AS STATUS,
|
||||||
|
pm.ma_code AS maCode,
|
||||||
|
pm.out_fac_code AS outFacCode,
|
||||||
|
pm.qr_code AS qrCode
|
||||||
FROM
|
FROM
|
||||||
purchase_check_details pcd
|
purchase_check_details pcd
|
||||||
LEFT JOIN tm_task tt ON pcd.task_id = tt.task_id
|
LEFT JOIN tm_task tt ON pcd.task_id = tt.task_id
|
||||||
|
|
@ -224,6 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||||
LEFT JOIN ma_supplier_info ms ON pcd.supplier_id = ms.supplier_id
|
LEFT JOIN ma_supplier_info ms ON pcd.supplier_id = ms.supplier_id
|
||||||
|
LEFT JOIN purchase_macode_info pm on pcd.task_id = pm.task_id and pm.type_id = pcd.type_id
|
||||||
where 1 = 1
|
where 1 = 1
|
||||||
<if test="typeId != null and typeId != ''">
|
<if test="typeId != null and typeId != ''">
|
||||||
AND mt.id = #{typeId}
|
AND mt.id = #{typeId}
|
||||||
|
|
|
||||||
|
|
@ -9,56 +9,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="typeId != null">type_id,</if>
|
<if test="typeId != null">type_id,</if>
|
||||||
<if test="maCode != null">ma_code,</if>
|
<if test="maCode != null">ma_code,</if>
|
||||||
<if test="preCode != null">pre_code,</if>
|
|
||||||
<if test="maStatus != null">ma_status,</if>
|
<if test="maStatus != null">ma_status,</if>
|
||||||
<if test="qrCode != null">qr_code,</if>
|
<if test="qrCode != null">qr_code,</if>
|
||||||
<if test="buyPrice != null">buy_price,</if>
|
|
||||||
<if test="maVender != null">ma_vender,</if>
|
|
||||||
<if test="outFacTime != null">out_fac_time,</if>
|
|
||||||
<if test="outFacCode != null">out_fac_code,</if>
|
<if test="outFacCode != null">out_fac_code,</if>
|
||||||
<if test="assetsCode != null">assets_code,</if>
|
create_time
|
||||||
<if test="checkMan != null">check_man,</if>
|
|
||||||
<if test="thisCheckTime != null">this_check_time,</if>
|
|
||||||
<if test="nextCheckTime != null">next_check_time,</if>
|
|
||||||
<if test="gpsCode != null">gps_code,</if>
|
|
||||||
<if test="rfidCode != null">rfid_code,</if>
|
|
||||||
<if test="erpCode != null">erp_code,</if>
|
|
||||||
<if test="transferCode != null">transfer_code,</if>
|
|
||||||
<if test="inOutNum != null">in_out_num,</if>
|
|
||||||
<if test="buyTask != null">buy_task,</if>
|
|
||||||
<if test="ownHouse != null">own_house,</if>
|
|
||||||
<if test="companyId != null">company_id,</if>
|
|
||||||
create_time,
|
|
||||||
<if test="inspectMan != null">inspect_man,</if>
|
|
||||||
<if test="inspectStatus != null">inspect_status,</if>
|
|
||||||
<if test="phone != null">phone,</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="typeId != null">#{typeId},</if>
|
<if test="typeId != null">#{typeId},</if>
|
||||||
<if test="maCode != null">#{maCode},</if>
|
<if test="maCode != null">#{maCode},</if>
|
||||||
<if test="preCode != null">#{preCode},</if>
|
<if test="maStatus != null">1,</if>
|
||||||
<if test="maStatus != null">#{maStatus},</if>
|
|
||||||
<if test="qrCode != null">#{qrCode},</if>
|
<if test="qrCode != null">#{qrCode},</if>
|
||||||
<if test="buyPrice != null">#{buyPrice},</if>
|
|
||||||
<if test="maVender != null">#{maVender},</if>
|
|
||||||
<if test="outFacTime != null">#{outFacTime},</if>
|
|
||||||
<if test="outFacCode != null">#{outFacCode},</if>
|
<if test="outFacCode != null">#{outFacCode},</if>
|
||||||
<if test="assetsCode != null">#{assetsCode},</if>
|
now()
|
||||||
<if test="checkMan != null">#{checkMan},</if>
|
|
||||||
<if test="thisCheckTime != null">#{thisCheckTime},</if>
|
|
||||||
<if test="nextCheckTime != null">#{nextCheckTime},</if>
|
|
||||||
<if test="gpsCode != null">#{gpsCode},</if>
|
|
||||||
<if test="rfidCode != null">#{rfidCode},</if>
|
|
||||||
<if test="erpCode != null">#{erpCode},</if>
|
|
||||||
<if test="transferCode != null">#{transferCode},</if>
|
|
||||||
<if test="inOutNum != null">#{inOutNum},</if>
|
|
||||||
<if test="buyTask != null">#{buyTask},</if>
|
|
||||||
<if test="ownHouse != null">#{ownHouse},</if>
|
|
||||||
<if test="companyId != null">#{companyId},</if>
|
|
||||||
now(),
|
|
||||||
<if test="inspectMan != null">#{inspectMan},</if>
|
|
||||||
<if test="inspectStatus != null">#{inspectStatus},</if>
|
|
||||||
<if test="phone != null">#{phone},</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue