|
|
@ -1,12 +1,29 @@ |
|
|
package com.hxhq.business.service.impl; |
|
|
package com.hxhq.business.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
import com.hxhq.business.domain.StorageLocationJcgj; |
|
|
|
|
|
import com.hxhq.business.domain.Yq; |
|
|
|
|
|
import com.hxhq.business.domain.YqJcgj; |
|
|
|
|
|
import com.hxhq.business.enums.zykgl.JcgjlxEnum; |
|
|
|
|
|
import com.hxhq.business.enums.zykgl.JcmcysEnum; |
|
|
|
|
|
import com.hxhq.business.form.yq.StorageLocationForm; |
|
|
import com.hxhq.business.form.yq.StorageLocationSearchForm; |
|
|
import com.hxhq.business.form.yq.StorageLocationSearchForm; |
|
|
|
|
|
import com.hxhq.business.service.IStorageLocationJcgjService; |
|
|
|
|
|
import com.hxhq.business.service.IYqJcgjService; |
|
|
|
|
|
import com.hxhq.business.utils.ObjectCompareUtil; |
|
|
|
|
|
import com.hxhq.common.core.exception.ServiceException; |
|
|
import com.hxhq.common.core.utils.DateUtils; |
|
|
import com.hxhq.common.core.utils.DateUtils; |
|
|
import com.hxhq.common.core.utils.StringUtils; |
|
|
import com.hxhq.common.core.utils.StringUtils; |
|
|
|
|
|
import com.hxhq.system.api.domain.SysDept; |
|
|
|
|
|
import com.hxhq.system.api.domain.SysUser; |
|
|
|
|
|
import com.hxhq.system.service.ISysDeptService; |
|
|
|
|
|
import com.hxhq.system.service.ISysUserService; |
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.hxhq.business.mapper.StorageLocationMapper; |
|
|
import com.hxhq.business.mapper.StorageLocationMapper; |
|
|
import com.hxhq.business.domain.StorageLocation; |
|
|
import com.hxhq.business.domain.StorageLocation; |
|
|
@ -22,6 +39,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
@Service |
|
|
@Service |
|
|
public class StorageLocationServiceImpl extends ServiceImpl<StorageLocationMapper, StorageLocation> implements IStorageLocationService |
|
|
public class StorageLocationServiceImpl extends ServiceImpl<StorageLocationMapper, StorageLocation> implements IStorageLocationService |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IStorageLocationJcgjService storageLocationJcgjService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ISysUserService sysUserService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ISysDeptService sysDeptService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询存储位置列表 |
|
|
* 查询存储位置列表 |
|
|
* |
|
|
* |
|
|
@ -51,4 +78,74 @@ public class StorageLocationServiceImpl extends ServiceImpl |
|
|
return baseMapper.queryList(queryWrapper); |
|
|
return baseMapper.queryList(queryWrapper); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public StorageLocation queryInfo(Long id) { |
|
|
|
|
|
|
|
|
|
|
|
return baseMapper.queryInfo(id); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void addStorageLocation(StorageLocationForm form) { |
|
|
|
|
|
sysUserService.checkPassword(form.getQmrId(), form.getQmrmm(), false); |
|
|
|
|
|
StorageLocation storageLocation = new StorageLocation(); |
|
|
|
|
|
BeanUtils.copyProperties(form, storageLocation); |
|
|
|
|
|
save(storageLocation); |
|
|
|
|
|
storageLocationJcgjService.saveJcgj(storageLocation, JcgjlxEnum.bj.getValue(), "新增存储位置", "Add Storage Location", JcmcysEnum.blue.getValue(), null, null); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void updateStorageLocation(StorageLocationForm form) { |
|
|
|
|
|
SysUser qmr = sysUserService.selectUserById(form.getQmrId()); |
|
|
|
|
|
sysUserService.checkPassword(qmr, form.getQmrmm(), false); |
|
|
|
|
|
|
|
|
|
|
|
StorageLocation storageLocation = this.queryInfo(form.getId()); |
|
|
|
|
|
if(storageLocation == null) { |
|
|
|
|
|
throw new ServiceException("存储位置不存在或已删除"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!storageLocation.getStatus().equals(form.getStatus())) { |
|
|
|
|
|
if(storageLocation.getStatus() != null && storageLocation.getStatus() == 1) { |
|
|
|
|
|
storageLocation.setStatusInfo("禁用"); |
|
|
|
|
|
} else { |
|
|
|
|
|
storageLocation.setStatusInfo("正常"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(form.getStatus() != null && form.getStatus() == 1) { |
|
|
|
|
|
form.setStatusInfo("禁用"); |
|
|
|
|
|
} else { |
|
|
|
|
|
form.setStatusInfo("正常"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!storageLocation.getDeptId().equals(form.getDeptId())) { |
|
|
|
|
|
SysDept sysDept = sysDeptService.selectDeptById(form.getDeptId()); |
|
|
|
|
|
form.setDeptName(sysDept.getDeptName()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ObjectCompareUtil.FieldChange> fieldChanges = ObjectCompareUtil.compareObjects(storageLocation, form); |
|
|
|
|
|
if (fieldChanges.size() == 0) { |
|
|
|
|
|
throw new SecurityException("你没有修改任何内容"); |
|
|
|
|
|
} |
|
|
|
|
|
BeanUtils.copyProperties(form, storageLocation); |
|
|
|
|
|
updateById(storageLocation); |
|
|
|
|
|
|
|
|
|
|
|
// 稽查轨迹 |
|
|
|
|
|
List<StorageLocationJcgj> jcgjList = new ArrayList<>(); |
|
|
|
|
|
for (ObjectCompareUtil.FieldChange fieldChange : fieldChanges) { |
|
|
|
|
|
StorageLocationJcgj jcgj = new StorageLocationJcgj(); |
|
|
|
|
|
jcgj.setStorageLocationId(storageLocation.getId()); |
|
|
|
|
|
jcgj.setJcgjlx(JcgjlxEnum.bj.getValue()); |
|
|
|
|
|
jcgj.setJcmc("编辑存储位置"); |
|
|
|
|
|
jcgj.setJcmcEn("Edit Storage Location"); |
|
|
|
|
|
jcgj.setJcmcys(JcmcysEnum.orange.getValue()); |
|
|
|
|
|
jcgj.setJcnr(fieldChange.toString()); |
|
|
|
|
|
jcgj.setJcnrEn(fieldChange.toEnString()); |
|
|
|
|
|
jcgj.setQmrId(qmr.getUserId()); |
|
|
|
|
|
jcgj.setQmrMc(qmr.getNickName()); |
|
|
|
|
|
jcgj.setQmrMcEn(qmr.getUserName()); |
|
|
|
|
|
jcgjList.add(jcgj); |
|
|
|
|
|
} |
|
|
|
|
|
storageLocationJcgjService.saveBatchWithLog(storageLocation, jcgjList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |