代码提交

This commit is contained in:
liang.chao 2025-08-27 11:42:18 +08:00
parent 8d9b7ccfa3
commit 2d6f3939a9
11 changed files with 141 additions and 56 deletions

View File

@ -53,9 +53,8 @@ public class MachineController extends BaseController {
@ApiOperation(value = "查询机具设备管理列表1")
//@RequiresPermissions("ma:machine:list")
@GetMapping("/list")
public TableDataInfo list(Machine machine)
{
if (machine.getPrefix()==null){
public TableDataInfo list(Machine machine) {
if (machine.getPrefix() == null) {
startPage();
}
List<MachineVo> list = machineService.selectMachineList(machine);
@ -68,8 +67,7 @@ public class MachineController extends BaseController {
@ApiOperation(value = "查询在库机具编号")
//@RequiresPermissions("ma:machine:typeList")
@GetMapping("/getMachineList")
public AjaxResult getMachineList(Type type)
{
public AjaxResult getMachineList(Type type) {
return machineService.getMachineList(type);
}
@ -79,8 +77,7 @@ public class MachineController extends BaseController {
@ApiOperation(value = "查询机具设备管理列表2")
//@RequiresPermissions("ma:machine:typeList")
@GetMapping("/getTypeList")
public AjaxResult list(Type type)
{
public AjaxResult list(Type type) {
return machineService.selectByTypeList(type);
}
@ -90,10 +87,9 @@ public class MachineController extends BaseController {
@ApiOperation(value = "导出机具设备管理列表")
@PreventRepeatSubmit
@RequiresPermissions("ma:machine:export")
@SysLog(title = "机具设备管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出机具设备管理")
@SysLog(title = "机具设备管理", businessType = OperaType.EXPORT, logType = 1, module = "仓储管理->导出机具设备管理")
@PostMapping("/export")
public void export(HttpServletResponse response, Machine machine)
{
public void export(HttpServletResponse response, Machine machine) {
List<MachineVo> list = machineService.selectMachineList(machine);
ExcelUtil<MachineVo> util = new ExcelUtil<MachineVo>(MachineVo.class);
util.exportExcel(response, list, "机具设备管理数据");
@ -105,13 +101,13 @@ public class MachineController extends BaseController {
@ApiOperation(value = "获取机具设备管理详细信息")
@RequiresPermissions("ma:machine:query")
@GetMapping(value = "/{maId}")
public AjaxResult getInfo(@PathVariable("maId") Long maId)
{
public AjaxResult getInfo(@PathVariable("maId") Long maId) {
return AjaxResult.success(machineService.selectMachineByMaId(maId));
}
/**
* 获取机具设备管理详细信息
*
* @param machine
* @return
*/
@ -132,10 +128,9 @@ public class MachineController extends BaseController {
@ApiOperation(value = "新增机具设备管理")
@PreventRepeatSubmit
@RequiresPermissions("ma:machine:add")
@SysLog(title = "机具设备管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增机具设备管理")
@SysLog(title = "机具设备管理", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->新增机具设备管理")
@PostMapping
public AjaxResult add(@RequestBody Machine machine)
{
public AjaxResult add(@RequestBody Machine machine) {
return toAjax(machineService.insertMachine(machine));
}
@ -145,29 +140,39 @@ public class MachineController extends BaseController {
@ApiOperation(value = "修改机具设备管理")
@PreventRepeatSubmit
@RequiresPermissions("ma:machine:edit")
@SysLog(title = "机具设备管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改机具设备管理")
@SysLog(title = "机具设备管理", businessType = OperaType.UPDATE, logType = 1, module = "仓储管理->修改机具设备管理")
@PutMapping
public AjaxResult edit(@RequestBody Machine machine)
{
public AjaxResult edit(@RequestBody Machine machine) {
return machineService.updateMachine(machine);
}
/**
* 修改机具设备状态
*/
@ApiOperation(value = "修改机具设备状态")
@PreventRepeatSubmit
@RequiresPermissions("ma:machine:editMachineStatus")
@SysLog(title = "修改机具设备状态", businessType = OperaType.UPDATE, logType = 1, module = "仓储管理->修改机具设备状态")
@PutMapping("/editMachineStatus")
public AjaxResult editMachineStatus(@RequestBody Machine machine) {
return machineService.editMachineStatus(machine);
}
/**
* 删除机具设备管理
*/
@ApiOperation(value = "删除机具设备管理")
@PreventRepeatSubmit
@RequiresPermissions("ma:machine:remove")
@SysLog(title = "机具设备管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除机具设备管理")
@DeleteMapping("/{maId}")
public AjaxResult remove(@PathVariable Long maId)
{
@SysLog(title = "机具设备管理", businessType = OperaType.DELETE, logType = 1, module = "仓储管理->删除机具设备管理")
@DeleteMapping("/{maId}")
public AjaxResult remove(@PathVariable Long maId) {
return machineService.deleteMachineByMaId(maId);
}
/**
* 电子标签查询
* 电子标签查询
*/
@ApiOperation(value = "电子标签查询")
@GetMapping("/getElectronicLabel")
@ -177,6 +182,7 @@ public class MachineController extends BaseController {
/**
* 电子标签编码查询
*
* @param machine
* @return
*/
@ -192,6 +198,7 @@ public class MachineController extends BaseController {
/**
* 根据标签信息查询出库单
*
* @param leaseApplyInfo
* @return
*/
@ -204,7 +211,7 @@ public class MachineController extends BaseController {
@ApiOperation(value = "获取报告")
@PostMapping("/getReport")
public AjaxResult getReport(@RequestBody Machine machine){
public AjaxResult getReport(@RequestBody Machine machine) {
try {
// 创建RestTemplate实例
RestTemplate restTemplate = new RestTemplate();
@ -263,8 +270,7 @@ public class MachineController extends BaseController {
@ApiOperation(value = "检验报告同步")
@PreventRepeatSubmit
@PostMapping("/synchReport")
public AjaxResult synchReport(@RequestBody Machine machine)
{
public AjaxResult synchReport(@RequestBody Machine machine) {
return machineService.synchReport(machine);
}
@ -274,13 +280,13 @@ public class MachineController extends BaseController {
@ApiOperation(value = "固定资产编号录入")
@PreventRepeatSubmit
@PostMapping("/editAssetsCode")
public AjaxResult editAssetsCode(@RequestBody Machine machine)
{
public AjaxResult editAssetsCode(@RequestBody Machine machine) {
return toAjax(machineService.editAssetsCode(machine));
}
/**
* 根据qrcode查询机具历史信息
*
* @param machine
* @return
*/
@ -299,6 +305,7 @@ public class MachineController extends BaseController {
/**
* 根据qrcode查询机具历史信息
*
* @param machine
* @return
*/
@ -309,6 +316,7 @@ public class MachineController extends BaseController {
/**
* 根据qrcode查询机具历史信息-New查询安全工器具和工器具
*
* @param machine
* @return
*/
@ -319,6 +327,7 @@ public class MachineController extends BaseController {
/**
* 根据类型id获取编码
*
* @param machine
* @return
*/

View File

@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import cn.hutool.core.convert.Convert;
import com.bonus.common.biz.annotation.StoreLog;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.log.enums.OperaType;
@ -262,6 +263,14 @@ public class TypeController extends BaseController {
public AjaxResult add(@RequestBody Type type) {
return toAjax(typeService.insertType(type));
}
@ApiOperation(value = "修改物资库存")
@PreventRepeatSubmit
@RequiresPermissions("ma:type:updateNum")
@SysLog(title = "物资类型管理", businessType = OperaType.INSERT, module = "仓储管理->修改物资库存")
@PostMapping("/updateStorageNum")
public AjaxResult updateStorageNum(@RequestBody Type type) {
return toAjax(typeService.updateStorageNum(type));
}
/**
* 修改物资类型管理

View File

@ -76,6 +76,9 @@ public class Type extends BaseEntity {
@Excel(name = "实时库存",sort = 11)
@ApiModelProperty(value = "实时库存")
private BigDecimal storageNum;
/** 实时库存 */
@ApiModelProperty(value = "修改前库存")
private BigDecimal preStoreNum;
/** 是否扣费 */
@ApiModelProperty(value = "是否扣费,0:扣费, 1:不扣费")

View File

@ -220,4 +220,6 @@ public interface MachineMapper
* @return
*/
int batchUpdateSynchReport(@Param("list") List<SampleSync> samples);
int editMachineStatus(Machine machine);
}

View File

@ -217,4 +217,10 @@ public interface TypeMapper {
* @return
*/
List<MaTypeVo> getUserList(MaTypeVo type);
int updateStorageNum(Type type);
BigDecimal getStorageNumByTypeId(Type type);
void insertStorageNumLog(Type type);
}

View File

@ -140,4 +140,6 @@ public interface IMachineService
* @return
*/
AjaxResult getHisByCodeNew(Machine machine);
AjaxResult editMachineStatus(Machine machine);
}

View File

@ -144,4 +144,6 @@ public interface ITypeService {
* @return
*/
List<MaTypeVo> getUserList(MaTypeVo type);
int updateStorageNum(Type type);
}

View File

@ -572,6 +572,16 @@ public class MachineServiceImpl implements IMachineService
}
}
@Override
public AjaxResult editMachineStatus(Machine machine) {
machine.setUpdateTime(DateUtils.getNowDate());
int result = machineMapper.editMachineStatus(machine);
if (result > 0) {
return success(HttpCodeEnum.SUCCESS.getMsg(), result);
}
return error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* 编码铭牌信息
* @param machine

View File

@ -35,6 +35,7 @@ import javax.annotation.Resource;
/**
* 物资类型管理Service业务层实现
*
* @author syruan
*/
@Service
@ -78,7 +79,8 @@ public class TypeServiceImpl implements ITypeService {
/**
* 查询物资类型四级树--前端联动式下拉框
* @param typeId 类型id
*
* @param typeId 类型id
* @param typeName 类型名称
*/
@Override
@ -131,7 +133,8 @@ public class TypeServiceImpl implements ITypeService {
/**
* 递归调用获取子级
* @param list 集合
*
* @param list 集合
* @param parentId 父级id
*/
public List<Type> getChild(List<Type> list, Long parentId) {
@ -184,6 +187,7 @@ public class TypeServiceImpl implements ITypeService {
/**
* 查询一级列表
*
* @param maTypeVo
* @return
*/
@ -195,6 +199,7 @@ public class TypeServiceImpl implements ITypeService {
/**
* 查询物资类型管理绑定的库管班长用户列表
*
* @param type
* @return
*/
@ -203,6 +208,17 @@ public class TypeServiceImpl implements ITypeService {
return typeMapper.getUserList(type);
}
@Override
public int updateStorageNum(Type type) {
// 查询库存
// BigDecimal storageNum = typeMapper.getStorageNumByTypeId(type);
type.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
// type.setPreStoreNum(storageNum);
// 插入修改记录
typeMapper.insertStorageNumLog(type);
return typeMapper.updateStorageNum(type);
}
@Override
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {
@ -212,8 +228,8 @@ public class TypeServiceImpl implements ITypeService {
/**
* 根据组织树parent_id查询结果
*
* @param typeId 父级id
* @param type 名称筛选
* @param typeId 父级id
* @param type 名称筛选
*/
@Override
public List<MaTypeVo> getListByParentId(Long typeId, MaTypeVo type) {
@ -233,7 +249,7 @@ public class TypeServiceImpl implements ITypeService {
*/
@Override
public List<Type> selectTypeList(Type type) {
if (type != null ) {
if (type != null) {
if (StringUtils.isEmpty(type.getDelFlag())) {
// 如果没赋值则默认查询正常数据状态
type.setDelFlag(String.valueOf(DataCodeEnum.NORMAL.getCode()));
@ -255,7 +271,7 @@ public class TypeServiceImpl implements ITypeService {
@Override
public List<Type> selectTypeList4Keeper(Type type) {
List<Type> typeList = Collections.emptyList();
if (type != null ) {
if (type != null) {
if (StringUtils.isEmpty(type.getDelFlag())) {
// 如果没赋值则默认查询正常数据状态
type.setDelFlag(String.valueOf(DataCodeEnum.NORMAL.getCode()));
@ -266,7 +282,7 @@ public class TypeServiceImpl implements ITypeService {
}
}
typeList = typeMapper.selectTypeList4Keeper(type);
typeList.removeIf(item -> item.getLevel() == null || !Objects.equals(item.getLevel(),"4"));
typeList.removeIf(item -> item.getLevel() == null || !Objects.equals(item.getLevel(), "4"));
return typeList;
}
@ -279,7 +295,7 @@ public class TypeServiceImpl implements ITypeService {
@Override
public List<Type> selectTypeList4Repair(Type type) {
List<Type> typeList;
if (type != null ) {
if (type != null) {
if (StringUtils.isEmpty(type.getDelFlag())) {
// 如果没赋值则默认查询正常数据状态
type.setDelFlag(String.valueOf(DataCodeEnum.NORMAL.getCode()));
@ -293,7 +309,7 @@ public class TypeServiceImpl implements ITypeService {
}
// 执行SQL
typeList = typeMapper.selectTypeList4Repair(type);
typeList.removeIf(item -> item.getLevel() == null || !Objects.equals(item.getLevel(),"4"));
typeList.removeIf(item -> item.getLevel() == null || !Objects.equals(item.getLevel(), "4"));
return typeList;
}
@ -433,8 +449,8 @@ public class TypeServiceImpl implements ITypeService {
//维护库管信息
List<String> keeperArr = type.getKeeperArr();
if (keeperArr != null && keeperArr.size()>0){
for(int i=0 ; i<keeperArr.size();i++){
if (keeperArr != null && keeperArr.size() > 0) {
for (int i = 0; i < keeperArr.size(); i++) {
Type keeper = new Type();
keeper.setKeeperId(keeperArr.get(i));
keeper.setTypeId(type.getTypeId());
@ -444,8 +460,8 @@ public class TypeServiceImpl implements ITypeService {
}
//维护维修员信息
List<String> repairerArr = type.getRepairerArr();
if (repairerArr != null && repairerArr.size()>0){
for(int i=0 ; i<repairerArr.size();i++){
if (repairerArr != null && repairerArr.size() > 0) {
for (int i = 0; i < repairerArr.size(); i++) {
Type repairer = new Type();
repairer.setRepairerId(repairerArr.get(i));
repairer.setTypeId(type.getTypeId());
@ -477,7 +493,7 @@ public class TypeServiceImpl implements ITypeService {
if (keeperArr != null && !keeperArr.isEmpty()) {
typeMapper.deleteTypeKeeperByTypeId(type);
for(int i=0 ; i<keeperArr.size();i++){
for (int i = 0; i < keeperArr.size(); i++) {
Type keeper = new Type();
keeper.setKeeperId(keeperArr.get(i));
keeper.setTypeId(type.getTypeId());
@ -486,9 +502,9 @@ public class TypeServiceImpl implements ITypeService {
}
//维护维修员信息
List<String> repairerArr = type.getRepairerArr();
if (repairerArr != null && !repairerArr.isEmpty()){
if (repairerArr != null && !repairerArr.isEmpty()) {
typeMapper.deleteTypeRepairerByTypeId(type);
for(int i=0 ; i<repairerArr.size();i++){
for (int i = 0; i < repairerArr.size(); i++) {
Type repairer = new Type();
repairer.setRepairerId(repairerArr.get(i));
repairer.setTypeId(type.getTypeId());
@ -631,10 +647,12 @@ public class TypeServiceImpl implements ITypeService {
// 3.遍历所有配置关联
Map<Long, List<WhHouseSet>> groupedById = whHouseSets.stream().collect(Collectors.groupingBy(WhHouseSet::getHouseId));
groupedById.forEach((id, itemList) -> {
TreeSelect thisTree = new TreeSelect(itemList.get(0).getHouseId(),itemList.get(0).getHouseName(),0,null);
TreeSelect thisTree = new TreeSelect(itemList.get(0).getHouseId(), itemList.get(0).getHouseName(), 0, null);
List<TreeSelect> children = new ArrayList<>();
for (WhHouseSet whHouseSet : itemList) {
if (whHouseSet == null || whHouseSet.getTypeId() == null) { continue; }
if (whHouseSet == null || whHouseSet.getTypeId() == null) {
continue;
}
TreeSelect oneLevelTree = maTypeMap.get(whHouseSet.getTypeId());
if (oneLevelTree != null) {
children.add(oneLevelTree);
@ -649,6 +667,7 @@ public class TypeServiceImpl implements ITypeService {
/**
* 通过构造函数将 Type对象 转换为 TreeSelect -- 并递归处理子节点
*
* @param type 要进行转换的object对象
*/
private TreeSelect convertToTreeSelect(Type type) {
@ -656,11 +675,10 @@ public class TypeServiceImpl implements ITypeService {
.filter(Objects::nonNull)
.map(this::convertToTreeSelect)
.collect(Collectors.toList());
return new TreeSelect(type.getTypeId(), type.getTypeName(), type.getHouseId(), Integer.valueOf(type.getLevel()),type.getParentId(), children, type.getNumber(), type.getIsEnter(), type.getKeeperUserId());
return new TreeSelect(type.getTypeId(), type.getTypeName(), type.getHouseId(), Integer.valueOf(type.getLevel()), type.getParentId(), children, type.getNumber(), type.getIsEnter(), type.getKeeperUserId());
}
/**
* 构建前端所需要树结构
*
@ -812,7 +830,7 @@ public class TypeServiceImpl implements ITypeService {
// }
@Override
public List<MaTypeVo> getMyTypeAndBindUsers(List<MaTypeVo> list,Long userId) {
public List<MaTypeVo> getMyTypeAndBindUsers(List<MaTypeVo> list, Long userId) {
List<TypeRepair> typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair());
List<TypeKeeper> typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper());
@ -820,34 +838,33 @@ public class TypeServiceImpl implements ITypeService {
if (CollectionUtils.isNotEmpty(typeRepairList)) {
for (TypeRepair typeRepair : typeRepairList) {
if (Objects.nonNull(typeRepair.getTypeId()) && typeRepair.getTypeId().equals(maTypeVo.getTypeId())) {
if(userId !=null){
if (userId != null) {
Long repairerId = typeRepair.getUserId();
if (repairerId.equals(userId)){
if (repairerId.equals(userId)) {
maTypeVo.setRepairUserId(typeRepair.getUserId());
maTypeVo.setRepairUserName(typeRepair.getUserName());
}
}else{
} else {
maTypeVo.setRepairUserId(typeRepair.getUserId());
maTypeVo.setRepairUserName(typeRepair.getUserName());
}
}
}
}
if (CollectionUtils.isNotEmpty(typeKeeperList)) {
for (TypeKeeper typeKeeper : typeKeeperList) {
if (Objects.nonNull(typeKeeper.getTypeId()) && typeKeeper.getTypeId().equals(maTypeVo.getTypeId())) {
if(userId !=null){
if (userId != null) {
Long keeperId = typeKeeper.getUserId();
if (keeperId.equals(userId)){
if (keeperId.equals(userId)) {
maTypeVo.setKeeperUserId(typeKeeper.getUserId());
maTypeVo.setKeeperUserName(typeKeeper.getUserName());
}
}else{
} else {
maTypeVo.setKeeperUserId(typeKeeper.getUserId());
maTypeVo.setKeeperUserName(typeKeeper.getUserName());
}

View File

@ -598,6 +598,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</update>
<update id="editMachineStatus">
update ma_machine
set ma_status = #{maStatus}
where ma_id = #{maId}
</update>
<select id="selectMachineByQrCode" resultType="com.bonus.material.ma.domain.Machine">

View File

@ -807,6 +807,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
type_id = #{record.typeId}
</update>
<update id="updateStorageNum">
UPDATE
ma_type
SET
storage_num = #{storageNum}
WHERE
type_id = #{typeId}
</update>
<select id="selectByTypeId" resultType="com.bonus.material.ma.domain.Type">
select * from ma_type WHERE
@ -885,6 +893,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INSERT INTO ma_type_history(type_id, before_price, after_price, create_time, create_by)
VALUES (#{typeId}, #{beforePrice} ,#{afterPrice}, #{createTime}, #{createBy})
</insert>
<insert id="insertStorageNumLog">
INSERT INTO update_storage_num_log(type_id, pre_store_num, after_store_num, create_time, creater)
VALUES (#{typeId}, #{preStoreNum}, #{storageNum}, now(), #{createBy})
</insert>
<select id="getMaTypeHistoryListBy" resultType="com.bonus.material.ma.domain.MaTypeHistory">
select
@ -995,4 +1007,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
sur.role_id = 73 OR sur.role_id = 70
</select>
<select id="getStorageNumByTypeId" resultType="java.math.BigDecimal">
SELECT
storage_num
FROM
ma_type
WHERE
type_id = #{typeId}
</select>
</mapper>