This commit is contained in:
磷叶 2024-11-22 09:21:17 +08:00
parent 4ff26c4ef7
commit d1e6f8e3c0
4 changed files with 25 additions and 6 deletions

View File

@ -62,7 +62,7 @@ public class DataScopeUtil {
{
StringBuilder sqlString = getSqlString(currentUser, deptAlias, userAlias, PermissionContextHolder.getContext());
if (StringUtils.isNotBlank(sqlString.toString())) {
return getJoinSqlString(sqlString, null);
return getJoinSqlString(sqlString, "");
}
}
}

View File

@ -5,6 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.system.mapper.SysUserMapper">
<resultMap type="SysUserVO" id="SysUserResult" autoMapping="true">
<id property="userId" column="user_id" />
<association property="dept" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>

View File

@ -46,8 +46,8 @@ import com.ruoyi.web.yh.prodOrder.service.ProdOrderService;
* @author ruoyi
* @date 2024-10-29
*/
@Service
@Slf4j
@Service
public class ProdOrderServiceImpl implements ProdOrderService
{
@Autowired

View File

@ -11,11 +11,15 @@ import com.ruoyi.web.yh.price.domain.PriceQuery;
import com.ruoyi.web.yh.price.domain.PriceVO;
import com.ruoyi.web.yh.price.domain.enums.PriceStatus;
import com.ruoyi.web.yh.price.service.PriceService;
import com.ruoyi.web.yh.prodOrder.domain.ProdOrderQuery;
import com.ruoyi.web.yh.prodOrder.domain.ProdOrderVO;
import com.ruoyi.web.yh.prodOrder.service.ProdOrderService;
import com.ruoyi.web.yh.report.domain.ReportVO;
import com.ruoyi.web.yh.report.domain.bo.ReportBO;
import com.ruoyi.web.yh.report.domain.enums.ReportStatus;
import com.ruoyi.web.yh.report.service.ReportService;
import com.ruoyi.web.yh.report.service.ReportValidator;
import com.ruoyi.web.yh.reportOrderProd.domain.bo.ReportOrderProdBO;
import com.ruoyi.web.yh.reportProd.domain.bo.ReportProdBO;
import com.ruoyi.web.yh.reportUserProd.domain.bo.ReportUserProdBO;
import org.springframework.beans.factory.annotation.Autowired;
@ -44,6 +48,9 @@ public class ReportValidatorImpl implements ReportValidator {
@Autowired
private ISysUserService userService;
@Autowired
private ProdOrderService prodOrderService;
@Override
public void checkPreEdit(ReportBO bo) {
ServiceUtil.assertion(bo == null || bo.getReportId() == null, "参数错误");
@ -55,10 +62,9 @@ public class ReportValidatorImpl implements ReportValidator {
// 校验部门
this.checkDept(bo.getDeptId());
// 校验产量
// 校验产量列表
this.checkProduct(bo.getProductList());
}
@Override
@ -110,8 +116,20 @@ public class ReportValidatorImpl implements ReportValidator {
ServiceUtil.assertion(user == null, "员工不存在");
}
// TODO 订单是否当前用户可选
// 订单是否当前用户可选
List<ReportOrderProdBO> orderProdList = productList.stream().map(ReportProdBO::getOrderProdList).flatMap(List::stream).collect(Collectors.toList());
ProdOrderQuery orderQuery = new ProdOrderQuery();
orderQuery.setIds(CollectionUtils.map(orderProdList, ReportOrderProdBO::getOrderId));
orderQuery.setNeedScope(true);
List<ProdOrderVO> orderList = prodOrderService.selectProdOrderList(orderQuery);
for (ReportOrderProdBO orderProd : orderProdList) {
if (orderProd == null || orderProd.getOrderId() == null) {
continue;
}
// 校验订单
ProdOrderVO order = orderList.stream().filter(item -> Objects.equals(item.getId(), orderProd.getOrderId())).findFirst().orElse(null);
ServiceUtil.assertion(order == null, "生产订单%s不存在");
}
}