diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/ConsumablesInfo.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/ConsumablesInfo.java new file mode 100644 index 00000000..0c60bc9a --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/ConsumablesInfo.java @@ -0,0 +1,44 @@ +package me.zhengjie.modules.wms.bd.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import lombok.Data; +import org.hibernate.annotations.CreationTimestamp; + +import javax.persistence.*; +import java.io.Serializable; +import java.sql.Timestamp; + +/** +* @author jie +* @date 2019-10-05 +*/ +@Entity +@Data +@Table(name="bd_consumables_info") +public class ConsumablesInfo implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "create_time") + @CreationTimestamp + private Timestamp createTime; + + @Column(name = "update_time") + @CreationTimestamp + private Timestamp updateTime; + + // 耗材名称 + @Column(name = "consumables_name") + private String consumablesName; + + @Column(name = "status") + private Boolean status; + + public void copy(ConsumablesInfo source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/ConsumablesInfoRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/ConsumablesInfoRepository.java new file mode 100644 index 00000000..2a95b768 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/ConsumablesInfoRepository.java @@ -0,0 +1,57 @@ +package me.zhengjie.modules.wms.bd.repository; + +import me.zhengjie.modules.wms.bd.domain.ConsumablesInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; + +/** +* @author jie +* @date 2019-10-05 +*/ +public interface ConsumablesInfoRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 根据主键查询状态正常的计量单位 + * @param id + * @return + */ + ConsumablesInfo findByIdAndStatusTrue(long id); + + /** + * 根据name查询状态正常的计量单位 + * @param consumablesName + * @return + */ + ConsumablesInfo findByConsumablesNameAndStatusTrue(String consumablesName); + + /** + * 根据name查询状态删除的计量单位 + * @param consumablesName + * @return + */ + ConsumablesInfo findByConsumablesNameAndStatusFalse(String consumablesName); + + + @Modifying + @Query(value = "update bd_consumables_info set status = 1 where id = ?1",nativeQuery = true) + void updateStatusToTrue(long id); + + /** + * 删除计量单位(逻辑删除) + * @param id + */ + @Modifying + @Query(value = "update bd_consumables_info set status = 0 where id = ?1",nativeQuery = true) + void deleteConsumablesInfo(long id); + + /** + * 修改计量单位名称 + * @param name + * @param id + */ + @Modifying + @Query(value = "update bd_consumables_info set consumables_name = ?1 where id = ?2",nativeQuery = true) + void updateNameById(String name, long id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/ConsumablesInfoController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/ConsumablesInfoController.java new file mode 100644 index 00000000..a3617f3c --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/ConsumablesInfoController.java @@ -0,0 +1,75 @@ +package me.zhengjie.modules.wms.bd.rest; + +import me.zhengjie.aop.log.Log; +import me.zhengjie.modules.wms.bd.domain.ConsumablesInfo; +import me.zhengjie.modules.wms.bd.service.ConsumablesInfoService; +import me.zhengjie.modules.wms.bd.service.dto.ConsumablesInfoQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +/** +* @author jie +* @date 2019-10-05 +*/ +@Api(tags = "耗材管理") +@RestController +@RequestMapping("api") +public class ConsumablesInfoController { + + @Autowired + private ConsumablesInfoService consumablesInfoService; + + @Log("分页查询耗材列表") + @ApiOperation(value = "分页查询耗材列表") + @GetMapping(value = "/queryConsumablesInfoPageList") + @PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_SELECT')") + public ResponseEntity queryConsumablesInfoPageList(ConsumablesInfoQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(consumablesInfoService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("分页查询耗材列表") + @ApiOperation(value = "分页查询耗材列表") + @GetMapping(value = "/queryConsumablesInfoList") + @PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_SELECT')") + public ResponseEntity queryConsumablesInfoList(ConsumablesInfoQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(consumablesInfoService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增耗材") + @ApiOperation(value = "新增耗材") + @PostMapping(value = "/consumablesInfo") + @PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_CREATE')") + public ResponseEntity create(@Validated @RequestBody ConsumablesInfo resources){ + return new ResponseEntity(consumablesInfoService.create(resources),HttpStatus.CREATED); + } + + @Log("修改耗材信息") + @ApiOperation(value = "修改耗材信息") + @PutMapping(value = "/consumablesInfo") + @PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_EDIT')") + public ResponseEntity update(@Validated @RequestBody ConsumablesInfo resources){ + consumablesInfoService.update(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除耗材") + @ApiOperation(value = "删除耗材") + @DeleteMapping(value = "/consumablesInfo/{id}") + @PreAuthorize("hasAnyRole('ADMIN','BDCONSUMABLESINFO_ALL','BDCONSUMABLESINFO_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + consumablesInfoService.delete(id); + return new ResponseEntity(HttpStatus.OK); + } + + @Log("查看耗材详情") + @GetMapping(value = "/consumablesInfo/{id}") + public ResponseEntity getConsumablesInfo(@PathVariable Long id){ + return new ResponseEntity(consumablesInfoService.findById(id), HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/ConsumablesInfoService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/ConsumablesInfoService.java new file mode 100644 index 00000000..6fb11d10 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/ConsumablesInfoService.java @@ -0,0 +1,61 @@ +package me.zhengjie.modules.wms.bd.service; + +import me.zhengjie.modules.wms.bd.domain.ConsumablesInfo; +import me.zhengjie.modules.wms.bd.service.dto.ConsumablesInfoDTO; +import me.zhengjie.modules.wms.bd.service.dto.ConsumablesInfoQueryCriteria; +import org.springframework.data.domain.Pageable; + +/** +* @author jie +* @date 2019-10-05 +*/ +//@CacheConfig(cacheNames = "bdConsumablesInfo") +public interface ConsumablesInfoService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(ConsumablesInfoQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(ConsumablesInfoQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + ConsumablesInfoDTO findById(Long id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + ConsumablesInfoDTO create(ConsumablesInfo resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(ConsumablesInfo resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Long id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ConsumablesInfoDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ConsumablesInfoDTO.java new file mode 100644 index 00000000..e8184191 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ConsumablesInfoDTO.java @@ -0,0 +1,25 @@ +package me.zhengjie.modules.wms.bd.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author jie +* @date 2019-10-05 +*/ +@Data +public class ConsumablesInfoDTO implements Serializable { + + private Long id; + + private Timestamp createTime; + + private Timestamp updateTime; + + // 耗材名称 + private String consumablesName; + + private Boolean status; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ConsumablesInfoQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ConsumablesInfoQueryCriteria.java new file mode 100644 index 00000000..3ae0fc4d --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ConsumablesInfoQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.bd.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author jie +* @date 2019-10-05 +*/ +@Data +public class ConsumablesInfoQueryCriteria { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/ConsumablesInfoServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/ConsumablesInfoServiceImpl.java new file mode 100644 index 00000000..3829543b --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/ConsumablesInfoServiceImpl.java @@ -0,0 +1,125 @@ +package me.zhengjie.modules.wms.bd.service.impl; + +import me.zhengjie.exception.BadRequestException; +import me.zhengjie.modules.wms.bd.domain.ConsumablesInfo; +import me.zhengjie.modules.wms.bd.domain.MeasureUnit; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.bd.repository.ConsumablesInfoRepository; +import me.zhengjie.modules.wms.bd.service.ConsumablesInfoService; +import me.zhengjie.modules.wms.bd.service.dto.ConsumablesInfoDTO; +import me.zhengjie.modules.wms.bd.service.dto.ConsumablesInfoQueryCriteria; +import me.zhengjie.modules.wms.bd.service.mapper.ConsumablesInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; +import org.springframework.util.CollectionUtils; + +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +/** +* @author jie +* @date 2019-10-05 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class ConsumablesInfoServiceImpl implements ConsumablesInfoService { + + @Autowired + private ConsumablesInfoRepository consumablesInfoRepository; + + @Autowired + private ConsumablesInfoMapper consumablesInfoMapper; + + @Override + public Object queryAll(ConsumablesInfoQueryCriteria criteria, Pageable pageable){ + Specification specification = new Specification() { + @Override + public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder criteriaBuilder) { + + List targetPredicateList = new ArrayList<>(); + + //状态 + Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1); + targetPredicateList.add(statusPredicate); + + if(CollectionUtils.isEmpty(targetPredicateList)){ + return null; + }else{ + return criteriaBuilder.and(targetPredicateList.toArray(new Predicate[targetPredicateList.size()])); + } + } + }; + + Page page = consumablesInfoRepository.findAll(specification, pageable); + return PageUtil.toPage(page.map(consumablesInfoMapper::toDto)); + } + + @Override + public Object queryAll(ConsumablesInfoQueryCriteria criteria){ + return consumablesInfoMapper.toDto(consumablesInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public ConsumablesInfoDTO findById(Long id) { + Optional bdConsumablesInfo = consumablesInfoRepository.findById(id); + ValidationUtil.isNull(bdConsumablesInfo,"BdConsumablesInfo","id",id); + return consumablesInfoMapper.toDto(bdConsumablesInfo.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ConsumablesInfoDTO create(ConsumablesInfo resources) { + + /** + * 查看状态正常的情况下该耗材是否存在,如果存在,则提示材已存在 + * 查看删除状态下该名字的材,如果材存在,则修改材状态 + * 否则直接插入新的记录 + */ + ConsumablesInfo byNameAndStatusTrue = consumablesInfoRepository.findByConsumablesNameAndStatusTrue(resources.getConsumablesName()); + if(null != byNameAndStatusTrue){ + throw new BadRequestException("该耗材已经存在"); + } + ConsumablesInfo byNameAndStatusFalse = consumablesInfoRepository.findByConsumablesNameAndStatusFalse(resources.getConsumablesName()); + if(null != byNameAndStatusFalse){ + resources.setStatus(true); + consumablesInfoRepository.updateStatusToTrue(byNameAndStatusFalse.getId()); + Optional measureUnitOptional = consumablesInfoRepository.findById(byNameAndStatusFalse.getId()); + ConsumablesInfo consumablesInfo = measureUnitOptional.get(); + return consumablesInfoMapper.toDto(consumablesInfo); + }else{ + resources.getConsumablesName(); + resources.setStatus(true); + ConsumablesInfo consumablesInfo = consumablesInfoRepository.save(resources); + return consumablesInfoMapper.toDto(consumablesInfo); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ConsumablesInfo resources) { + Optional optionalBdConsumablesInfo = consumablesInfoRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalBdConsumablesInfo,"BdConsumablesInfo","id",resources.getId()); + ConsumablesInfo bdConsumablesInfo = optionalBdConsumablesInfo.get(); + bdConsumablesInfo.copy(resources); + consumablesInfoRepository.save(bdConsumablesInfo); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + consumablesInfoRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/ConsumablesInfoMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/ConsumablesInfoMapper.java new file mode 100644 index 00000000..04195cea --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/ConsumablesInfoMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.bd.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.bd.domain.ConsumablesInfo; +import me.zhengjie.modules.wms.bd.service.dto.ConsumablesInfoDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author jie +* @date 2019-10-05 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ConsumablesInfoMapper extends EntityMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/domain/OutSourceInspectionCertificate.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/domain/OutSourceInspectionCertificate.java new file mode 100644 index 00000000..69780a1e --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/domain/OutSourceInspectionCertificate.java @@ -0,0 +1,56 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Entity +@Data +@Table(name="s_out_source_inspection_certificate") +public class OutSourceInspectionCertificate implements Serializable { + + // 主键 + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "create_time") + private Timestamp createTime; + + @Column(name = "update_time") + private Timestamp updateTime; + + @Column(name = "status") + private Integer status; + + // 所属委外加工单 + @Column(name = "out_source_process_sheet_id") + private Long outSourceProcessSheetId; + + // 制单人 + @Column(name = "make_people_id") + private Long makePeopleId; + + // 制单人姓名 + @Column(name = "make_people_name") + private String makePeopleName; + + // 委外加工验收单单据编号 + @Column(name = "out_source_inspection_certificate_code") + private String outSourceInspectionCertificateCode; + + @Column(name = "remark") + private String remark; + + public void copy(OutSourceInspectionCertificate source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/domain/OutSourceInspectionCertificateProduct.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/domain/OutSourceInspectionCertificateProduct.java new file mode 100644 index 00000000..2744a546 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/domain/OutSourceInspectionCertificateProduct.java @@ -0,0 +1,53 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Entity +@Data +@Table(name="s_out_source_inspection_certificate_product") +public class OutSourceInspectionCertificateProduct implements Serializable { + + // 主键 + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "create_time") + private Timestamp createTime; + + @Column(name = "update_time") + private Timestamp updateTime; + + @Column(name = "status") + private Integer status; + + // 所属委外验收单 + @Column(name = "out_source_inspection_certificate_id") + private Long outSourceInspectionCertificateId; + + @Column(name = "product_code") + private String productCode; + + @Column(name = "product_id") + private Long productId; + + @Column(name = "product_name") + private String productName; + + @Column(name = "remark") + private String remark; + + public void copy(OutSourceInspectionCertificateProduct source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceInspectionCertificateProductRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceInspectionCertificateProductRepository.java new file mode 100644 index 00000000..bc9fa20a --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceInspectionCertificateProductRepository.java @@ -0,0 +1,12 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.repository; + +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificateProduct; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author jie +* @date 2019-10-01 +*/ +public interface OutSourceInspectionCertificateProductRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceInspectionCertificateRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceInspectionCertificateRepository.java new file mode 100644 index 00000000..9cc5fed8 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceInspectionCertificateRepository.java @@ -0,0 +1,12 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.repository; + +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificate; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author jie +* @date 2019-10-01 +*/ +public interface OutSourceInspectionCertificateRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceProcessSheetProductRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceProcessSheetProductRepository.java index f7392fd9..0a6eeb63 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceProcessSheetProductRepository.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/repository/OutSourceProcessSheetProductRepository.java @@ -23,8 +23,6 @@ public interface OutSourceProcessSheetProductRepository extends JpaRepository queryByOutSourceProcessSheetIdAndStatusTrue(Long outSourceProcessSheetId); - List findByOutSourceProcessSheetIdAndStatusTrue(Long invoiceId); - @Modifying @Query(value = "delete s_out_source_process_sheet_product where product_code = ?1 and out_source_process_sheet_id = ?2", nativeQuery = true) void deleteByProductCodeAndOutSourceProcessSheetId(String productCode, Long outSourceProcessSheetId); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/request/QueryOutSourceProcessSheetProductRequest.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/request/QueryOutSourceProcessSheetProductRequest.java new file mode 100644 index 00000000..0e6616d9 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/request/QueryOutSourceProcessSheetProductRequest.java @@ -0,0 +1,15 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.request; + +import lombok.Data; + +/** + * @author 黄星星 + * @date 2019-10-01 + * 查询委外加工单产品信息 + */ +@Data +public class QueryOutSourceProcessSheetProductRequest { + + // 所属委外加工单 + private Long outSourceProcessSheetId; +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/rest/OutSourceInspectionCertificateController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/rest/OutSourceInspectionCertificateController.java new file mode 100644 index 00000000..0cdb341f --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/rest/OutSourceInspectionCertificateController.java @@ -0,0 +1,68 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.rest; + +import me.zhengjie.aop.log.Log; +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificate; +import me.zhengjie.modules.wms.outSourceProductSheet.service.OutSourceInspectionCertificateService; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Api(tags = "委外验收单管理") +@RestController +@RequestMapping("api") +public class OutSourceInspectionCertificateController { + + @Autowired + private OutSourceInspectionCertificateService outSourceInspectionCertificateService; + + @Log("查询委外验收单") + @ApiOperation(value = "查询委外验收单") + @GetMapping(value = "/outSourceInspectionCertificate") + @PreAuthorize("hasAnyRole('ADMIN','SOUTSOURCEINSPECTIONCERTIFICATE_ALL','SOUTSOURCEINSPECTIONCERTIFICATE_SELECT')") + public ResponseEntity getOutSourceInspectionCertificates(OutSourceInspectionCertificateQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(outSourceInspectionCertificateService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增委外验收单") + @ApiOperation(value = "新增委外验收单") + @PostMapping(value = "/outSourceInspectionCertificate") + @PreAuthorize("hasAnyRole('ADMIN','SOUTSOURCEINSPECTIONCERTIFICATE_ALL','SOUTSOURCEINSPECTIONCERTIFICATE_CREATE')") + public ResponseEntity create(@Validated @RequestBody OutSourceInspectionCertificate resources){ + return new ResponseEntity(outSourceInspectionCertificateService.create(resources),HttpStatus.CREATED); + } + + @Log("修改委外验收单") + @ApiOperation(value = "修改委外验收单") + @PutMapping(value = "/outSourceInspectionCertificate") + @PreAuthorize("hasAnyRole('ADMIN','SOUTSOURCEINSPECTIONCERTIFICATE_ALL','SOUTSOURCEINSPECTIONCERTIFICATE_EDIT')") + public ResponseEntity update(@Validated @RequestBody OutSourceInspectionCertificate resources){ + outSourceInspectionCertificateService.update(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除委外验收单") + @ApiOperation(value = "删除委外验收单") + @DeleteMapping(value = "/outSourceInspectionCertificate/{id}") + @PreAuthorize("hasAnyRole('ADMIN','SOUTSOURCEINSPECTIONCERTIFICATE_ALL','SOUTSOURCEINSPECTIONCERTIFICATE_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + outSourceInspectionCertificateService.delete(id); + return new ResponseEntity(HttpStatus.OK); + } + + @Log("查看委外验收单详情") + @GetMapping(value = "/outSourceInspectionCertificate/{id}") + public ResponseEntity getOutSourceInspectionCertificate(@PathVariable Long id){ + return new ResponseEntity(outSourceInspectionCertificateService.findById(id), HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/rest/OutSourceProcessSheetController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/rest/OutSourceProcessSheetController.java index 316f5f93..86a2d94a 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/rest/OutSourceProcessSheetController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/rest/OutSourceProcessSheetController.java @@ -3,8 +3,11 @@ package me.zhengjie.modules.wms.outSourceProductSheet.rest; import me.zhengjie.aop.log.Log; import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceProcessSheet; import me.zhengjie.modules.wms.outSourceProductSheet.request.CreateOutSourceProcessSheetRequest; +import me.zhengjie.modules.wms.outSourceProductSheet.request.QueryOutSourceProcessSheetProductRequest; import me.zhengjie.modules.wms.outSourceProductSheet.request.UpdateOutSourceProcessSheetRequest; +import me.zhengjie.modules.wms.outSourceProductSheet.service.OutSourceProcessSheetProductService; import me.zhengjie.modules.wms.outSourceProductSheet.service.OutSourceProcessSheetService; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceProcessSheetProductQueryCriteria; import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceProcessSheetQueryCriteria; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; @@ -30,6 +33,9 @@ public class OutSourceProcessSheetController { @Autowired private OutSourceProcessSheetService outSourceProcessSheetService; + @Autowired + private OutSourceProcessSheetProductService outSourceProcessSheetProductService; + @Log("分页查询委外加工单") @ApiOperation(value = "分页查询委外加工单") @GetMapping(value = "/queryOutSourceProcessSheetPage") @@ -78,4 +84,10 @@ public class OutSourceProcessSheetController { public ResponseEntity getOutSourceProcessSheet(@PathVariable Long id){ return new ResponseEntity(outSourceProcessSheetService.findById(id), HttpStatus.OK); } + + @Log("查看委外加工单产品信息") + @GetMapping(value = "/outSourceProcessSheet/outSourceProcessSheetProduct") + public ResponseEntity queryOutSourceProcessSheetProductList(OutSourceProcessSheetProductQueryCriteria criteria){ + return new ResponseEntity(outSourceProcessSheetProductService.queryAll(criteria), HttpStatus.OK); + } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceInspectionCertificateProductService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceInspectionCertificateProductService.java new file mode 100644 index 00000000..a955294d --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceInspectionCertificateProductService.java @@ -0,0 +1,64 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service; + +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificateProduct; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateProductDTO; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateProductQueryCriteria; +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; + +/** +* @author jie +* @date 2019-10-01 +*/ +//@CacheConfig(cacheNames = "sOutSourceInspectionCertificateProduct") +public interface OutSourceInspectionCertificateProductService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(OutSourceInspectionCertificateProductQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(OutSourceInspectionCertificateProductQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + OutSourceInspectionCertificateProductDTO findById(Long id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + OutSourceInspectionCertificateProductDTO create(OutSourceInspectionCertificateProduct resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(OutSourceInspectionCertificateProduct resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Long id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceInspectionCertificateService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceInspectionCertificateService.java new file mode 100644 index 00000000..531f1f8b --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceInspectionCertificateService.java @@ -0,0 +1,64 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service; + +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificate; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateDTO; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateQueryCriteria; +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; + +/** +* @author jie +* @date 2019-10-01 +*/ +//@CacheConfig(cacheNames = "sOutSourceInspectionCertificate") +public interface OutSourceInspectionCertificateService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(OutSourceInspectionCertificateQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(OutSourceInspectionCertificateQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + OutSourceInspectionCertificateDTO findById(Long id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + OutSourceInspectionCertificateDTO create(OutSourceInspectionCertificate resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(OutSourceInspectionCertificate resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Long id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceProcessSheetProductService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceProcessSheetProductService.java index 161649d8..49dc2625 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceProcessSheetProductService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceProcessSheetProductService.java @@ -8,6 +8,8 @@ import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceProces //import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Pageable; +import java.util.List; + /** * @author jie * @date 2019-08-17 @@ -40,6 +42,14 @@ public interface OutSourceProcessSheetProductService { //@Cacheable(key = "#p0") OutSourceProcessSheetProductDTO findById(Long id); + + /** + * 查询委外加工单产品信息 + * @param outSourceProcessSheetProductId + * @return + */ + List findByOutSourceProcessSheetProductId(Long outSourceProcessSheetProductId); + /** * create * @param resources diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceProcessSheetService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceProcessSheetService.java index 6ee75417..cfdc058f 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceProcessSheetService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/OutSourceProcessSheetService.java @@ -2,6 +2,7 @@ package me.zhengjie.modules.wms.outSourceProductSheet.service; import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceProcessSheet; import me.zhengjie.modules.wms.outSourceProductSheet.request.CreateOutSourceProcessSheetRequest; +import me.zhengjie.modules.wms.outSourceProductSheet.request.QueryOutSourceProcessSheetProductRequest; import me.zhengjie.modules.wms.outSourceProductSheet.request.UpdateOutSourceProcessSheetRequest; import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceProcessSheetDTO; import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceProcessSheetQueryCriteria; @@ -9,6 +10,7 @@ import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceProces //import org.springframework.cache.annotation.CacheEvict; //import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; /** * @author jie @@ -63,4 +65,5 @@ public interface OutSourceProcessSheetService { */ //@CacheEvict(allEntries = true) void delete(Long id); + } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateDTO.java new file mode 100644 index 00000000..5eef1bd0 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateDTO.java @@ -0,0 +1,37 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author jie +* @date 2019-10-01 +*/ +@Data +public class OutSourceInspectionCertificateDTO implements Serializable { + + // 主键 + private Long id; + + private Timestamp createTime; + + private Timestamp updateTime; + + private Integer status; + + // 所属委外加工单 + private Long outSourceProcessSheetId; + + // 制单人 + private Long makePeopleId; + + // 制单人姓名 + private String makePeopleName; + + // 委外加工验收单单据编号 + private String outSourceInspectionCertificateCode; + + private String remark; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateProductDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateProductDTO.java new file mode 100644 index 00000000..3f5841bd --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateProductDTO.java @@ -0,0 +1,34 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author jie +* @date 2019-10-01 +*/ +@Data +public class OutSourceInspectionCertificateProductDTO implements Serializable { + + // 主键 + private Long id; + + private Timestamp createTime; + + private Timestamp updateTime; + + private Integer status; + + // 所属委外验收单 + private Long outSourceInspectionCertificateId; + + private String productCode; + + private Long productId; + + private String productName; + + private String remark; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateProductQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateProductQueryCriteria.java new file mode 100644 index 00000000..a3834393 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateProductQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Data +public class OutSourceInspectionCertificateProductQueryCriteria { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateQueryCriteria.java new file mode 100644 index 00000000..c16d4932 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceInspectionCertificateQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Data +public class OutSourceInspectionCertificateQueryCriteria { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceProcessSheetProductQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceProcessSheetProductQueryCriteria.java index 1bb36591..0a720d1b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceProcessSheetProductQueryCriteria.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/dto/OutSourceProcessSheetProductQueryCriteria.java @@ -10,4 +10,6 @@ import me.zhengjie.annotation.Query; */ @Data public class OutSourceProcessSheetProductQueryCriteria { + + private Long outSOurceProcessSheetId; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceInspectionCertificateProductServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceInspectionCertificateProductServiceImpl.java new file mode 100644 index 00000000..1ed1bedc --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceInspectionCertificateProductServiceImpl.java @@ -0,0 +1,73 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service.impl; + +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificateProduct; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.outSourceProductSheet.repository.OutSourceInspectionCertificateProductRepository; +import me.zhengjie.modules.wms.outSourceProductSheet.service.OutSourceInspectionCertificateProductService; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateProductDTO; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateProductQueryCriteria; +import me.zhengjie.modules.wms.outSourceProductSheet.service.mapper.OutSourceInspectionCertificateProductMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class OutSourceInspectionCertificateProductServiceImpl implements OutSourceInspectionCertificateProductService { + + @Autowired + private OutSourceInspectionCertificateProductRepository outSourceInspectionCertificateProductRepository; + + @Autowired + private OutSourceInspectionCertificateProductMapper outSourceInspectionCertificateProductMapper; + + @Override + public Object queryAll(OutSourceInspectionCertificateProductQueryCriteria criteria, Pageable pageable){ + Page page = outSourceInspectionCertificateProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(outSourceInspectionCertificateProductMapper::toDto)); + } + + @Override + public Object queryAll(OutSourceInspectionCertificateProductQueryCriteria criteria){ + return outSourceInspectionCertificateProductMapper.toDto(outSourceInspectionCertificateProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public OutSourceInspectionCertificateProductDTO findById(Long id) { + Optional sOutSourceInspectionCertificateProduct = outSourceInspectionCertificateProductRepository.findById(id); + ValidationUtil.isNull(sOutSourceInspectionCertificateProduct,"SOutSourceInspectionCertificateProduct","id",id); + return outSourceInspectionCertificateProductMapper.toDto(sOutSourceInspectionCertificateProduct.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public OutSourceInspectionCertificateProductDTO create(OutSourceInspectionCertificateProduct resources) { + return outSourceInspectionCertificateProductMapper.toDto(outSourceInspectionCertificateProductRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OutSourceInspectionCertificateProduct resources) { + Optional optionalSOutSourceInspectionCertificateProduct = outSourceInspectionCertificateProductRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalSOutSourceInspectionCertificateProduct,"SOutSourceInspectionCertificateProduct","id",resources.getId()); + OutSourceInspectionCertificateProduct outSourceInspectionCertificateProduct = optionalSOutSourceInspectionCertificateProduct.get(); + outSourceInspectionCertificateProduct.copy(resources); + outSourceInspectionCertificateProductRepository.save(outSourceInspectionCertificateProduct); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + outSourceInspectionCertificateProductRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceInspectionCertificateServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceInspectionCertificateServiceImpl.java new file mode 100644 index 00000000..17ad0880 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceInspectionCertificateServiceImpl.java @@ -0,0 +1,73 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service.impl; + +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificate; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.outSourceProductSheet.repository.OutSourceInspectionCertificateRepository; +import me.zhengjie.modules.wms.outSourceProductSheet.service.OutSourceInspectionCertificateService; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateDTO; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateQueryCriteria; +import me.zhengjie.modules.wms.outSourceProductSheet.service.mapper.OutSourceInspectionCertificateMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class OutSourceInspectionCertificateServiceImpl implements OutSourceInspectionCertificateService { + + @Autowired + private OutSourceInspectionCertificateRepository outSourceInspectionCertificateRepository; + + @Autowired + private OutSourceInspectionCertificateMapper outSourceInspectionCertificateMapper; + + @Override + public Object queryAll(OutSourceInspectionCertificateQueryCriteria criteria, Pageable pageable){ + Page page = outSourceInspectionCertificateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(outSourceInspectionCertificateMapper::toDto)); + } + + @Override + public Object queryAll(OutSourceInspectionCertificateQueryCriteria criteria){ + return outSourceInspectionCertificateMapper.toDto(outSourceInspectionCertificateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public OutSourceInspectionCertificateDTO findById(Long id) { + Optional sOutSourceInspectionCertificate = outSourceInspectionCertificateRepository.findById(id); + ValidationUtil.isNull(sOutSourceInspectionCertificate,"SOutSourceInspectionCertificate","id",id); + return outSourceInspectionCertificateMapper.toDto(sOutSourceInspectionCertificate.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public OutSourceInspectionCertificateDTO create(OutSourceInspectionCertificate resources) { + return outSourceInspectionCertificateMapper.toDto(outSourceInspectionCertificateRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OutSourceInspectionCertificate resources) { + Optional optionalSOutSourceInspectionCertificate = outSourceInspectionCertificateRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalSOutSourceInspectionCertificate,"SOutSourceInspectionCertificate","id",resources.getId()); + OutSourceInspectionCertificate outSourceInspectionCertificate = optionalSOutSourceInspectionCertificate.get(); + outSourceInspectionCertificate.copy(resources); + outSourceInspectionCertificateRepository.save(outSourceInspectionCertificate); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + outSourceInspectionCertificateRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceProcessSheetProductServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceProcessSheetProductServiceImpl.java index 1803e91a..67b05bb9 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceProcessSheetProductServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceProcessSheetProductServiceImpl.java @@ -76,6 +76,13 @@ public class OutSourceProcessSheetProductServiceImpl implements OutSourceProcess Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1); targetPredicateList.add(statusPredicate); + Long outSOurceProcessSheetId = criteria.getOutSOurceProcessSheetId(); + if(null != outSOurceProcessSheetId){ + Predicate outSOurceProcessSheetIdPredicate = criteriaBuilder.equal(root.get("outSOurceProcessSheetId"), 1); + targetPredicateList.add(outSOurceProcessSheetIdPredicate); + } + + if(CollectionUtils.isEmpty(targetPredicateList)){ return null; }else{ @@ -93,6 +100,11 @@ public class OutSourceProcessSheetProductServiceImpl implements OutSourceProcess return outSourceProcessSheetProductMapper.toDto(sOutSourceProcessSheetProduct.get()); } + @Override + public List findByOutSourceProcessSheetProductId(Long outSourceProcessSheetProductId) { + return null; + } + @Override @Transactional(rollbackFor = Exception.class) public OutSourceProcessSheetProductDTO create(OutSourceProcessSheetProduct resources) { diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceProcessSheetServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceProcessSheetServiceImpl.java index 41719b8d..64ac3059 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceProcessSheetServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/impl/OutSourceProcessSheetServiceImpl.java @@ -11,6 +11,7 @@ import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceProcessShee import me.zhengjie.modules.wms.outSourceProductSheet.repository.OutSourceProcessSheetProductRepository; import me.zhengjie.modules.wms.outSourceProductSheet.request.CreateOutSourceProcessSheetRequest; import me.zhengjie.modules.wms.outSourceProductSheet.request.OutSourceProcessSheetProductRequest; +import me.zhengjie.modules.wms.outSourceProductSheet.request.QueryOutSourceProcessSheetProductRequest; import me.zhengjie.modules.wms.outSourceProductSheet.request.UpdateOutSourceProcessSheetRequest; import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceProcessSheetProductDTO; import me.zhengjie.modules.wms.outSourceProductSheet.service.mapper.OutSourceProcessSheetProductMapper; @@ -23,6 +24,7 @@ import me.zhengjie.modules.wms.outSourceProductSheet.service.mapper.OutSourcePro import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.domain.Specification; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -121,7 +123,7 @@ public class OutSourceProcessSheetServiceImpl implements OutSourceProcessSheetSe OutSourceProcessSheetDTO outSourceProcessSheetDTO = outSourceProcessSheetMapper.toDto(outSourceProcessSheet); - List outSourceProcessSheetProductList = outSourceProcessSheetProductRepository.findByOutSourceProcessSheetIdAndStatusTrue(id); + List outSourceProcessSheetProductList = outSourceProcessSheetProductRepository.queryByOutSourceProcessSheetIdAndStatusTrue(id); if(!CollectionUtils.isEmpty(outSourceProcessSheetProductList)){ List outSourceProcessSheetProductDTOList = outSourceProcessSheetProductMapper.toDto(outSourceProcessSheetProductList); outSourceProcessSheetDTO.setOutSourceProcessSheetProductList(outSourceProcessSheetProductDTOList); @@ -188,7 +190,7 @@ public class OutSourceProcessSheetServiceImpl implements OutSourceProcessSheetSe outSourceProcessSheetRepository.save(outSourceProcessSheet); // 修改产品信息之前,查询该订单中原来的产品信息,key为产品code - List outSourceProcessSheetProductListBeforeUpdate = outSourceProcessSheetProductRepository.findByOutSourceProcessSheetIdAndStatusTrue(outSourceProcessSheet.getId()); + List outSourceProcessSheetProductListBeforeUpdate = outSourceProcessSheetProductRepository.queryByOutSourceProcessSheetIdAndStatusTrue(outSourceProcessSheet.getId()); Map outSourceProcessSheetProductMapBefore = outSourceProcessSheetProductListBeforeUpdate.stream().collect(Collectors.toMap(OutSourceProcessSheetProduct::getProductCode, Function.identity())); List outSourceProcessSheetProductRequestList = updateOutSourceProcessSheetRequest.getOutSourceProcessSheetProductList(); @@ -244,4 +246,5 @@ public class OutSourceProcessSheetServiceImpl implements OutSourceProcessSheetSe public void delete(Long id) { outSourceProcessSheetRepository.deleteById(id); } + } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/mapper/OutSourceInspectionCertificateMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/mapper/OutSourceInspectionCertificateMapper.java new file mode 100644 index 00000000..21c5cf5e --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/mapper/OutSourceInspectionCertificateMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificate; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface OutSourceInspectionCertificateMapper extends EntityMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/mapper/OutSourceInspectionCertificateProductMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/mapper/OutSourceInspectionCertificateProductMapper.java new file mode 100644 index 00000000..3371ef2f --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/outSourceProductSheet/service/mapper/OutSourceInspectionCertificateProductMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.outSourceProductSheet.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.outSourceProductSheet.domain.OutSourceInspectionCertificateProduct; +import me.zhengjie.modules.wms.outSourceProductSheet.service.dto.OutSourceInspectionCertificateProductDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author jie +* @date 2019-10-01 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface OutSourceInspectionCertificateProductMapper extends EntityMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ConsumablesPurchaseOrder.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ConsumablesPurchaseOrder.java new file mode 100644 index 00000000..3492edfc --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ConsumablesPurchaseOrder.java @@ -0,0 +1,60 @@ +package me.zhengjie.modules.wms.purchase.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Entity +@Data +@Table(name="consumables_purchase_order") +public class ConsumablesPurchaseOrder implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "create_time") + private Timestamp createTime; + + @Column(name = "update_time") + private Timestamp updateTime; + + // 采购人主键 + @Column(name = "purchase_user_id") + private Long purchaseUserId; + + // 采购人姓名 + @Column(name = "purchase_user_name") + private String purchaseUserName; + + // 状态 + @Column(name = "status") + private Integer status; + + // 审核状态 + @Column(name = "audit_status") + private Integer auditStatus; + + @Column(name = "audit_user_id") + private Long auditUserId; + + // 审核人姓名 + @Column(name = "audit_user_name") + private String auditUserName; + + // 耗材采购单单据编号 + @Column(name = "consumables_purchase_order_code") + private String consumablesPurchaseOrderCode; + + public void copy(ConsumablesPurchaseOrder source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ConsumablesPurchaseOrderProduct.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ConsumablesPurchaseOrderProduct.java new file mode 100644 index 00000000..3b200fe2 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ConsumablesPurchaseOrderProduct.java @@ -0,0 +1,70 @@ +package me.zhengjie.modules.wms.purchase.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Entity +@Data +@Table(name="consumables_purchase_order_product") +public class ConsumablesPurchaseOrderProduct implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + // 所属耗材采购单 + @Column(name = "consumables_purchase_order_id") + private Long consumablesPurchaseOrderId; + + // 耗材主键 + @Column(name = "consumables_id") + private Long consumablesId; + + // 耗材名称 + @Column(name = "consumables_name") + private String consumablesName; + + // 产品单价 + @Column(name = "unit_price") + private Long unitPrice; + + // 产品总价 + @Column(name = "total_price") + private Long totalPrice; + + // 产品数量 + @Column(name = "consumables_number") + private Long consumablesNumber; + + // 备注 + @Column(name = "remark") + private String remark; + + // 创建时间 + @Column(name = "create_time") + private Timestamp createTime; + + // 更新时间 + @Column(name = "update_time") + private Timestamp updateTime; + + @Column(name = "status") + private Integer status; + + // 耗材编号 + @Column(name = "consumables_code") + private String consumablesCode; + + public void copy(ConsumablesPurchaseOrderProduct source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ProductPurchaseOrder.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ProductPurchaseOrder.java new file mode 100644 index 00000000..3283cac5 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ProductPurchaseOrder.java @@ -0,0 +1,59 @@ +package me.zhengjie.modules.wms.purchase.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Entity +@Data +@Table(name="product_purchase_order") +public class ProductPurchaseOrder implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "create_time") + private Timestamp createTime; + + @Column(name = "update_time") + private Timestamp updateTime; + + // 采购人主键 + @Column(name = "purchase_user_id") + private Long purchaseUserId; + + // 采购人姓名 + @Column(name = "purchase_user_name") + private String purchaseUserName; + + // 状态 + @Column(name = "status") + private Integer status; + + // 审核状态 + @Column(name = "audit_status") + private Integer auditStatus; + + @Column(name = "audit_user_id") + private Long auditUserId; + + // 审核人姓名 + @Column(name = "audit_user_name") + private String auditUserName; + + @Column(name = "product_purchase_order_code") + private String productPurchaseOrderCode; + + public void copy(ProductPurchaseOrder source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ProductPurchaseOrderProduct.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ProductPurchaseOrderProduct.java new file mode 100644 index 00000000..29ffa923 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/domain/ProductPurchaseOrderProduct.java @@ -0,0 +1,74 @@ +package me.zhengjie.modules.wms.purchase.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Entity +@Data +@Table(name="product_purchase_order_product") +public class ProductPurchaseOrderProduct implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + // 所属产品采购单 + @Column(name = "product_purchase_order_id") + private Long productPurchaseOrderId; + + // 产品主键 + @Column(name = "product_id") + private Long productId; + + // 产品名称 + @Column(name = "product_name") + private String productName; + + // 规格 + @Column(name = "specifications") + private String specifications; + + // 产品单价 + @Column(name = "unit_price") + private Long unitPrice; + + // 产品总价 + @Column(name = "total_price") + private Long totalPrice; + + // 产品数量 + @Column(name = "product_number") + private Long productNumber; + + // 备注 + @Column(name = "remark") + private String remark; + + // 创建时间 + @Column(name = "create_time") + private Timestamp createTime; + + // 更新时间 + @Column(name = "update_time") + private Timestamp updateTime; + + @Column(name = "status") + private Integer status; + + // 产品编号 + @Column(name = "product_code") + private String productCode; + + public void copy(ProductPurchaseOrderProduct source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ConsumablesPurchaseOrderProductRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ConsumablesPurchaseOrderProductRepository.java new file mode 100644 index 00000000..ddc07495 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ConsumablesPurchaseOrderProductRepository.java @@ -0,0 +1,12 @@ +package me.zhengjie.modules.wms.purchase.repository; + +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrderProduct; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author jie +* @date 2019-10-06 +*/ +public interface ConsumablesPurchaseOrderProductRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ConsumablesPurchaseOrderRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ConsumablesPurchaseOrderRepository.java new file mode 100644 index 00000000..3413f70f --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ConsumablesPurchaseOrderRepository.java @@ -0,0 +1,12 @@ +package me.zhengjie.modules.wms.purchase.repository; + +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrder; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author jie +* @date 2019-10-06 +*/ +public interface ConsumablesPurchaseOrderRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ProductPurchaseOrderProductRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ProductPurchaseOrderProductRepository.java new file mode 100644 index 00000000..1339fd50 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ProductPurchaseOrderProductRepository.java @@ -0,0 +1,12 @@ +package me.zhengjie.modules.wms.purchase.repository; + +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrderProduct; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author jie +* @date 2019-10-06 +*/ +public interface ProductPurchaseOrderProductRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ProductPurchaseOrderRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ProductPurchaseOrderRepository.java new file mode 100644 index 00000000..1a3b6735 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/repository/ProductPurchaseOrderRepository.java @@ -0,0 +1,12 @@ +package me.zhengjie.modules.wms.purchase.repository; + +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author jie +* @date 2019-10-06 +*/ +public interface ProductPurchaseOrderRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ConsumablesPurchaseOrderController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ConsumablesPurchaseOrderController.java new file mode 100644 index 00000000..99453164 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ConsumablesPurchaseOrderController.java @@ -0,0 +1,61 @@ +package me.zhengjie.modules.wms.purchase.rest; + +import me.zhengjie.aop.log.Log; +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrder; +import me.zhengjie.modules.wms.purchase.service.ConsumablesPurchaseOrderService; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Api(tags = "ConsumablesPurchaseOrder管理") +@RestController +@RequestMapping("api") +public class ConsumablesPurchaseOrderController { + + @Autowired + private ConsumablesPurchaseOrderService consumablesPurchaseOrderService; + + @Log("查询ConsumablesPurchaseOrder") + @ApiOperation(value = "查询ConsumablesPurchaseOrder") + @GetMapping(value = "/consumablesPurchaseOrder") + @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDER_ALL','CONSUMABLESPURCHASEORDER_SELECT')") + public ResponseEntity getConsumablesPurchaseOrders(ConsumablesPurchaseOrderQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(consumablesPurchaseOrderService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增ConsumablesPurchaseOrder") + @ApiOperation(value = "新增ConsumablesPurchaseOrder") + @PostMapping(value = "/consumablesPurchaseOrder") + @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDER_ALL','CONSUMABLESPURCHASEORDER_CREATE')") + public ResponseEntity create(@Validated @RequestBody ConsumablesPurchaseOrder resources){ + return new ResponseEntity(consumablesPurchaseOrderService.create(resources),HttpStatus.CREATED); + } + + @Log("修改ConsumablesPurchaseOrder") + @ApiOperation(value = "修改ConsumablesPurchaseOrder") + @PutMapping(value = "/consumablesPurchaseOrder") + @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDER_ALL','CONSUMABLESPURCHASEORDER_EDIT')") + public ResponseEntity update(@Validated @RequestBody ConsumablesPurchaseOrder resources){ + consumablesPurchaseOrderService.update(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除ConsumablesPurchaseOrder") + @ApiOperation(value = "删除ConsumablesPurchaseOrder") + @DeleteMapping(value = "/consumablesPurchaseOrder/{id}") + @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDER_ALL','CONSUMABLESPURCHASEORDER_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + consumablesPurchaseOrderService.delete(id); + return new ResponseEntity(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ConsumablesPurchaseOrderProductController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ConsumablesPurchaseOrderProductController.java new file mode 100644 index 00000000..0748348c --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ConsumablesPurchaseOrderProductController.java @@ -0,0 +1,61 @@ +package me.zhengjie.modules.wms.purchase.rest; + +import me.zhengjie.aop.log.Log; +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrderProduct; +import me.zhengjie.modules.wms.purchase.service.ConsumablesPurchaseOrderProductService; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderProductQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Api(tags = "ConsumablesPurchaseOrderProduct管理") +@RestController +@RequestMapping("api") +public class ConsumablesPurchaseOrderProductController { + + @Autowired + private ConsumablesPurchaseOrderProductService consumablesPurchaseOrderProductService; + + @Log("查询ConsumablesPurchaseOrderProduct") + @ApiOperation(value = "查询ConsumablesPurchaseOrderProduct") + @GetMapping(value = "/consumablesPurchaseOrderProduct") + @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDERPRODUCT_ALL','CONSUMABLESPURCHASEORDERPRODUCT_SELECT')") + public ResponseEntity getConsumablesPurchaseOrderProducts(ConsumablesPurchaseOrderProductQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(consumablesPurchaseOrderProductService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增ConsumablesPurchaseOrderProduct") + @ApiOperation(value = "新增ConsumablesPurchaseOrderProduct") + @PostMapping(value = "/consumablesPurchaseOrderProduct") + @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDERPRODUCT_ALL','CONSUMABLESPURCHASEORDERPRODUCT_CREATE')") + public ResponseEntity create(@Validated @RequestBody ConsumablesPurchaseOrderProduct resources){ + return new ResponseEntity(consumablesPurchaseOrderProductService.create(resources),HttpStatus.CREATED); + } + + @Log("修改ConsumablesPurchaseOrderProduct") + @ApiOperation(value = "修改ConsumablesPurchaseOrderProduct") + @PutMapping(value = "/consumablesPurchaseOrderProduct") + @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDERPRODUCT_ALL','CONSUMABLESPURCHASEORDERPRODUCT_EDIT')") + public ResponseEntity update(@Validated @RequestBody ConsumablesPurchaseOrderProduct resources){ + consumablesPurchaseOrderProductService.update(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除ConsumablesPurchaseOrderProduct") + @ApiOperation(value = "删除ConsumablesPurchaseOrderProduct") + @DeleteMapping(value = "/consumablesPurchaseOrderProduct/{id}") + @PreAuthorize("hasAnyRole('ADMIN','CONSUMABLESPURCHASEORDERPRODUCT_ALL','CONSUMABLESPURCHASEORDERPRODUCT_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + consumablesPurchaseOrderProductService.delete(id); + return new ResponseEntity(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ProductPurchaseOrderController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ProductPurchaseOrderController.java new file mode 100644 index 00000000..bd047b1d --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ProductPurchaseOrderController.java @@ -0,0 +1,61 @@ +package me.zhengjie.modules.wms.purchase.rest; + +import me.zhengjie.aop.log.Log; +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder; +import me.zhengjie.modules.wms.purchase.service.ProductPurchaseOrderService; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Api(tags = "ProductPurchaseOrder管理") +@RestController +@RequestMapping("api") +public class ProductPurchaseOrderController { + + @Autowired + private ProductPurchaseOrderService productPurchaseOrderService; + + @Log("查询ProductPurchaseOrder") + @ApiOperation(value = "查询ProductPurchaseOrder") + @GetMapping(value = "/productPurchaseOrder") + @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDER_ALL','PRODUCTPURCHASEORDER_SELECT')") + public ResponseEntity getProductPurchaseOrders(ProductPurchaseOrderQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(productPurchaseOrderService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增ProductPurchaseOrder") + @ApiOperation(value = "新增ProductPurchaseOrder") + @PostMapping(value = "/productPurchaseOrder") + @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDER_ALL','PRODUCTPURCHASEORDER_CREATE')") + public ResponseEntity create(@Validated @RequestBody ProductPurchaseOrder resources){ + return new ResponseEntity(productPurchaseOrderService.create(resources),HttpStatus.CREATED); + } + + @Log("修改ProductPurchaseOrder") + @ApiOperation(value = "修改ProductPurchaseOrder") + @PutMapping(value = "/productPurchaseOrder") + @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDER_ALL','PRODUCTPURCHASEORDER_EDIT')") + public ResponseEntity update(@Validated @RequestBody ProductPurchaseOrder resources){ + productPurchaseOrderService.update(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除ProductPurchaseOrder") + @ApiOperation(value = "删除ProductPurchaseOrder") + @DeleteMapping(value = "/productPurchaseOrder/{id}") + @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDER_ALL','PRODUCTPURCHASEORDER_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + productPurchaseOrderService.delete(id); + return new ResponseEntity(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ProductPurchaseOrderProductController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ProductPurchaseOrderProductController.java new file mode 100644 index 00000000..0f938103 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/rest/ProductPurchaseOrderProductController.java @@ -0,0 +1,61 @@ +package me.zhengjie.modules.wms.purchase.rest; + +import me.zhengjie.aop.log.Log; +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrderProduct; +import me.zhengjie.modules.wms.purchase.service.ProductPurchaseOrderProductService; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderProductQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Api(tags = "ProductPurchaseOrderProduct管理") +@RestController +@RequestMapping("api") +public class ProductPurchaseOrderProductController { + + @Autowired + private ProductPurchaseOrderProductService productPurchaseOrderProductService; + + @Log("查询ProductPurchaseOrderProduct") + @ApiOperation(value = "查询ProductPurchaseOrderProduct") + @GetMapping(value = "/productPurchaseOrderProduct") + @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDERPRODUCT_ALL','PRODUCTPURCHASEORDERPRODUCT_SELECT')") + public ResponseEntity getProductPurchaseOrderProducts(ProductPurchaseOrderProductQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(productPurchaseOrderProductService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增ProductPurchaseOrderProduct") + @ApiOperation(value = "新增ProductPurchaseOrderProduct") + @PostMapping(value = "/productPurchaseOrderProduct") + @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDERPRODUCT_ALL','PRODUCTPURCHASEORDERPRODUCT_CREATE')") + public ResponseEntity create(@Validated @RequestBody ProductPurchaseOrderProduct resources){ + return new ResponseEntity(productPurchaseOrderProductService.create(resources),HttpStatus.CREATED); + } + + @Log("修改ProductPurchaseOrderProduct") + @ApiOperation(value = "修改ProductPurchaseOrderProduct") + @PutMapping(value = "/productPurchaseOrderProduct") + @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDERPRODUCT_ALL','PRODUCTPURCHASEORDERPRODUCT_EDIT')") + public ResponseEntity update(@Validated @RequestBody ProductPurchaseOrderProduct resources){ + productPurchaseOrderProductService.update(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除ProductPurchaseOrderProduct") + @ApiOperation(value = "删除ProductPurchaseOrderProduct") + @DeleteMapping(value = "/productPurchaseOrderProduct/{id}") + @PreAuthorize("hasAnyRole('ADMIN','PRODUCTPURCHASEORDERPRODUCT_ALL','PRODUCTPURCHASEORDERPRODUCT_DELETE')") + public ResponseEntity delete(@PathVariable Long id){ + productPurchaseOrderProductService.delete(id); + return new ResponseEntity(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ConsumablesPurchaseOrderProductService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ConsumablesPurchaseOrderProductService.java new file mode 100644 index 00000000..5d8b3c09 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ConsumablesPurchaseOrderProductService.java @@ -0,0 +1,64 @@ +package me.zhengjie.modules.wms.purchase.service; + +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrderProduct; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderProductDTO; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderProductQueryCriteria; +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; + +/** +* @author jie +* @date 2019-10-06 +*/ +//@CacheConfig(cacheNames = "consumablesPurchaseOrderProduct") +public interface ConsumablesPurchaseOrderProductService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(ConsumablesPurchaseOrderProductQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(ConsumablesPurchaseOrderProductQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + ConsumablesPurchaseOrderProductDTO findById(Long id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + ConsumablesPurchaseOrderProductDTO create(ConsumablesPurchaseOrderProduct resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(ConsumablesPurchaseOrderProduct resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Long id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ConsumablesPurchaseOrderService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ConsumablesPurchaseOrderService.java new file mode 100644 index 00000000..f31af9b6 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ConsumablesPurchaseOrderService.java @@ -0,0 +1,64 @@ +package me.zhengjie.modules.wms.purchase.service; + +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrder; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderDTO; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderQueryCriteria; +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; + +/** +* @author jie +* @date 2019-10-06 +*/ +//@CacheConfig(cacheNames = "consumablesPurchaseOrder") +public interface ConsumablesPurchaseOrderService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(ConsumablesPurchaseOrderQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(ConsumablesPurchaseOrderQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + ConsumablesPurchaseOrderDTO findById(Long id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + ConsumablesPurchaseOrderDTO create(ConsumablesPurchaseOrder resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(ConsumablesPurchaseOrder resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Long id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ProductPurchaseOrderProductService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ProductPurchaseOrderProductService.java new file mode 100644 index 00000000..94604371 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ProductPurchaseOrderProductService.java @@ -0,0 +1,64 @@ +package me.zhengjie.modules.wms.purchase.service; + +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrderProduct; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderProductDTO; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderProductQueryCriteria; +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; + +/** +* @author jie +* @date 2019-10-06 +*/ +//@CacheConfig(cacheNames = "productPurchaseOrderProduct") +public interface ProductPurchaseOrderProductService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(ProductPurchaseOrderProductQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(ProductPurchaseOrderProductQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + ProductPurchaseOrderProductDTO findById(Long id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + ProductPurchaseOrderProductDTO create(ProductPurchaseOrderProduct resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(ProductPurchaseOrderProduct resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Long id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ProductPurchaseOrderService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ProductPurchaseOrderService.java new file mode 100644 index 00000000..9586086b --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/ProductPurchaseOrderService.java @@ -0,0 +1,64 @@ +package me.zhengjie.modules.wms.purchase.service; + +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderDTO; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderQueryCriteria; +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; + +/** +* @author jie +* @date 2019-10-06 +*/ +//@CacheConfig(cacheNames = "productPurchaseOrder") +public interface ProductPurchaseOrderService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(ProductPurchaseOrderQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(ProductPurchaseOrderQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + ProductPurchaseOrderDTO findById(Long id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + ProductPurchaseOrderDTO create(ProductPurchaseOrder resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(ProductPurchaseOrder resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Long id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderDTO.java new file mode 100644 index 00000000..5cb276f9 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderDTO.java @@ -0,0 +1,40 @@ +package me.zhengjie.modules.wms.purchase.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author jie +* @date 2019-10-06 +*/ +@Data +public class ConsumablesPurchaseOrderDTO implements Serializable { + + private Long id; + + private Timestamp createTime; + + private Timestamp updateTime; + + // 采购人主键 + private Long purchaseUserId; + + // 采购人姓名 + private String purchaseUserName; + + // 状态 + private Integer status; + + // 审核状态 + private Integer auditStatus; + + private Long auditUserId; + + // 审核人姓名 + private String auditUserName; + + // 耗材采购单单据编号 + private String consumablesPurchaseOrderCode; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderProductDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderProductDTO.java new file mode 100644 index 00000000..bfed6638 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderProductDTO.java @@ -0,0 +1,48 @@ +package me.zhengjie.modules.wms.purchase.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author jie +* @date 2019-10-06 +*/ +@Data +public class ConsumablesPurchaseOrderProductDTO implements Serializable { + + private Long id; + + // 所属耗材采购单 + private Long consumablesPurchaseOrderId; + + // 耗材主键 + private Long consumablesId; + + // 耗材名称 + private String consumablesName; + + // 产品单价 + private Long unitPrice; + + // 产品总价 + private Long totalPrice; + + // 产品数量 + private Long consumablesNumber; + + // 备注 + private String remark; + + // 创建时间 + private Timestamp createTime; + + // 更新时间 + private Timestamp updateTime; + + private Integer status; + + // 耗材编号 + private String consumablesCode; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderProductQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderProductQueryCriteria.java new file mode 100644 index 00000000..033e1c67 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderProductQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.purchase.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Data +public class ConsumablesPurchaseOrderProductQueryCriteria{ +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderQueryCriteria.java new file mode 100644 index 00000000..b2a2ed34 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ConsumablesPurchaseOrderQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.purchase.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Data +public class ConsumablesPurchaseOrderQueryCriteria{ +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderDTO.java new file mode 100644 index 00000000..fd9a6fb3 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderDTO.java @@ -0,0 +1,39 @@ +package me.zhengjie.modules.wms.purchase.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author jie +* @date 2019-10-06 +*/ +@Data +public class ProductPurchaseOrderDTO implements Serializable { + + private Long id; + + private Timestamp createTime; + + private Timestamp updateTime; + + // 采购人主键 + private Long purchaseUserId; + + // 采购人姓名 + private String purchaseUserName; + + // 状态 + private Integer status; + + // 审核状态 + private Integer auditStatus; + + private Long auditUserId; + + // 审核人姓名 + private String auditUserName; + + private String productPurchaseOrderCode; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderProductDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderProductDTO.java new file mode 100644 index 00000000..62b5beee --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderProductDTO.java @@ -0,0 +1,51 @@ +package me.zhengjie.modules.wms.purchase.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author jie +* @date 2019-10-06 +*/ +@Data +public class ProductPurchaseOrderProductDTO implements Serializable { + + private Long id; + + // 所属产品采购单 + private Long productPurchaseOrderId; + + // 产品主键 + private Long productId; + + // 产品名称 + private String productName; + + // 规格 + private String specifications; + + // 产品单价 + private Long unitPrice; + + // 产品总价 + private Long totalPrice; + + // 产品数量 + private Long productNumber; + + // 备注 + private String remark; + + // 创建时间 + private Timestamp createTime; + + // 更新时间 + private Timestamp updateTime; + + private Integer status; + + // 产品编号 + private String productCode; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderProductQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderProductQueryCriteria.java new file mode 100644 index 00000000..224fd50c --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderProductQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.purchase.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Data +public class ProductPurchaseOrderProductQueryCriteria{ +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderQueryCriteria.java new file mode 100644 index 00000000..f27941f2 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/dto/ProductPurchaseOrderQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.purchase.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Data +public class ProductPurchaseOrderQueryCriteria{ +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ConsumablesPurchaseOrderProductServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ConsumablesPurchaseOrderProductServiceImpl.java new file mode 100644 index 00000000..b42f6615 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ConsumablesPurchaseOrderProductServiceImpl.java @@ -0,0 +1,73 @@ +package me.zhengjie.modules.wms.purchase.service.impl; + +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrderProduct; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.purchase.repository.ConsumablesPurchaseOrderProductRepository; +import me.zhengjie.modules.wms.purchase.service.ConsumablesPurchaseOrderProductService; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderProductDTO; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderProductQueryCriteria; +import me.zhengjie.modules.wms.purchase.service.mapper.ConsumablesPurchaseOrderProductMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class ConsumablesPurchaseOrderProductServiceImpl implements ConsumablesPurchaseOrderProductService { + + @Autowired + private ConsumablesPurchaseOrderProductRepository consumablesPurchaseOrderProductRepository; + + @Autowired + private ConsumablesPurchaseOrderProductMapper consumablesPurchaseOrderProductMapper; + + @Override + public Object queryAll(ConsumablesPurchaseOrderProductQueryCriteria criteria, Pageable pageable){ + Page page = consumablesPurchaseOrderProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(consumablesPurchaseOrderProductMapper::toDto)); + } + + @Override + public Object queryAll(ConsumablesPurchaseOrderProductQueryCriteria criteria){ + return consumablesPurchaseOrderProductMapper.toDto(consumablesPurchaseOrderProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public ConsumablesPurchaseOrderProductDTO findById(Long id) { + Optional consumablesPurchaseOrderProduct = consumablesPurchaseOrderProductRepository.findById(id); + ValidationUtil.isNull(consumablesPurchaseOrderProduct,"ConsumablesPurchaseOrderProduct","id",id); + return consumablesPurchaseOrderProductMapper.toDto(consumablesPurchaseOrderProduct.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ConsumablesPurchaseOrderProductDTO create(ConsumablesPurchaseOrderProduct resources) { + return consumablesPurchaseOrderProductMapper.toDto(consumablesPurchaseOrderProductRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ConsumablesPurchaseOrderProduct resources) { + Optional optionalConsumablesPurchaseOrderProduct = consumablesPurchaseOrderProductRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalConsumablesPurchaseOrderProduct,"ConsumablesPurchaseOrderProduct","id",resources.getId()); + ConsumablesPurchaseOrderProduct consumablesPurchaseOrderProduct = optionalConsumablesPurchaseOrderProduct.get(); + consumablesPurchaseOrderProduct.copy(resources); + consumablesPurchaseOrderProductRepository.save(consumablesPurchaseOrderProduct); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + consumablesPurchaseOrderProductRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ConsumablesPurchaseOrderServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ConsumablesPurchaseOrderServiceImpl.java new file mode 100644 index 00000000..ecbe7306 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ConsumablesPurchaseOrderServiceImpl.java @@ -0,0 +1,73 @@ +package me.zhengjie.modules.wms.purchase.service.impl; + +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrder; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.purchase.repository.ConsumablesPurchaseOrderRepository; +import me.zhengjie.modules.wms.purchase.service.ConsumablesPurchaseOrderService; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderDTO; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderQueryCriteria; +import me.zhengjie.modules.wms.purchase.service.mapper.ConsumablesPurchaseOrderMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class ConsumablesPurchaseOrderServiceImpl implements ConsumablesPurchaseOrderService { + + @Autowired + private ConsumablesPurchaseOrderRepository consumablesPurchaseOrderRepository; + + @Autowired + private ConsumablesPurchaseOrderMapper consumablesPurchaseOrderMapper; + + @Override + public Object queryAll(ConsumablesPurchaseOrderQueryCriteria criteria, Pageable pageable){ + Page page = consumablesPurchaseOrderRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(consumablesPurchaseOrderMapper::toDto)); + } + + @Override + public Object queryAll(ConsumablesPurchaseOrderQueryCriteria criteria){ + return consumablesPurchaseOrderMapper.toDto(consumablesPurchaseOrderRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public ConsumablesPurchaseOrderDTO findById(Long id) { + Optional consumablesPurchaseOrder = consumablesPurchaseOrderRepository.findById(id); + ValidationUtil.isNull(consumablesPurchaseOrder,"ConsumablesPurchaseOrder","id",id); + return consumablesPurchaseOrderMapper.toDto(consumablesPurchaseOrder.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ConsumablesPurchaseOrderDTO create(ConsumablesPurchaseOrder resources) { + return consumablesPurchaseOrderMapper.toDto(consumablesPurchaseOrderRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ConsumablesPurchaseOrder resources) { + Optional optionalConsumablesPurchaseOrder = consumablesPurchaseOrderRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalConsumablesPurchaseOrder,"ConsumablesPurchaseOrder","id",resources.getId()); + ConsumablesPurchaseOrder consumablesPurchaseOrder = optionalConsumablesPurchaseOrder.get(); + consumablesPurchaseOrder.copy(resources); + consumablesPurchaseOrderRepository.save(consumablesPurchaseOrder); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + consumablesPurchaseOrderRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ProductPurchaseOrderProductServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ProductPurchaseOrderProductServiceImpl.java new file mode 100644 index 00000000..729174f1 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ProductPurchaseOrderProductServiceImpl.java @@ -0,0 +1,73 @@ +package me.zhengjie.modules.wms.purchase.service.impl; + +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrderProduct; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.purchase.repository.ProductPurchaseOrderProductRepository; +import me.zhengjie.modules.wms.purchase.service.ProductPurchaseOrderProductService; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderProductDTO; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderProductQueryCriteria; +import me.zhengjie.modules.wms.purchase.service.mapper.ProductPurchaseOrderProductMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class ProductPurchaseOrderProductServiceImpl implements ProductPurchaseOrderProductService { + + @Autowired + private ProductPurchaseOrderProductRepository productPurchaseOrderProductRepository; + + @Autowired + private ProductPurchaseOrderProductMapper productPurchaseOrderProductMapper; + + @Override + public Object queryAll(ProductPurchaseOrderProductQueryCriteria criteria, Pageable pageable){ + Page page = productPurchaseOrderProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(productPurchaseOrderProductMapper::toDto)); + } + + @Override + public Object queryAll(ProductPurchaseOrderProductQueryCriteria criteria){ + return productPurchaseOrderProductMapper.toDto(productPurchaseOrderProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public ProductPurchaseOrderProductDTO findById(Long id) { + Optional productPurchaseOrderProduct = productPurchaseOrderProductRepository.findById(id); + ValidationUtil.isNull(productPurchaseOrderProduct,"ProductPurchaseOrderProduct","id",id); + return productPurchaseOrderProductMapper.toDto(productPurchaseOrderProduct.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ProductPurchaseOrderProductDTO create(ProductPurchaseOrderProduct resources) { + return productPurchaseOrderProductMapper.toDto(productPurchaseOrderProductRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProductPurchaseOrderProduct resources) { + Optional optionalProductPurchaseOrderProduct = productPurchaseOrderProductRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalProductPurchaseOrderProduct,"ProductPurchaseOrderProduct","id",resources.getId()); + ProductPurchaseOrderProduct productPurchaseOrderProduct = optionalProductPurchaseOrderProduct.get(); + productPurchaseOrderProduct.copy(resources); + productPurchaseOrderProductRepository.save(productPurchaseOrderProduct); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + productPurchaseOrderProductRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ProductPurchaseOrderServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ProductPurchaseOrderServiceImpl.java new file mode 100644 index 00000000..4f299f34 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/impl/ProductPurchaseOrderServiceImpl.java @@ -0,0 +1,73 @@ +package me.zhengjie.modules.wms.purchase.service.impl; + +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.purchase.repository.ProductPurchaseOrderRepository; +import me.zhengjie.modules.wms.purchase.service.ProductPurchaseOrderService; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderDTO; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderQueryCriteria; +import me.zhengjie.modules.wms.purchase.service.mapper.ProductPurchaseOrderMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class ProductPurchaseOrderServiceImpl implements ProductPurchaseOrderService { + + @Autowired + private ProductPurchaseOrderRepository productPurchaseOrderRepository; + + @Autowired + private ProductPurchaseOrderMapper productPurchaseOrderMapper; + + @Override + public Object queryAll(ProductPurchaseOrderQueryCriteria criteria, Pageable pageable){ + Page page = productPurchaseOrderRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(productPurchaseOrderMapper::toDto)); + } + + @Override + public Object queryAll(ProductPurchaseOrderQueryCriteria criteria){ + return productPurchaseOrderMapper.toDto(productPurchaseOrderRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public ProductPurchaseOrderDTO findById(Long id) { + Optional productPurchaseOrder = productPurchaseOrderRepository.findById(id); + ValidationUtil.isNull(productPurchaseOrder,"ProductPurchaseOrder","id",id); + return productPurchaseOrderMapper.toDto(productPurchaseOrder.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ProductPurchaseOrderDTO create(ProductPurchaseOrder resources) { + return productPurchaseOrderMapper.toDto(productPurchaseOrderRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProductPurchaseOrder resources) { + Optional optionalProductPurchaseOrder = productPurchaseOrderRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalProductPurchaseOrder,"ProductPurchaseOrder","id",resources.getId()); + ProductPurchaseOrder productPurchaseOrder = optionalProductPurchaseOrder.get(); + productPurchaseOrder.copy(resources); + productPurchaseOrderRepository.save(productPurchaseOrder); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + productPurchaseOrderRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ConsumablesPurchaseOrderMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ConsumablesPurchaseOrderMapper.java new file mode 100644 index 00000000..07f6525a --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ConsumablesPurchaseOrderMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.purchase.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrder; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ConsumablesPurchaseOrderMapper extends EntityMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ConsumablesPurchaseOrderProductMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ConsumablesPurchaseOrderProductMapper.java new file mode 100644 index 00000000..978109e0 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ConsumablesPurchaseOrderProductMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.purchase.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.purchase.domain.ConsumablesPurchaseOrderProduct; +import me.zhengjie.modules.wms.purchase.service.dto.ConsumablesPurchaseOrderProductDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ConsumablesPurchaseOrderProductMapper extends EntityMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ProductPurchaseOrderMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ProductPurchaseOrderMapper.java new file mode 100644 index 00000000..13a39f44 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ProductPurchaseOrderMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.purchase.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrder; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ProductPurchaseOrderMapper extends EntityMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ProductPurchaseOrderProductMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ProductPurchaseOrderProductMapper.java new file mode 100644 index 00000000..77f26bb5 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/purchase/service/mapper/ProductPurchaseOrderProductMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.purchase.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.purchase.domain.ProductPurchaseOrderProduct; +import me.zhengjie.modules.wms.purchase.service.dto.ProductPurchaseOrderProductDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author jie +* @date 2019-10-06 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ProductPurchaseOrderProductMapper extends EntityMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/resources/config/application.yml b/eladmin-system/src/main/resources/config/application.yml index a52de8aa..33e004d7 100644 --- a/eladmin-system/src/main/resources/config/application.yml +++ b/eladmin-system/src/main/resources/config/application.yml @@ -3,7 +3,7 @@ server: spring: profiles: - active: prod + active: dev jackson: time-zone: GMT+8 data: diff --git a/eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java b/eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java index 862d7ec8..e91ae010 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java +++ b/eladmin-tools/src/main/java/me/zhengjie/service/impl/EmailServiceImpl.java @@ -72,7 +72,8 @@ public class EmailServiceImpl implements EmailService { } account.setFrom(emailConfig.getUser()+"<"+emailConfig.getFromUser()+">"); //ssl方式发送 - account.setStartttlsEnable(true); + //TODO hxx先去掉 +// account.setStartttlsEnable(true); String content = emailVo.getContent(); /** * 发送