bug 食堂修改
This commit is contained in:
parent
9cf676d4a9
commit
d91d4ad1cd
|
|
@ -80,5 +80,8 @@ public interface CookMaterialMapper {
|
||||||
* @param materialIds 原料ID
|
* @param materialIds 原料ID
|
||||||
* @return 存在返回1
|
* @return 存在返回1
|
||||||
*/
|
*/
|
||||||
|
public int checkIsUsecMaterial(@Param("materialIds") Long[] materialIds);
|
||||||
|
|
||||||
public int checkIsUse(@Param("materialIds") Long[] materialIds);
|
public int checkIsUse(@Param("materialIds") Long[] materialIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.bonus.canteen.core.cook.service.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.bonus.canteen.core.common.utils.FileUrlUtil;
|
||||||
|
import com.bonus.canteen.core.utils.SysUtil;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
|
|
@ -42,7 +44,15 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<CookMaterial> selectCookMaterialList(CookMaterial cookMaterial) {
|
public List<CookMaterial> selectCookMaterialList(CookMaterial cookMaterial) {
|
||||||
return cookMaterialMapper.selectCookMaterialList(cookMaterial);
|
List<CookMaterial> cookMaterials = cookMaterialMapper.selectCookMaterialList(cookMaterial);
|
||||||
|
cookMaterials.forEach(item -> {
|
||||||
|
String imgUrl = item.getImgUrl();
|
||||||
|
if (imgUrl != null && !imgUrl.isEmpty()) {
|
||||||
|
item.setImgUrl(FileUrlUtil.getFileUrl(imgUrl));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return cookMaterials;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -59,4 +59,6 @@ public interface WarehouseInfoMapper {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteImsWarehouseInfoByWarehouseIds(Long[] warehouseIds);
|
public int deleteImsWarehouseInfoByWarehouseIds(Long[] warehouseIds);
|
||||||
|
|
||||||
|
int findWarehouseCode(String warehouseCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.bonus.canteen.core.ims.service.impl;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.canteen.core.cook.mapper.CookMaterialMapper;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -20,6 +22,8 @@ import com.bonus.canteen.core.ims.service.IImsUnitService;
|
||||||
public class ImsUnitServiceImpl implements IImsUnitService {
|
public class ImsUnitServiceImpl implements IImsUnitService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ImsUnitMapper imsUnitMapper;
|
private ImsUnitMapper imsUnitMapper;
|
||||||
|
@Autowired
|
||||||
|
private CookMaterialMapper cookMaterialMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询计量单位
|
* 查询计量单位
|
||||||
|
|
@ -88,6 +92,10 @@ public class ImsUnitServiceImpl implements IImsUnitService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteImsUnitByUnitIds(Long[] unitIds) {
|
public int deleteImsUnitByUnitIds(Long[] unitIds) {
|
||||||
|
//从原料表中去查询,如果存在,就不能进行删除
|
||||||
|
if (cookMaterialMapper.checkIsUsecMaterial(unitIds) > 0){
|
||||||
|
throw new ServiceException("该计量单位被使用,不允许删除!");
|
||||||
|
}
|
||||||
return imsUnitMapper.deleteImsUnitByUnitIds(unitIds);
|
return imsUnitMapper.deleteImsUnitByUnitIds(unitIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,11 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
|
||||||
public int insertImsWarehouseInfo(WarehouseInfo imsWarehouseInfo) {
|
public int insertImsWarehouseInfo(WarehouseInfo imsWarehouseInfo) {
|
||||||
imsWarehouseInfo.setCreateTime(DateUtils.getNowDate());
|
imsWarehouseInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
try {
|
try {
|
||||||
|
//检查仓库id是否唯一,唯一的话进行下面,否在返回进行提示
|
||||||
|
int warehouseCode = imsWarehouseInfoMapper.findWarehouseCode(imsWarehouseInfo.getWarehouseCode());
|
||||||
|
if (warehouseCode>0) {
|
||||||
|
throw new ServiceException("仓库编码已存在");
|
||||||
|
}
|
||||||
return imsWarehouseInfoMapper.insertImsWarehouseInfo(imsWarehouseInfo);
|
return imsWarehouseInfoMapper.insertImsWarehouseInfo(imsWarehouseInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceException(e.getMessage());
|
throw new ServiceException(e.getMessage());
|
||||||
|
|
@ -68,6 +73,10 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
|
||||||
public int updateImsWarehouseInfo(WarehouseInfo imsWarehouseInfo) {
|
public int updateImsWarehouseInfo(WarehouseInfo imsWarehouseInfo) {
|
||||||
imsWarehouseInfo.setUpdateTime(DateUtils.getNowDate());
|
imsWarehouseInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
try {
|
try {
|
||||||
|
int warehouseCode = imsWarehouseInfoMapper.findWarehouseCode(imsWarehouseInfo.getWarehouseCode());
|
||||||
|
if (warehouseCode>0) {
|
||||||
|
throw new ServiceException("仓库编码已存在");
|
||||||
|
}
|
||||||
return imsWarehouseInfoMapper.updateImsWarehouseInfo(imsWarehouseInfo);
|
return imsWarehouseInfoMapper.updateImsWarehouseInfo(imsWarehouseInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceException(e.getMessage());
|
throw new ServiceException(e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="checkIsUsecMaterial" resultType="java.lang.Integer">
|
||||||
|
select count(1) from cook_material
|
||||||
|
<where>
|
||||||
|
unit_id in
|
||||||
|
<foreach item="materialId" collection="materialIds" open="(" separator="," close=")">
|
||||||
|
#{materialId}
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertCookMaterial" parameterType="com.bonus.canteen.core.cook.domain.CookMaterial" useGeneratedKeys="true" keyProperty="materialId">
|
<insert id="insertCookMaterial" parameterType="com.bonus.canteen.core.cook.domain.CookMaterial" useGeneratedKeys="true" keyProperty="materialId">
|
||||||
insert into cook_material
|
insert into cook_material
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{areaId}
|
#{areaId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="findWarehouseCode" resultType="java.lang.Integer">
|
||||||
|
select count(1)
|
||||||
|
from ims_warehouse_info
|
||||||
|
where warehouse_code = #{warehouseCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertImsWarehouseInfo" parameterType="com.bonus.canteen.core.ims.domain.WarehouseInfo" useGeneratedKeys="true" keyProperty="warehouseId">
|
<insert id="insertImsWarehouseInfo" parameterType="com.bonus.canteen.core.ims.domain.WarehouseInfo" useGeneratedKeys="true" keyProperty="warehouseId">
|
||||||
insert into ims_warehouse_info
|
insert into ims_warehouse_info
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue