优化,修改材料管理、机械管理相关代码逻辑
This commit is contained in:
		| @ -55,6 +55,16 @@ public class BusMachinery extends BaseEntity { | ||||
|      */ | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 供应商 | ||||
|      */ | ||||
|     private String provider; | ||||
|  | ||||
|     /** | ||||
|      * 备注 | ||||
|      */ | ||||
|  | ||||
| @ -0,0 +1,24 @@ | ||||
| package org.dromara.machinery.domain.enums; | ||||
|  | ||||
| import lombok.Getter; | ||||
|  | ||||
| /** | ||||
|  * @author lcj | ||||
|  * @date 2025/4/11 13:53 | ||||
|  */ | ||||
| @Getter | ||||
| public enum MaterialsInventoryOutputEnum { | ||||
|  | ||||
|     PUT("入库", "0"), | ||||
|     OUT("出库", "1"); | ||||
|  | ||||
|     private final String text; | ||||
|  | ||||
|     private final String value; | ||||
|  | ||||
|     MaterialsInventoryOutputEnum(String text, String value) { | ||||
|         this.text = text; | ||||
|         this.value = value; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -40,6 +40,16 @@ public class MachineryCreateReq implements Serializable { | ||||
|      */ | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 供应商 | ||||
|      */ | ||||
|     private String provider; | ||||
|  | ||||
|     /** | ||||
|      * 备注 | ||||
|      */ | ||||
|  | ||||
| @ -45,6 +45,16 @@ public class MachineryQueryReq implements Serializable { | ||||
|      */ | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 供应商 | ||||
|      */ | ||||
|     private String provider; | ||||
|  | ||||
|     /** | ||||
|      * 备注 | ||||
|      */ | ||||
|  | ||||
| @ -45,6 +45,16 @@ public class MachineryUpdateReq implements Serializable { | ||||
|      */ | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 供应商 | ||||
|      */ | ||||
|     private String provider; | ||||
|  | ||||
|     /** | ||||
|      * 备注 | ||||
|      */ | ||||
|  | ||||
| @ -61,6 +61,18 @@ public class BusMachineryVo implements Serializable { | ||||
|     @ExcelProperty(value = "负责人") | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     @ExcelProperty(value = "负责人电话") | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 供应商 | ||||
|      */ | ||||
|     @ExcelProperty(value = "供应商") | ||||
|     private String provider; | ||||
|  | ||||
|     /** | ||||
|      * 备注 | ||||
|      */ | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| package org.dromara.machinery.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.PhoneUtil; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| @ -103,7 +104,7 @@ public class BusMachineryServiceImpl extends ServiceImpl<BusMachineryMapper, Bus | ||||
|         BusMachinery machinery = new BusMachinery(); | ||||
|         BeanUtils.copyProperties(req, machinery); | ||||
|         // 数据校验 | ||||
|         validEntityBeforeSave(machinery); | ||||
|         validEntityBeforeSave(machinery, true); | ||||
|         // 操作数据库 | ||||
|         boolean save = this.save(machinery); | ||||
|         if (!save) { | ||||
| @ -124,7 +125,7 @@ public class BusMachineryServiceImpl extends ServiceImpl<BusMachineryMapper, Bus | ||||
|         BusMachinery machinery = new BusMachinery(); | ||||
|         BeanUtils.copyProperties(req, machinery); | ||||
|         // 数据校验 | ||||
|         validEntityBeforeSave(machinery); | ||||
|         validEntityBeforeSave(machinery, false); | ||||
|         // 判断是否存在 | ||||
|         BusMachinery oldMachinery = this.getById(machinery.getId()); | ||||
|         if (oldMachinery == null) { | ||||
| @ -137,18 +138,31 @@ public class BusMachineryServiceImpl extends ServiceImpl<BusMachineryMapper, Bus | ||||
|     /** | ||||
|      * 保存前的数据校验 | ||||
|      */ | ||||
|     private void validEntityBeforeSave(BusMachinery entity) { | ||||
|     private void validEntityBeforeSave(BusMachinery entity, Boolean create) { | ||||
|         // 做一些数据校验,如唯一约束 | ||||
|         Long projectId = entity.getProjectId(); | ||||
|         String machineryName = entity.getMachineryName(); | ||||
|         String principal = entity.getPrincipal(); | ||||
|         String principalPhone = entity.getPrincipalPhone(); | ||||
|         if (projectId == null) { | ||||
|             throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         if (create) { | ||||
|             if (StrUtil.isBlank(machineryName)) { | ||||
|                 throw new ServiceException("机械名称不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (StringUtils.isBlank(principal)) { | ||||
|                 throw new ServiceException("负责人不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (StringUtils.isBlank(principalPhone)) { | ||||
|                 throw new ServiceException("负责人手机号不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         if (projectService.getById(projectId) == null) { | ||||
|             throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         String machineryName = entity.getMachineryName(); | ||||
|         if (StrUtil.isBlank(machineryName)) { | ||||
|             throw new ServiceException("机械名称不能为空", HttpStatus.BAD_REQUEST); | ||||
|         if (StringUtils.isNotBlank(principalPhone) && !PhoneUtil.isPhone(principalPhone)) { | ||||
|             throw new ServiceException("负责人手机号格式不正确", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         // 判断用户是否对项目下的内容有操作权限 | ||||
|         Long userId = LoginHelper.getUserId(); | ||||
| @ -222,10 +236,14 @@ public class BusMachineryServiceImpl extends ServiceImpl<BusMachineryMapper, Bus | ||||
|         Long projectId = req.getProjectId(); | ||||
|         Long number = req.getNumber(); | ||||
|         String principal = req.getPrincipal(); | ||||
|         String principalPhone = req.getPrincipalPhone(); | ||||
|         String provider = req.getProvider(); | ||||
|         String remark = req.getRemark(); | ||||
|         // 模糊查询 | ||||
|         lqw.like(StringUtils.isNotBlank(machineryName), BusMachinery::getMachineryName, machineryName); | ||||
|         lqw.like(StringUtils.isNotBlank(principal), BusMachinery::getPrincipal, principal); | ||||
|         lqw.like(StringUtils.isNotBlank(principalPhone), BusMachinery::getPrincipalPhone, principalPhone); | ||||
|         lqw.like(StringUtils.isNotBlank(provider), BusMachinery::getProvider, provider); | ||||
|         lqw.like(StringUtils.isNotBlank(machineryNumber), BusMachinery::getMachineryNumber, machineryNumber); | ||||
|         lqw.like(StringUtils.isNotBlank(remark), BusMachinery::getRemark, remark); | ||||
|         // 精确查询 | ||||
|  | ||||
| @ -56,7 +56,7 @@ public class BusMaterialsInventoryController extends BaseController { | ||||
|     @PostMapping("/export") | ||||
|     public void export(MaterialsInventoryQueryReq req, HttpServletResponse response) { | ||||
|         List<BusMaterialsInventoryVo> list = busMaterialsInventoryService.queryList(req); | ||||
|         ExcelUtil.exportExcel(list, "材料出/入库", BusMaterialsInventoryVo.class, response); | ||||
|         ExcelUtil.exportExcel(list, "材料出入库", BusMaterialsInventoryVo.class, response); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|  | ||||
| @ -40,6 +40,16 @@ public class BusCompany extends BaseEntity { | ||||
|      */ | ||||
|     private Long projectId; | ||||
|  | ||||
|     /** | ||||
|      * 负责人 | ||||
|      */ | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 帐号状态(0正常 1停用) | ||||
|      */ | ||||
|  | ||||
| @ -25,6 +25,16 @@ public class CompanyCreateReq implements Serializable { | ||||
|      */ | ||||
|     private Long projectId; | ||||
|  | ||||
|     /** | ||||
|      * 负责人 | ||||
|      */ | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 备注 | ||||
|      */ | ||||
|  | ||||
| @ -30,6 +30,16 @@ public class CompanyQueryReq implements Serializable { | ||||
|      */ | ||||
|     private Long projectId; | ||||
|  | ||||
|     /** | ||||
|      * 负责人 | ||||
|      */ | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 帐号状态(0正常 1停用) | ||||
|      */ | ||||
|  | ||||
| @ -30,6 +30,16 @@ public class CompanyUpdateReq implements Serializable { | ||||
|      */ | ||||
|     private Long projectId; | ||||
|  | ||||
|     /** | ||||
|      * 负责人 | ||||
|      */ | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 帐号状态(0正常 1停用) | ||||
|      */ | ||||
|  | ||||
| @ -41,11 +41,6 @@ public class MaterialsInventoryCreateReq implements Serializable { | ||||
|      */ | ||||
|     private Date outPutTime; | ||||
|  | ||||
|     /** | ||||
|      * 剩余库存数量(记录最后一次操作留下的库存数) | ||||
|      */ | ||||
|     private Long residue; | ||||
|  | ||||
|     /** | ||||
|      * 操作人(入库人、领料人) | ||||
|      */ | ||||
|  | ||||
| @ -36,21 +36,11 @@ public class MaterialsInventoryUpdateReq implements Serializable { | ||||
|      */ | ||||
|     private String outPut; | ||||
|  | ||||
|     /** | ||||
|      * 出/入库的数量 | ||||
|      */ | ||||
|     private Long number; | ||||
|  | ||||
|     /** | ||||
|      * 出/入库操作时间 | ||||
|      */ | ||||
|     private Date outPutTime; | ||||
|  | ||||
|     /** | ||||
|      * 剩余库存数量(记录最后一次操作留下的库存数) | ||||
|      */ | ||||
|     private Long residue; | ||||
|  | ||||
|     /** | ||||
|      * 材料出入证明 | ||||
|      */ | ||||
|  | ||||
| @ -45,6 +45,18 @@ public class BusCompanyVo implements Serializable { | ||||
|     @ExcelProperty(value = "项目id") | ||||
|     private Long projectId; | ||||
|  | ||||
|     /** | ||||
|      * 负责人 | ||||
|      */ | ||||
|     @ExcelProperty(value = "负责人") | ||||
|     private String principal; | ||||
|  | ||||
|     /** | ||||
|      * 负责人电话 | ||||
|      */ | ||||
|     @ExcelProperty(value = "负责人电话") | ||||
|     private String principalPhone; | ||||
|  | ||||
|     /** | ||||
|      * 帐号状态(0正常 1停用) | ||||
|      */ | ||||
|  | ||||
| @ -4,8 +4,6 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||
| import com.alibaba.excel.annotation.ExcelProperty; | ||||
| import io.github.linpeilie.annotations.AutoMapper; | ||||
| import lombok.Data; | ||||
| import org.dromara.common.excel.annotation.ExcelDictFormat; | ||||
| import org.dromara.common.excel.convert.ExcelDictConvert; | ||||
| import org.dromara.materials.domain.BusMaterialsInventory; | ||||
|  | ||||
| import java.io.Serial; | ||||
| @ -40,10 +38,9 @@ public class BusMaterialsInventoryVo implements Serializable { | ||||
|     private Long materialsId; | ||||
|  | ||||
|     /** | ||||
|      * 材料信息 | ||||
|      * 材料名称 | ||||
|      */ | ||||
|     @ExcelProperty(value = "材料信息") | ||||
|     private BusMaterialsVo materialsVo; | ||||
|     private String materialsName; | ||||
|  | ||||
|     /** | ||||
|      * 项目id | ||||
| @ -60,27 +57,25 @@ public class BusMaterialsInventoryVo implements Serializable { | ||||
|     /** | ||||
|      * 出/入库的数量 | ||||
|      */ | ||||
|     @ExcelProperty(value = "出/入库的数量") | ||||
|     @ExcelProperty(value = "出入库的数量") | ||||
|     private Long number; | ||||
|  | ||||
|     /** | ||||
|      * 出/入库操作时间 | ||||
|      */ | ||||
|     @ExcelProperty(value = "出/入库操作时间") | ||||
|     @ExcelProperty(value = "出入库操作时间") | ||||
|     private Date outPutTime; | ||||
|  | ||||
|     /** | ||||
|      * 剩余库存数量(记录最后一次操作留下的库存数) | ||||
|      */ | ||||
|     @ExcelProperty(value = "剩余库存数量", converter = ExcelDictConvert.class) | ||||
|     @ExcelDictFormat(readConverterExp = "记录最后一次操作留下的库存数") | ||||
|     @ExcelProperty(value = "剩余库存数量") | ||||
|     private Long residue; | ||||
|  | ||||
|     /** | ||||
|      * 操作人(入库人、领料人) | ||||
|      */ | ||||
|     @ExcelProperty(value = "操作人", converter = ExcelDictConvert.class) | ||||
|     @ExcelDictFormat(readConverterExp = "入库人、领料人") | ||||
|     @ExcelProperty(value = "操作人") | ||||
|     private String operator; | ||||
|  | ||||
|     /** | ||||
| @ -98,8 +93,7 @@ public class BusMaterialsInventoryVo implements Serializable { | ||||
|     /** | ||||
|      * 交接单位(班组) | ||||
|      */ | ||||
|     @ExcelProperty(value = "交接单位", converter = ExcelDictConvert.class) | ||||
|     @ExcelDictFormat(readConverterExp = "班=组") | ||||
|     @ExcelProperty(value = "交接单位") | ||||
|     private String recipient; | ||||
|  | ||||
|     /** | ||||
|  | ||||
| @ -72,6 +72,14 @@ public interface IBusCompanyService extends IService<BusCompany> { | ||||
|      */ | ||||
|     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); | ||||
|  | ||||
|     /** | ||||
|      * 获取封装视图对象 | ||||
|      * | ||||
|      * @param company 实体对象 | ||||
|      * @return 封装视图对象 | ||||
|      */ | ||||
|     BusCompanyVo getVo(BusCompany company); | ||||
|  | ||||
|     /** | ||||
|      * 构建查询条件封装 | ||||
|      * | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| package org.dromara.materials.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.PhoneUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| @ -25,6 +26,7 @@ import org.dromara.project.service.IBusProjectService; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.context.annotation.Lazy; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
| @ -39,9 +41,6 @@ import java.util.List; | ||||
| public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusCompany> | ||||
|     implements IBusCompanyService { | ||||
|  | ||||
|     @Resource | ||||
|     private BusCompanyMapper baseMapper; | ||||
|  | ||||
|     @Resource | ||||
|     private IBusProjectService projectService; | ||||
|  | ||||
| @ -57,7 +56,11 @@ public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusComp | ||||
|      */ | ||||
|     @Override | ||||
|     public BusCompanyVo queryById(Long id) { | ||||
|         return baseMapper.selectVoById(id); | ||||
|         BusCompany company = this.getById(id); | ||||
|         if (company == null) { | ||||
|             throw new ServiceException("对应材料提供商不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         return this.getVo(company); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @ -83,7 +86,7 @@ public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusComp | ||||
|     @Override | ||||
|     public List<BusCompanyVo> queryList(CompanyQueryReq req) { | ||||
|         LambdaQueryWrapper<BusCompany> lqw = this.buildQueryWrapper(req); | ||||
|         return baseMapper.selectVoList(lqw); | ||||
|         return this.list(lqw).stream().map(this::getVo).toList(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @ -98,7 +101,12 @@ public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusComp | ||||
|         BusCompany company = new BusCompany(); | ||||
|         BeanUtils.copyProperties(req, company); | ||||
|         // 数据校验 | ||||
|         validEntityBeforeSave(company); | ||||
|         validEntityBeforeSave(company, true); | ||||
|         // 公司名不能重复 | ||||
|         Long count = this.lambdaQuery().eq(BusCompany::getCompanyName, req.getCompanyName()).count(); | ||||
|         if (count > 0) { | ||||
|             throw new ServiceException("公司名重复", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         // 写入数据库 | ||||
|         boolean save = this.save(company); | ||||
|         if (!save) { | ||||
| @ -119,12 +127,18 @@ public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusComp | ||||
|         BusCompany company = new BusCompany(); | ||||
|         BeanUtils.copyProperties(req, company); | ||||
|         // 数据校验 | ||||
|         validEntityBeforeSave(company); | ||||
|         validEntityBeforeSave(company, false); | ||||
|         // 判断是否存在 | ||||
|         BusCompany oldCompany = this.getById(company.getId()); | ||||
|         if (oldCompany == null) { | ||||
|             throw new ServiceException("修改公司失败,数据不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         if (!req.getCompanyName().equals(oldCompany.getCompanyName())) { | ||||
|             Long count = this.lambdaQuery().eq(BusCompany::getCompanyName, oldCompany.getCompanyName()).count(); | ||||
|             if (count > 0) { | ||||
|                 throw new ServiceException("公司名重复", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         // 操作数据库 | ||||
|         return this.updateById(company); | ||||
|     } | ||||
| @ -132,27 +146,33 @@ public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusComp | ||||
|     /** | ||||
|      * 保存前的数据校验 | ||||
|      */ | ||||
|     private void validEntityBeforeSave(BusCompany entity) { | ||||
|     private void validEntityBeforeSave(BusCompany entity, Boolean create) { | ||||
|         // 做一些数据校验,如唯一约束 | ||||
|         String companyName = entity.getCompanyName(); | ||||
|         Long projectId = entity.getProjectId(); | ||||
|         if (StringUtils.isBlank(companyName)) { | ||||
|             throw new ServiceException("公司名称不能为空", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         // 公司名不能重复 | ||||
|         LambdaQueryWrapper<BusCompany> queryWrapper = new LambdaQueryWrapper<>(); | ||||
|         queryWrapper.eq(BusCompany::getCompanyName, companyName); | ||||
|         long count = this.count(queryWrapper); | ||||
|         if (count > 0) { | ||||
|             throw new ServiceException("公司名重复", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         if (projectId == null) { | ||||
|             throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); | ||||
|         String principal = entity.getPrincipal(); | ||||
|         String principalPhone = entity.getPrincipalPhone(); | ||||
|         if (create) { | ||||
|             if (StringUtils.isBlank(principal)) { | ||||
|                 throw new ServiceException("负责人不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (StringUtils.isBlank(principalPhone)) { | ||||
|                 throw new ServiceException("负责人手机号不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (StringUtils.isBlank(companyName)) { | ||||
|                 throw new ServiceException("公司名称不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (projectId == null) { | ||||
|                 throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         // 查询项目是否存在 | ||||
|         if (projectService.getById(projectId) == null) { | ||||
|         if (projectId != null && projectService.getById(projectId) == null) { | ||||
|             throw new ServiceException("对应项目不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         if (StringUtils.isNotBlank(principalPhone) && !PhoneUtil.isPhone(principalPhone)) { | ||||
|             throw new ServiceException("负责人手机号格式不正确", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @ -163,6 +183,7 @@ public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusComp | ||||
|      * @return 是否删除成功 | ||||
|      */ | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { | ||||
|         // 获取当前登录用户 | ||||
|         Long userId = LoginHelper.getUserId(); | ||||
| @ -184,7 +205,24 @@ public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusComp | ||||
|         if (companyList.size() != ids.size()) { | ||||
|             throw new ServiceException("删除公司失败,数据缺失", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         return baseMapper.deleteByIds(ids) > 0; | ||||
|         return this.removeBatchByIds(ids); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取封装视图对象 | ||||
|      * | ||||
|      * @param company 实体对象 | ||||
|      * @return 封装视图对象 | ||||
|      */ | ||||
|     @Override | ||||
|     public BusCompanyVo getVo(BusCompany company) { | ||||
|         // 对象转封装类 | ||||
|         BusCompanyVo companyVo = new BusCompanyVo(); | ||||
|         if (company == null) { | ||||
|             return companyVo; | ||||
|         } | ||||
|         BeanUtils.copyProperties(company, companyVo); | ||||
|         return companyVo; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @ -203,11 +241,15 @@ public class BusCompanyServiceImpl extends ServiceImpl<BusCompanyMapper, BusComp | ||||
|         Long id = req.getId(); | ||||
|         String companyName = req.getCompanyName(); | ||||
|         Long projectId = req.getProjectId(); | ||||
|         String principal = req.getPrincipal(); | ||||
|         String principalPhone = req.getPrincipalPhone(); | ||||
|         String status = req.getStatus(); | ||||
|         String remark = req.getRemark(); | ||||
|         String qualification = req.getQualification(); | ||||
|         // 模糊查询 | ||||
|         lqw.like(StringUtils.isNotBlank(companyName), BusCompany::getCompanyName, companyName); | ||||
|         lqw.like(StringUtils.isNotBlank(principal), BusCompany::getPrincipal, principal); | ||||
|         lqw.like(StringUtils.isNotBlank(principalPhone), BusCompany::getPrincipalPhone, principalPhone); | ||||
|         lqw.like(StringUtils.isNotBlank(qualification), BusCompany::getQualification, qualification); | ||||
|         lqw.like(StringUtils.isNotBlank(remark), BusCompany::getRemark, remark); | ||||
|         // 精确查询 | ||||
|  | ||||
| @ -2,7 +2,7 @@ package org.dromara.materials.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
| import jakarta.annotation.Resource; | ||||
| @ -13,6 +13,7 @@ import org.dromara.common.core.utils.StringUtils; | ||||
| import org.dromara.common.mybatis.core.page.PageQuery; | ||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||
| import org.dromara.common.satoken.utils.LoginHelper; | ||||
| import org.dromara.machinery.domain.enums.MaterialsInventoryOutputEnum; | ||||
| import org.dromara.materials.domain.BusMaterials; | ||||
| import org.dromara.materials.domain.BusMaterialsInventory; | ||||
| import org.dromara.materials.domain.req.materialsinventory.MaterialsInventoryCreateReq; | ||||
| @ -25,10 +26,10 @@ import org.dromara.materials.service.IBusMaterialsService; | ||||
| import org.dromara.project.service.IBusProjectService; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import java.util.Collection; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| import java.util.*; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| /** | ||||
|  * 材料出/入库Service业务层处理 | ||||
| @ -40,9 +41,6 @@ import java.util.List; | ||||
| public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsInventoryMapper, BusMaterialsInventory> | ||||
|     implements IBusMaterialsInventoryService { | ||||
|  | ||||
|     @Resource | ||||
|     private BusMaterialsInventoryMapper baseMapper; | ||||
|  | ||||
|     @Resource | ||||
|     private IBusMaterialsService materialsService; | ||||
|  | ||||
| @ -102,7 +100,26 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|         BusMaterialsInventory materialsInventory = new BusMaterialsInventory(); | ||||
|         BeanUtils.copyProperties(req, materialsInventory); | ||||
|         // 数据校验 | ||||
|         validEntityBeforeSave(materialsInventory); | ||||
|         validEntityBeforeSave(materialsInventory, true); | ||||
|         // 获取最后一次库存数量 | ||||
|         BusMaterialsInventory lastMaterialsInventory = this.getOne(Wrappers.<BusMaterialsInventory>lambdaQuery() | ||||
|             .eq(BusMaterialsInventory::getMaterialsId, req.getMaterialsId()) | ||||
|             .eq(BusMaterialsInventory::getProjectId, req.getProjectId()) | ||||
|             .orderByDesc(BusMaterialsInventory::getCreateTime) | ||||
|             .last("limit 1")); | ||||
|         if (lastMaterialsInventory != null) { | ||||
|             if (MaterialsInventoryOutputEnum.OUT.getValue().equals(req.getOutPut())) { | ||||
|                 long left = lastMaterialsInventory.getResidue() - req.getNumber(); | ||||
|                 if (left < 0) { | ||||
|                     throw new ServiceException("库存不足", HttpStatus.BAD_REQUEST); | ||||
|                 } | ||||
|                 materialsInventory.setResidue(left); | ||||
|             } else { | ||||
|                 materialsInventory.setResidue(lastMaterialsInventory.getResidue() + req.getNumber()); | ||||
|             } | ||||
|         } else { | ||||
|             materialsInventory.setResidue(req.getNumber()); | ||||
|         } | ||||
|         // 操作数据库 | ||||
|         boolean save = this.save(materialsInventory); | ||||
|         if (!save) { | ||||
| @ -123,7 +140,7 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|         BusMaterialsInventory materialsInventory = new BusMaterialsInventory(); | ||||
|         BeanUtils.copyProperties(req, materialsInventory); | ||||
|         // 数据校验 | ||||
|         validEntityBeforeSave(materialsInventory); | ||||
|         validEntityBeforeSave(materialsInventory, false); | ||||
|         // 判断是否存在 | ||||
|         BusMaterialsInventory oldBusMaterialsInventory = this.getById(materialsInventory.getId()); | ||||
|         if (oldBusMaterialsInventory == null) { | ||||
| @ -136,25 +153,31 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|     /** | ||||
|      * 保存前的数据校验 | ||||
|      */ | ||||
|     private void validEntityBeforeSave(BusMaterialsInventory entity) { | ||||
|     private void validEntityBeforeSave(BusMaterialsInventory entity, Boolean create) { | ||||
|         Long materialsId = entity.getMaterialsId(); | ||||
|         Long projectId = entity.getProjectId(); | ||||
|         String outPut = entity.getOutPut(); | ||||
|         if (materialsId == null) { | ||||
|             throw new ServiceException("材料信息 id 不能为空", HttpStatus.BAD_REQUEST); | ||||
|         Long number = entity.getNumber(); | ||||
|         if (projectId == null) { | ||||
|             throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         if (create) { | ||||
|             if (number == null) { | ||||
|                 throw new ServiceException("出/入库数量不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (materialsId == null) { | ||||
|                 throw new ServiceException("材料信息 id 不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (StringUtils.isEmpty(outPut)) { | ||||
|                 throw new ServiceException("出入库状态不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         if (materialsService.getById(materialsId) == null) { | ||||
|             throw new ServiceException("对应材料信息不存在", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         if (projectId == null) { | ||||
|             throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         if (projectService.getById(projectId) == null) { | ||||
|             throw new ServiceException("对应项目不存在", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         if (StringUtils.isEmpty(outPut)) { | ||||
|             throw new ServiceException("出入库状态不能为空", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @ -165,6 +188,7 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|      * @return 是否删除成功 | ||||
|      */ | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { | ||||
|         // 获取当前登录用户 | ||||
|         Long userId = LoginHelper.getUserId(); | ||||
| @ -180,7 +204,7 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|         if (materialsInventoryList.size() != ids.size()) { | ||||
|             throw new ServiceException("删除材料出/入库失败,数据缺失", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         return baseMapper.deleteByIds(ids) > 0; | ||||
|         return this.removeBatchByIds(ids); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @ -197,10 +221,10 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|             return materialsInventoryVo; | ||||
|         } | ||||
|         BeanUtils.copyProperties(materialsInventory, materialsInventoryVo); | ||||
|         // 关联查询项目信息 | ||||
|         // 关联查询材料信息 | ||||
|         Long materialsId = materialsInventory.getMaterialsId(); | ||||
|         if (materialsId != null) { | ||||
|             materialsInventoryVo.setMaterialsVo(materialsService.queryById(materialsId)); | ||||
|             materialsInventoryVo.setMaterialsName(materialsService.queryById(materialsId).getMaterialsName()); | ||||
|         } | ||||
|         return materialsInventoryVo; | ||||
|     } | ||||
| @ -233,9 +257,9 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|         String remark = req.getRemark(); | ||||
|         // 联表查询 | ||||
|         if (StringUtils.isNotBlank(materialsName)) { | ||||
|             QueryWrapper<BusMaterials> materialsQueryWrapper = new QueryWrapper<>(); | ||||
|             materialsQueryWrapper.select("id"); | ||||
|             materialsQueryWrapper.like("materials_name", materialsName); | ||||
|             LambdaQueryWrapper<BusMaterials> materialsQueryWrapper = Wrappers.lambdaQuery(BusMaterials.class) | ||||
|                 .select(BusMaterials::getId) | ||||
|                 .like(BusMaterials::getMaterialsName, materialsName); | ||||
|             List<Long> materialsIdList = materialsService.listObjs(materialsQueryWrapper, obj -> (Long) obj); | ||||
|             lqw.in(BusMaterialsInventory::getMaterialsId, materialsIdList); | ||||
|         } | ||||
| @ -253,6 +277,8 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(outPutTime), BusMaterialsInventory::getOutPutTime, outPutTime); | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(residue), BusMaterialsInventory::getResidue, residue); | ||||
|         lqw.eq(ObjectUtils.isNotEmpty(outPut), BusMaterialsInventory::getOutPut, outPut); | ||||
|         // 排序 | ||||
|         lqw.orderByDesc(BusMaterialsInventory::getCreateTime); | ||||
|         return lqw; | ||||
|     } | ||||
|  | ||||
| @ -272,8 +298,23 @@ public class BusMaterialsInventoryServiceImpl extends ServiceImpl<BusMaterialsIn | ||||
|         if (CollUtil.isEmpty(materialsInventoryList)) { | ||||
|             return materialsInventoryVoPage; | ||||
|         } | ||||
|         // 获取材料id列表 | ||||
|         Set<Long> materialsIdList = materialsInventoryList.stream().map(BusMaterialsInventory::getMaterialsId).collect(Collectors.toSet()); | ||||
|         Map<Long, List<BusMaterials>> materialsIdBusMaterialsMap = materialsService.listByIds(materialsIdList).stream() | ||||
|             .collect(Collectors.groupingBy(BusMaterials::getId)); | ||||
|         // 对象列表 => 封装对象列表 | ||||
|         List<BusMaterialsInventoryVo> materialsInventoryVoList = materialsInventoryList.stream().map(this::getVo).toList(); | ||||
|         List<BusMaterialsInventoryVo> materialsInventoryVoList = materialsInventoryList.stream().map(materialsInventory -> { | ||||
|             BusMaterialsInventoryVo materialsInventoryVo = new BusMaterialsInventoryVo(); | ||||
|             BeanUtils.copyProperties(materialsInventory, materialsInventoryVo); | ||||
|             // 关联查询材料信息 | ||||
|             Long materialsId = materialsInventory.getMaterialsId(); | ||||
|             String materialsName = null; | ||||
|             if (materialsIdBusMaterialsMap.containsKey(materialsId)) { | ||||
|                 materialsName = materialsIdBusMaterialsMap.get(materialsId).get(0).getMaterialsName(); | ||||
|             } | ||||
|             materialsInventoryVo.setMaterialsName(materialsName); | ||||
|             return materialsInventoryVo; | ||||
|         }).toList(); | ||||
|         materialsInventoryVoPage.setRecords(materialsInventoryVoList); | ||||
|         return materialsInventoryVoPage; | ||||
|     } | ||||
|  | ||||
| @ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
| import jakarta.annotation.Resource; | ||||
| import lombok.RequiredArgsConstructor; | ||||
| import org.dromara.common.core.constant.HttpStatus; | ||||
| import org.dromara.common.core.exception.ServiceException; | ||||
| import org.dromara.common.core.utils.ObjectUtils; | ||||
| @ -43,14 +42,10 @@ import java.util.Map; | ||||
|  * @author lcj | ||||
|  * @date 2025-03-06 | ||||
|  */ | ||||
| @RequiredArgsConstructor | ||||
| @Service | ||||
| public class BusMaterialsServiceImpl extends ServiceImpl<BusMaterialsMapper, BusMaterials> | ||||
|     implements IBusMaterialsService { | ||||
|  | ||||
|     @Resource | ||||
|     private BusMaterialsMapper baseMapper; | ||||
|  | ||||
|     @Resource | ||||
|     private IBusCompanyService companyService; | ||||
|  | ||||
|  | ||||
| @ -1,6 +1,8 @@ | ||||
| package org.dromara.project.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.IdcardUtil; | ||||
| import cn.hutool.core.util.PhoneUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| @ -485,6 +487,8 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU | ||||
|         Long contractorId = entity.getContractorId(); | ||||
|         String typeOfWork = entity.getTypeOfWork(); | ||||
|         String wageMeasureUnit = entity.getWageMeasureUnit(); | ||||
|         String phone = entity.getPhone(); | ||||
|         String sfzNumber = entity.getSfzNumber(); | ||||
|         if (projectId == null) { | ||||
|             throw new ServiceException("项目 id 不能为空", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
| @ -522,6 +526,12 @@ public class BusConstructionUserServiceImpl extends ServiceImpl<BusConstructionU | ||||
|                 throw new ServiceException("当前工种没有定义工资标准,请前往工种薪水设置进行设置后再选择", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         if (StringUtils.isNotEmpty(phone) && !PhoneUtil.isPhone(phone)) { | ||||
|             throw new ServiceException("手机号码格式不正确", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         if (StringUtils.isNotEmpty(sfzNumber) && !IdcardUtil.isValidCard(sfzNumber)) { | ||||
|             throw new ServiceException("身份证号码格式不正确", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| package org.dromara.project.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.PhoneUtil; | ||||
| import cn.hutool.json.JSONObject; | ||||
| import cn.hutool.json.JSONUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| @ -109,6 +110,10 @@ public class BusContractorServiceImpl extends ServiceImpl<BusContractorMapper, B | ||||
|         contractor.setFiles(fileMapStr); | ||||
|         // 数据校验 | ||||
|         validEntityBeforeSave(contractor, true); | ||||
|         Long count = this.lambdaQuery().eq(BusContractor::getName, req.getName()).count(); | ||||
|         if (count > 0) { | ||||
|             throw new ServiceException("分包单位名称重复", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         // 操作数据库 | ||||
|         boolean save = this.save(contractor); | ||||
|         if (!save) { | ||||
| @ -139,6 +144,13 @@ public class BusContractorServiceImpl extends ServiceImpl<BusContractorMapper, B | ||||
|         if (oldContractor == null) { | ||||
|             throw new ServiceException("修改施工人员失败,数据不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         // 判断名称是否重复 | ||||
|         if (!oldContractor.getName().equals(req.getName())) { | ||||
|             Long count = this.lambdaQuery().eq(BusContractor::getName, req.getName()).count(); | ||||
|             if (count > 0) { | ||||
|                 throw new ServiceException("分包单位名称重复", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         // 操作数据库 | ||||
|         return this.updateById(contractor); | ||||
|     } | ||||
| @ -146,17 +158,28 @@ public class BusContractorServiceImpl extends ServiceImpl<BusContractorMapper, B | ||||
|     /** | ||||
|      * 保存前的数据校验 | ||||
|      */ | ||||
|     private void validEntityBeforeSave(BusContractor entity, Boolean add) { | ||||
|     private void validEntityBeforeSave(BusContractor entity, Boolean create) { | ||||
|         // 做一些数据校验,如唯一约束 | ||||
|         if (add) { | ||||
|             String name = entity.getName(); | ||||
|         String name = entity.getName(); | ||||
|         String principal = entity.getPrincipal(); | ||||
|         String principalPhone = entity.getPrincipalPhone(); | ||||
|         String custodianPhone = entity.getCustodianPhone(); | ||||
|         if (create) { | ||||
|             if (StringUtils.isBlank(name)) { | ||||
|                 throw new ServiceException("分包单位名称不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             String principal = entity.getPrincipal(); | ||||
|             if (StringUtils.isBlank(principal)) { | ||||
|                 throw new ServiceException("分包单位负责人不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (StringUtils.isBlank(principalPhone)) { | ||||
|                 throw new ServiceException("分包单位负责人手机号不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         if (StringUtils.isNotBlank(principalPhone) && !PhoneUtil.isPhone(principalPhone)) { | ||||
|             throw new ServiceException("负责人手机号格式不正确", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         if (StringUtils.isNotBlank(custodianPhone) && !PhoneUtil.isPhone(custodianPhone)) { | ||||
|             throw new ServiceException("管理人手机号格式不正确", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| package org.dromara.project.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.PhoneUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| @ -150,6 +151,10 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj | ||||
|         project.setPunchRange(punchRange); | ||||
|         // 数据校验 | ||||
|         validEntityBeforeSave(project, true); | ||||
|         Long count = this.lambdaQuery().eq(BusProject::getProjectName, req.getProjectName()).count(); | ||||
|         if (count > 0) { | ||||
|             throw new ServiceException("项目名称已存在", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|         // 写入数据库 | ||||
|         boolean save = this.save(project); | ||||
|         if (!save) { | ||||
| @ -200,6 +205,13 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj | ||||
|         if (oldProject == null) { | ||||
|             throw new ServiceException("修改项目失败,数据不存在", HttpStatus.NOT_FOUND); | ||||
|         } | ||||
|         // 判断名称是否重复 | ||||
|         if (!req.getProjectName().equals(oldProject.getProjectName())) { | ||||
|             Long count = this.lambdaQuery().eq(BusProject::getProjectName, req.getProjectName()).count(); | ||||
|             if (count > 0) { | ||||
|                 throw new ServiceException("项目名称重复", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         // 操作数据库 | ||||
|         return this.updateById(project); | ||||
|     } | ||||
| @ -210,11 +222,18 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj | ||||
|     private void validEntityBeforeSave(BusProject entity, Boolean create) { | ||||
|         // TODO 做一些数据校验,如唯一约束 | ||||
|         String projectName = entity.getProjectName(); | ||||
|         String principalPhone = entity.getPrincipalPhone(); | ||||
|         // 新增项目参数验证 | ||||
|         if (create) { | ||||
|             if (StringUtils.isBlank(projectName)) { | ||||
|                 throw new ServiceException("项目名称不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|             if (StringUtils.isBlank(principalPhone)) { | ||||
|                 throw new ServiceException("负责人电话不能为空", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|         } | ||||
|         if (StringUtils.isNotBlank(principalPhone) && !PhoneUtil.isPhone(principalPhone)) { | ||||
|             throw new ServiceException("负责人手机号格式不正确", HttpStatus.BAD_REQUEST); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user