| | |
| | | package com.product.base.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.product.base.config.BaseErrorCode; |
| | | import com.product.base.config.CmnConst; |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.DataTableEntity; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.core.service.support.AbstractBaseService; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.module.sys.entity.SystemUser; |
| | |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * 获取材料信息 |
| | | * @param uuid |
| | | * @return |
| | | */ |
| | | public FieldSetEntity getMaterialInfo(String uuid) { |
| | | return baseDao.getFieldSet(CmnConst.PRODUCT_PROJECT_BASE_MATERIAL, uuid, false); |
| | | } |
| | | |
| | | /** |
| | | * 保存材料信息 |
| | |
| | | * @return |
| | | */ |
| | | public boolean saveMaterialInfo(FieldSetEntity fse) { |
| | | |
| | | //验重条件 |
| | | String filter = "material_code=?"; |
| | | List<String> param = new ArrayList<>(); |
| | | param.add(fse.getString(CmnConst.MATERIAL_CODE)); |
| | | |
| | | SystemUser sysUser = SpringMVCContextHolder.getCurrentUser(); |
| | | if (BaseUtil.strIsNull(fse.getUUID())) { |
| | | BaseUtil.createCreatorAndCreationTime(sysUser, fse); |
| | | }else { |
| | | filter += " AND uuid !=?"; |
| | | param.add(fse.getUUID()); |
| | | BaseUtil.updatedRegeneratorAndUpdateTime(sysUser, fse); |
| | | } |
| | | return baseDao.saveFieldSetEntity(fse); |
| | | FieldSetEntity fseExistMaterialCode = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_PROJECT_BASE_MATERIAL, filter, param.toArray(), false); |
| | | if (fseExistMaterialCode!=null) { |
| | | throw new BaseException(BaseErrorCode.PROJECT_BASE_MATERIAL_CODE_REPEAT.getValue(), BaseErrorCode.PROJECT_BASE_MATERIAL_CODE_REPEAT.getText()); |
| | | } |
| | | |
| | | /** |
| | | * 删除材料信息 |
| | | * @param uuid |
| | | * @return |
| | | */ |
| | | public boolean deleteMaterialInfo(String uuid) { |
| | | Object [] uuids= uuid.split(","); |
| | | return baseDao.delete(CmnConst.PRODUCT_PROJECT_BASE_MATERIAL, "uuid=?", uuids); |
| | | return baseDao.saveFieldSetEntity(fse); |
| | | } |
| | | } |