提交 dd08f560 编写于 作者: ibizdev's avatar ibizdev

lab_gzf 发布系统代码

上级 2c733d04
...@@ -58,4 +58,27 @@ public class product_categoryFallback implements product_categoryFeignClient{ ...@@ -58,4 +58,27 @@ public class product_categoryFallback implements product_categoryFeignClient{
return null; return null;
} }
public Product_category getDraft(){
return null;
}
public Boolean checkKey(Product_category product_category){
return false;
}
public Boolean save(Product_category product_category){
return false;
}
public Boolean saveBatch(List<Product_category> product_categories){
return false;
}
public Page<Product_category> searchDefault(Product_categorySearchContext context){
return null;
}
} }
...@@ -56,4 +56,24 @@ public interface product_categoryFeignClient { ...@@ -56,4 +56,24 @@ public interface product_categoryFeignClient {
Page<Product_category> select(); Page<Product_category> select();
@RequestMapping(method = RequestMethod.GET, value = "/product_categories/getdraft")
Product_category getDraft();
@RequestMapping(method = RequestMethod.POST, value = "/product_categories/checkkey")
Boolean checkKey(@RequestBody Product_category product_category);
@RequestMapping(method = RequestMethod.POST, value = "/product_categories/save")
Boolean save(@RequestBody Product_category product_category);
@RequestMapping(method = RequestMethod.POST, value = "/product_categories/savebatch")
Boolean saveBatch(@RequestBody List<Product_category> product_categories);
@RequestMapping(method = RequestMethod.POST, value = "/product_categories/searchdefault")
Page<Product_category> searchDefault(@RequestBody Product_categorySearchContext context);
} }
...@@ -27,6 +27,111 @@ import cn.ibizlab.businesscentral.core.odoo_product.domain.Product_category; ...@@ -27,6 +27,111 @@ import cn.ibizlab.businesscentral.core.odoo_product.domain.Product_category;
@Data @Data
public class Product_categorySearchContext extends QueryWrapperContext<Product_category> { public class Product_categorySearchContext extends QueryWrapperContext<Product_category> {
private String n_name_like;//[名称]
public void setN_name_like(String n_name_like) {
this.n_name_like = n_name_like;
if(!ObjectUtils.isEmpty(this.n_name_like)){
this.getSearchCond().like("name", n_name_like);
}
}
private String n_property_valuation_eq;//[库存计价]
public void setN_property_valuation_eq(String n_property_valuation_eq) {
this.n_property_valuation_eq = n_property_valuation_eq;
if(!ObjectUtils.isEmpty(this.n_property_valuation_eq)){
this.getSearchCond().eq("property_valuation", n_property_valuation_eq);
}
}
private String n_property_cost_method_eq;//[成本方法]
public void setN_property_cost_method_eq(String n_property_cost_method_eq) {
this.n_property_cost_method_eq = n_property_cost_method_eq;
if(!ObjectUtils.isEmpty(this.n_property_cost_method_eq)){
this.getSearchCond().eq("property_cost_method", n_property_cost_method_eq);
}
}
private String n_write_uid_text_eq;//[最后更新人]
public void setN_write_uid_text_eq(String n_write_uid_text_eq) {
this.n_write_uid_text_eq = n_write_uid_text_eq;
if(!ObjectUtils.isEmpty(this.n_write_uid_text_eq)){
this.getSearchCond().eq("write_uid_text", n_write_uid_text_eq);
}
}
private String n_write_uid_text_like;//[最后更新人]
public void setN_write_uid_text_like(String n_write_uid_text_like) {
this.n_write_uid_text_like = n_write_uid_text_like;
if(!ObjectUtils.isEmpty(this.n_write_uid_text_like)){
this.getSearchCond().like("write_uid_text", n_write_uid_text_like);
}
}
private String n_parent_id_text_eq;//[上级类别]
public void setN_parent_id_text_eq(String n_parent_id_text_eq) {
this.n_parent_id_text_eq = n_parent_id_text_eq;
if(!ObjectUtils.isEmpty(this.n_parent_id_text_eq)){
this.getSearchCond().eq("parent_id_text", n_parent_id_text_eq);
}
}
private String n_parent_id_text_like;//[上级类别]
public void setN_parent_id_text_like(String n_parent_id_text_like) {
this.n_parent_id_text_like = n_parent_id_text_like;
if(!ObjectUtils.isEmpty(this.n_parent_id_text_like)){
this.getSearchCond().like("parent_id_text", n_parent_id_text_like);
}
}
private String n_create_uid_text_eq;//[创建人]
public void setN_create_uid_text_eq(String n_create_uid_text_eq) {
this.n_create_uid_text_eq = n_create_uid_text_eq;
if(!ObjectUtils.isEmpty(this.n_create_uid_text_eq)){
this.getSearchCond().eq("create_uid_text", n_create_uid_text_eq);
}
}
private String n_create_uid_text_like;//[创建人]
public void setN_create_uid_text_like(String n_create_uid_text_like) {
this.n_create_uid_text_like = n_create_uid_text_like;
if(!ObjectUtils.isEmpty(this.n_create_uid_text_like)){
this.getSearchCond().like("create_uid_text", n_create_uid_text_like);
}
}
private String n_removal_strategy_id_text_eq;//[强制下架策略]
public void setN_removal_strategy_id_text_eq(String n_removal_strategy_id_text_eq) {
this.n_removal_strategy_id_text_eq = n_removal_strategy_id_text_eq;
if(!ObjectUtils.isEmpty(this.n_removal_strategy_id_text_eq)){
this.getSearchCond().eq("removal_strategy_id_text", n_removal_strategy_id_text_eq);
}
}
private String n_removal_strategy_id_text_like;//[强制下架策略]
public void setN_removal_strategy_id_text_like(String n_removal_strategy_id_text_like) {
this.n_removal_strategy_id_text_like = n_removal_strategy_id_text_like;
if(!ObjectUtils.isEmpty(this.n_removal_strategy_id_text_like)){
this.getSearchCond().like("removal_strategy_id_text", n_removal_strategy_id_text_like);
}
}
private Long n_parent_id_eq;//[上级类别]
public void setN_parent_id_eq(Long n_parent_id_eq) {
this.n_parent_id_eq = n_parent_id_eq;
if(!ObjectUtils.isEmpty(this.n_parent_id_eq)){
this.getSearchCond().eq("parent_id", n_parent_id_eq);
}
}
private Long n_create_uid_eq;//[创建人]
public void setN_create_uid_eq(Long n_create_uid_eq) {
this.n_create_uid_eq = n_create_uid_eq;
if(!ObjectUtils.isEmpty(this.n_create_uid_eq)){
this.getSearchCond().eq("create_uid", n_create_uid_eq);
}
}
private Long n_removal_strategy_id_eq;//[强制下架策略]
public void setN_removal_strategy_id_eq(Long n_removal_strategy_id_eq) {
this.n_removal_strategy_id_eq = n_removal_strategy_id_eq;
if(!ObjectUtils.isEmpty(this.n_removal_strategy_id_eq)){
this.getSearchCond().eq("removal_strategy_id", n_removal_strategy_id_eq);
}
}
private Long n_write_uid_eq;//[最后更新人]
public void setN_write_uid_eq(Long n_write_uid_eq) {
this.n_write_uid_eq = n_write_uid_eq;
if(!ObjectUtils.isEmpty(this.n_write_uid_eq)){
this.getSearchCond().eq("write_uid", n_write_uid_eq);
}
}
/** /**
* 启用快速搜索 * 启用快速搜索
......
...@@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSONObject;
public interface Product_categoryMapper extends BaseMapper<Product_category>{ public interface Product_categoryMapper extends BaseMapper<Product_category>{
Page<Product_category> searchDefault(IPage page, @Param("srf") Product_categorySearchContext context, @Param("ew") Wrapper<Product_category> wrapper) ;
@Override @Override
Product_category selectById(Serializable id); Product_category selectById(Serializable id);
@Override @Override
...@@ -61,4 +62,12 @@ public interface Product_categoryMapper extends BaseMapper<Product_category>{ ...@@ -61,4 +62,12 @@ public interface Product_categoryMapper extends BaseMapper<Product_category>{
@Delete("${sql}") @Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param); boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<Product_category> selectByParentId(@Param("id") Serializable id) ;
List<Product_category> selectByRemovalStrategyId(@Param("id") Serializable id) ;
List<Product_category> selectByCreateUid(@Param("id") Serializable id) ;
List<Product_category> selectByWriteUid(@Param("id") Serializable id) ;
} }
...@@ -33,6 +33,19 @@ public interface IProduct_categoryService extends IService<Product_category>{ ...@@ -33,6 +33,19 @@ public interface IProduct_categoryService extends IService<Product_category>{
boolean remove(Long key) ; boolean remove(Long key) ;
void removeBatch(Collection<Long> idList) ; void removeBatch(Collection<Long> idList) ;
Product_category get(Long key) ; Product_category get(Long key) ;
Product_category getDraft(Product_category et) ;
boolean checkKey(Product_category et) ;
boolean save(Product_category et) ;
void saveBatch(List<Product_category> list) ;
Page<Product_category> searchDefault(Product_categorySearchContext context) ;
List<Product_category> selectByParentId(Long id) ;
void removeByParentId(Long id) ;
List<Product_category> selectByRemovalStrategyId(Long id) ;
void removeByRemovalStrategyId(Long id) ;
List<Product_category> selectByCreateUid(Long id) ;
void removeByCreateUid(Long id) ;
List<Product_category> selectByWriteUid(Long id) ;
void removeByWriteUid(Long id) ;
/** /**
*自定义查询SQL *自定义查询SQL
* @param sql select * from table where id =#{et.param} * @param sql select * from table where id =#{et.param}
......
...@@ -140,7 +140,99 @@ public class Product_categoryServiceImpl extends ServiceImpl<Product_categoryMap ...@@ -140,7 +140,99 @@ public class Product_categoryServiceImpl extends ServiceImpl<Product_categoryMap
return et; return et;
} }
@Override
public Product_category getDraft(Product_category et) {
fillParentData(et);
return et;
}
@Override
public boolean checkKey(Product_category et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
}
@Override
@Transactional
public boolean save(Product_category et) {
if(!saveOrUpdate(et))
return false;
return true;
}
@Override
@Transactional
public boolean saveOrUpdate(Product_category et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
}
@Override
@Transactional
public boolean saveBatch(Collection<Product_category> list) {
list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
@Transactional
public void saveBatch(List<Product_category> list) {
list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize);
}
@Override
public List<Product_category> selectByParentId(Long id) {
return baseMapper.selectByParentId(id);
}
@Override
public void removeByParentId(Long id) {
this.remove(new QueryWrapper<Product_category>().eq("parent_id",id));
}
@Override
public List<Product_category> selectByRemovalStrategyId(Long id) {
return baseMapper.selectByRemovalStrategyId(id);
}
@Override
public void removeByRemovalStrategyId(Long id) {
this.remove(new QueryWrapper<Product_category>().eq("removal_strategy_id",id));
}
@Override
public List<Product_category> selectByCreateUid(Long id) {
return baseMapper.selectByCreateUid(id);
}
@Override
public void removeByCreateUid(Long id) {
this.remove(new QueryWrapper<Product_category>().eq("create_uid",id));
}
@Override
public List<Product_category> selectByWriteUid(Long id) {
return baseMapper.selectByWriteUid(id);
}
@Override
public void removeByWriteUid(Long id) {
this.remove(new QueryWrapper<Product_category>().eq("write_uid",id));
}
/**
* 查询集合 数据集
*/
@Override
public Page<Product_category> searchDefault(Product_categorySearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<Product_category> pages=baseMapper.searchDefault(context.getPages(),context,context.getSelectCond());
return new PageImpl<Product_category>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
<mapper namespace="cn.ibizlab.businesscentral.core.odoo_product.mapper.Product_categoryMapper"> <mapper namespace="cn.ibizlab.businesscentral.core.odoo_product.mapper.Product_categoryMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性--> <!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="Product_categoryResultMap" databaseId="postgresql">
<![CDATA[select t1.* from (SELECT t1.COMPLETE_NAME, t1.CREATE_DATE, t1.CREATE_UID, t51.NAME AS CREATE_UID_TEXT, t1.ID, t1.NAME, t1.PARENT_ID, t31.NAME AS PARENT_ID_TEXT, t1.PARENT_PATH, t1.REMOVAL_STRATEGY_ID, t61.NAME AS REMOVAL_STRATEGY_ID_TEXT, t1.WRITE_DATE, t1.WRITE_UID, t21.NAME AS WRITE_UID_TEXT FROM PRODUCT_CATEGORY t1 LEFT JOIN RES_USERS t11 ON t1.WRITE_UID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN PRODUCT_CATEGORY t31 ON t1.PARENT_ID = t31.ID LEFT JOIN RES_USERS t41 ON t1.CREATE_UID = t41.ID LEFT JOIN RES_PARTNER t51 ON t41.PARTNER_ID = t51.ID LEFT JOIN PRODUCT_REMOVAL t61 ON t1.REMOVAL_STRATEGY_ID = t61.ID ) t1 where id=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 --> <!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="Product_categoryResultMap" type="cn.ibizlab.businesscentral.core.odoo_product.domain.Product_category" autoMapping="true"> <resultMap id="Product_categoryResultMap" type="cn.ibizlab.businesscentral.core.odoo_product.domain.Product_category" autoMapping="true">
...@@ -48,9 +51,52 @@ ...@@ -48,9 +51,52 @@
</resultMap> </resultMap>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_PRODUCT_CATEGORY__PRODUCT_CATEGORY__PARENT_ID] --> <!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_PRODUCT_CATEGORY__PRODUCT_CATEGORY__PARENT_ID] -->
<select id="selectByParentId" resultMap="Product_categoryResultMap">
select t1.* from (
<include refid="Default" />
) t1
where parent_id=#{id}
</select>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_PRODUCT_CATEGORY__PRODUCT_REMOVAL__REMOVAL_STRATEGY_ID] --> <!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_PRODUCT_CATEGORY__PRODUCT_REMOVAL__REMOVAL_STRATEGY_ID] -->
<select id="selectByRemovalStrategyId" resultMap="Product_categoryResultMap">
select t1.* from (
<include refid="Default" />
) t1
where removal_strategy_id=#{id}
</select>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_PRODUCT_CATEGORY__RES_USERS__CREATE_UID] --> <!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_PRODUCT_CATEGORY__RES_USERS__CREATE_UID] -->
<select id="selectByCreateUid" resultMap="Product_categoryResultMap">
select t1.* from (
<include refid="Default" />
) t1
where create_uid=#{id}
</select>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_PRODUCT_CATEGORY__RES_USERS__WRITE_UID] --> <!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_PRODUCT_CATEGORY__RES_USERS__WRITE_UID] -->
<select id="selectByWriteUid" resultMap="Product_categoryResultMap">
select t1.* from (
<include refid="Default" />
) t1
where write_uid=#{id}
</select>
<!--数据集合[Default]-->
<select id="searchDefault" parameterType="cn.ibizlab.businesscentral.core.odoo_product.filter.Product_categorySearchContext" resultMap="Product_categoryResultMap">
select t1.* from (
<include refid="Default" />
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[Default]-->
<sql id="Default" databaseId="postgresql">
<![CDATA[ SELECT t1.COMPLETE_NAME, t1.CREATE_DATE, t1.CREATE_UID, t51.NAME AS CREATE_UID_TEXT, t1.ID, t1.NAME, t1.PARENT_ID, t31.NAME AS PARENT_ID_TEXT, t1.PARENT_PATH, t1.REMOVAL_STRATEGY_ID, t61.NAME AS REMOVAL_STRATEGY_ID_TEXT, t1.WRITE_DATE, t1.WRITE_UID, t21.NAME AS WRITE_UID_TEXT FROM PRODUCT_CATEGORY t1 LEFT JOIN RES_USERS t11 ON t1.WRITE_UID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN PRODUCT_CATEGORY t31 ON t1.PARENT_ID = t31.ID LEFT JOIN RES_USERS t41 ON t1.CREATE_UID = t41.ID LEFT JOIN RES_PARTNER t51 ON t41.PARTNER_ID = t51.ID LEFT JOIN PRODUCT_REMOVAL t61 ON t1.REMOVAL_STRATEGY_ID = t61.ID
]]>
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="postgresql">
<![CDATA[ SELECT t1.COMPLETE_NAME, t1.CREATE_DATE, t1.CREATE_UID, t51.NAME AS CREATE_UID_TEXT, t1.ID, t1.NAME, t1.PARENT_ID, t31.NAME AS PARENT_ID_TEXT, t1.PARENT_PATH, t1.REMOVAL_STRATEGY_ID, t61.NAME AS REMOVAL_STRATEGY_ID_TEXT, t1.WRITE_DATE, t1.WRITE_UID, t21.NAME AS WRITE_UID_TEXT FROM PRODUCT_CATEGORY t1 LEFT JOIN RES_USERS t11 ON t1.WRITE_UID = t11.ID LEFT JOIN RES_PARTNER t21 ON t11.PARTNER_ID = t21.ID LEFT JOIN PRODUCT_CATEGORY t31 ON t1.PARENT_ID = t31.ID LEFT JOIN RES_USERS t41 ON t1.CREATE_UID = t41.ID LEFT JOIN RES_PARTNER t51 ON t41.PARTNER_ID = t51.ID LEFT JOIN PRODUCT_REMOVAL t61 ON t1.REMOVAL_STRATEGY_ID = t61.ID
]]>
</sql>
</mapper> </mapper>
...@@ -109,6 +109,55 @@ public class Product_categoryResource { ...@@ -109,6 +109,55 @@ public class Product_categoryResource {
return ResponseEntity.status(HttpStatus.OK).body(dto); return ResponseEntity.status(HttpStatus.OK).body(dto);
} }
@ApiOperation(value = "获取产品种类草稿", tags = {"产品种类" }, notes = "获取产品种类草稿")
@RequestMapping(method = RequestMethod.GET, value = "/product_categories/getdraft")
public ResponseEntity<Product_categoryDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(product_categoryMapping.toDto(product_categoryService.getDraft(new Product_category())));
}
@ApiOperation(value = "检查产品种类", tags = {"产品种类" }, notes = "检查产品种类")
@RequestMapping(method = RequestMethod.POST, value = "/product_categories/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody Product_categoryDTO product_categorydto) {
return ResponseEntity.status(HttpStatus.OK).body(product_categoryService.checkKey(product_categoryMapping.toDomain(product_categorydto)));
}
@PreAuthorize("hasPermission(this.product_categoryMapping.toDomain(#product_categorydto),'iBizBusinessCentral-Product_category-Save')")
@ApiOperation(value = "保存产品种类", tags = {"产品种类" }, notes = "保存产品种类")
@RequestMapping(method = RequestMethod.POST, value = "/product_categories/save")
public ResponseEntity<Boolean> save(@RequestBody Product_categoryDTO product_categorydto) {
return ResponseEntity.status(HttpStatus.OK).body(product_categoryService.save(product_categoryMapping.toDomain(product_categorydto)));
}
@PreAuthorize("hasPermission(this.product_categoryMapping.toDomain(#product_categorydtos),'iBizBusinessCentral-Product_category-Save')")
@ApiOperation(value = "批量保存产品种类", tags = {"产品种类" }, notes = "批量保存产品种类")
@RequestMapping(method = RequestMethod.POST, value = "/product_categories/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<Product_categoryDTO> product_categorydtos) {
product_categoryService.saveBatch(product_categoryMapping.toDomain(product_categorydtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Product_category-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Product_category-Get')")
@ApiOperation(value = "获取数据集", tags = {"产品种类" } ,notes = "获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/product_categories/fetchdefault")
public ResponseEntity<List<Product_categoryDTO>> fetchDefault(Product_categorySearchContext context) {
Page<Product_category> domains = product_categoryService.searchDefault(context) ;
List<Product_categoryDTO> list = product_categoryMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Product_category-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Product_category-Get')")
@ApiOperation(value = "查询数据集", tags = {"产品种类" } ,notes = "查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/product_categories/searchdefault")
public ResponseEntity<Page<Product_categoryDTO>> searchDefault(@RequestBody Product_categorySearchContext context) {
Page<Product_category> domains = product_categoryService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(product_categoryMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
} }
...@@ -159,5 +159,135 @@ public class Product_productResource { ...@@ -159,5 +159,135 @@ public class Product_productResource {
} }
@PreAuthorize("hasPermission(this.product_productMapping.toDomain(#product_productdto),'iBizBusinessCentral-Product_product-Create')")
@ApiOperation(value = "根据产品模板建立产品", tags = {"产品" }, notes = "根据产品模板建立产品")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products")
public ResponseEntity<Product_productDTO> createByProduct_template(@PathVariable("product_template_id") Long product_template_id, @RequestBody Product_productDTO product_productdto) {
Product_product domain = product_productMapping.toDomain(product_productdto);
domain.setProductTmplId(product_template_id);
product_productService.create(domain);
Product_productDTO dto = product_productMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.product_productMapping.toDomain(#product_productdtos),'iBizBusinessCentral-Product_product-Create')")
@ApiOperation(value = "根据产品模板批量建立产品", tags = {"产品" }, notes = "根据产品模板批量建立产品")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/batch")
public ResponseEntity<Boolean> createBatchByProduct_template(@PathVariable("product_template_id") Long product_template_id, @RequestBody List<Product_productDTO> product_productdtos) {
List<Product_product> domainlist=product_productMapping.toDomain(product_productdtos);
for(Product_product domain:domainlist){
domain.setProductTmplId(product_template_id);
}
product_productService.createBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "product_product" , versionfield = "writeDate")
@PreAuthorize("hasPermission(this.product_productService.get(#product_product_id),'iBizBusinessCentral-Product_product-Update')")
@ApiOperation(value = "根据产品模板更新产品", tags = {"产品" }, notes = "根据产品模板更新产品")
@RequestMapping(method = RequestMethod.PUT, value = "/product_templates/{product_template_id}/product_products/{product_product_id}")
public ResponseEntity<Product_productDTO> updateByProduct_template(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Product_productDTO product_productdto) {
Product_product domain = product_productMapping.toDomain(product_productdto);
domain.setProductTmplId(product_template_id);
domain.setId(product_product_id);
product_productService.update(domain);
Product_productDTO dto = product_productMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.product_productService.getProductProductByEntities(this.product_productMapping.toDomain(#product_productdtos)),'iBizBusinessCentral-Product_product-Update')")
@ApiOperation(value = "根据产品模板批量更新产品", tags = {"产品" }, notes = "根据产品模板批量更新产品")
@RequestMapping(method = RequestMethod.PUT, value = "/product_templates/{product_template_id}/product_products/batch")
public ResponseEntity<Boolean> updateBatchByProduct_template(@PathVariable("product_template_id") Long product_template_id, @RequestBody List<Product_productDTO> product_productdtos) {
List<Product_product> domainlist=product_productMapping.toDomain(product_productdtos);
for(Product_product domain:domainlist){
domain.setProductTmplId(product_template_id);
}
product_productService.updateBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.product_productService.get(#product_product_id),'iBizBusinessCentral-Product_product-Remove')")
@ApiOperation(value = "根据产品模板删除产品", tags = {"产品" }, notes = "根据产品模板删除产品")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_templates/{product_template_id}/product_products/{product_product_id}")
public ResponseEntity<Boolean> removeByProduct_template(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id) {
return ResponseEntity.status(HttpStatus.OK).body(product_productService.remove(product_product_id));
}
@PreAuthorize("hasPermission(this.product_productService.getProductProductByIds(#ids),'iBizBusinessCentral-Product_product-Remove')")
@ApiOperation(value = "根据产品模板批量删除产品", tags = {"产品" }, notes = "根据产品模板批量删除产品")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_templates/{product_template_id}/product_products/batch")
public ResponseEntity<Boolean> removeBatchByProduct_template(@RequestBody List<Long> ids) {
product_productService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.product_productMapping.toDomain(returnObject.body),'iBizBusinessCentral-Product_product-Get')")
@ApiOperation(value = "根据产品模板获取产品", tags = {"产品" }, notes = "根据产品模板获取产品")
@RequestMapping(method = RequestMethod.GET, value = "/product_templates/{product_template_id}/product_products/{product_product_id}")
public ResponseEntity<Product_productDTO> getByProduct_template(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id) {
Product_product domain = product_productService.get(product_product_id);
Product_productDTO dto = product_productMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "根据产品模板获取产品草稿", tags = {"产品" }, notes = "根据产品模板获取产品草稿")
@RequestMapping(method = RequestMethod.GET, value = "/product_templates/{product_template_id}/product_products/getdraft")
public ResponseEntity<Product_productDTO> getDraftByProduct_template(@PathVariable("product_template_id") Long product_template_id) {
Product_product domain = new Product_product();
domain.setProductTmplId(product_template_id);
return ResponseEntity.status(HttpStatus.OK).body(product_productMapping.toDto(product_productService.getDraft(domain)));
}
@ApiOperation(value = "根据产品模板检查产品", tags = {"产品" }, notes = "根据产品模板检查产品")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/checkkey")
public ResponseEntity<Boolean> checkKeyByProduct_template(@PathVariable("product_template_id") Long product_template_id, @RequestBody Product_productDTO product_productdto) {
return ResponseEntity.status(HttpStatus.OK).body(product_productService.checkKey(product_productMapping.toDomain(product_productdto)));
}
@PreAuthorize("hasPermission(this.product_productMapping.toDomain(#product_productdto),'iBizBusinessCentral-Product_product-Save')")
@ApiOperation(value = "根据产品模板保存产品", tags = {"产品" }, notes = "根据产品模板保存产品")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/save")
public ResponseEntity<Boolean> saveByProduct_template(@PathVariable("product_template_id") Long product_template_id, @RequestBody Product_productDTO product_productdto) {
Product_product domain = product_productMapping.toDomain(product_productdto);
domain.setProductTmplId(product_template_id);
return ResponseEntity.status(HttpStatus.OK).body(product_productService.save(domain));
}
@PreAuthorize("hasPermission(this.product_productMapping.toDomain(#product_productdtos),'iBizBusinessCentral-Product_product-Save')")
@ApiOperation(value = "根据产品模板批量保存产品", tags = {"产品" }, notes = "根据产品模板批量保存产品")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/savebatch")
public ResponseEntity<Boolean> saveBatchByProduct_template(@PathVariable("product_template_id") Long product_template_id, @RequestBody List<Product_productDTO> product_productdtos) {
List<Product_product> domainlist=product_productMapping.toDomain(product_productdtos);
for(Product_product domain:domainlist){
domain.setProductTmplId(product_template_id);
}
product_productService.saveBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Product_product-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Product_product-Get')")
@ApiOperation(value = "根据产品模板获取数据集", tags = {"产品" } ,notes = "根据产品模板获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/product_templates/{product_template_id}/product_products/fetchdefault")
public ResponseEntity<List<Product_productDTO>> fetchProduct_productDefaultByProduct_template(@PathVariable("product_template_id") Long product_template_id,Product_productSearchContext context) {
context.setN_product_tmpl_id_eq(product_template_id);
Page<Product_product> domains = product_productService.searchDefault(context) ;
List<Product_productDTO> list = product_productMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Product_product-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Product_product-Get')")
@ApiOperation(value = "根据产品模板查询数据集", tags = {"产品" } ,notes = "根据产品模板查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/product_templates/{product_template_id}/product_products/searchdefault")
public ResponseEntity<Page<Product_productDTO>> searchProduct_productDefaultByProduct_template(@PathVariable("product_template_id") Long product_template_id, @RequestBody Product_productSearchContext context) {
context.setN_product_tmpl_id_eq(product_template_id);
Page<Product_product> domains = product_productService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(product_productMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
} }
...@@ -549,5 +549,135 @@ public class Product_supplierinfoResource { ...@@ -549,5 +549,135 @@ public class Product_supplierinfoResource {
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(product_supplierinfoMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(product_supplierinfoMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
@PreAuthorize("hasPermission(this.product_supplierinfoMapping.toDomain(#product_supplierinfodto),'iBizBusinessCentral-Product_supplierinfo-Create')")
@ApiOperation(value = "根据产品模板产品建立供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品建立供应商价格表")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos")
public ResponseEntity<Product_supplierinfoDTO> createByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Product_supplierinfoDTO product_supplierinfodto) {
Product_supplierinfo domain = product_supplierinfoMapping.toDomain(product_supplierinfodto);
domain.setProductId(product_product_id);
product_supplierinfoService.create(domain);
Product_supplierinfoDTO dto = product_supplierinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.product_supplierinfoMapping.toDomain(#product_supplierinfodtos),'iBizBusinessCentral-Product_supplierinfo-Create')")
@ApiOperation(value = "根据产品模板产品批量建立供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品批量建立供应商价格表")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/batch")
public ResponseEntity<Boolean> createBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Product_supplierinfoDTO> product_supplierinfodtos) {
List<Product_supplierinfo> domainlist=product_supplierinfoMapping.toDomain(product_supplierinfodtos);
for(Product_supplierinfo domain:domainlist){
domain.setProductId(product_product_id);
}
product_supplierinfoService.createBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "product_supplierinfo" , versionfield = "writeDate")
@PreAuthorize("hasPermission(this.product_supplierinfoService.get(#product_supplierinfo_id),'iBizBusinessCentral-Product_supplierinfo-Update')")
@ApiOperation(value = "根据产品模板产品更新供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品更新供应商价格表")
@RequestMapping(method = RequestMethod.PUT, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/{product_supplierinfo_id}")
public ResponseEntity<Product_supplierinfoDTO> updateByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("product_supplierinfo_id") Long product_supplierinfo_id, @RequestBody Product_supplierinfoDTO product_supplierinfodto) {
Product_supplierinfo domain = product_supplierinfoMapping.toDomain(product_supplierinfodto);
domain.setProductId(product_product_id);
domain.setId(product_supplierinfo_id);
product_supplierinfoService.update(domain);
Product_supplierinfoDTO dto = product_supplierinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.product_supplierinfoService.getProductSupplierinfoByEntities(this.product_supplierinfoMapping.toDomain(#product_supplierinfodtos)),'iBizBusinessCentral-Product_supplierinfo-Update')")
@ApiOperation(value = "根据产品模板产品批量更新供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品批量更新供应商价格表")
@RequestMapping(method = RequestMethod.PUT, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/batch")
public ResponseEntity<Boolean> updateBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Product_supplierinfoDTO> product_supplierinfodtos) {
List<Product_supplierinfo> domainlist=product_supplierinfoMapping.toDomain(product_supplierinfodtos);
for(Product_supplierinfo domain:domainlist){
domain.setProductId(product_product_id);
}
product_supplierinfoService.updateBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.product_supplierinfoService.get(#product_supplierinfo_id),'iBizBusinessCentral-Product_supplierinfo-Remove')")
@ApiOperation(value = "根据产品模板产品删除供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品删除供应商价格表")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/{product_supplierinfo_id}")
public ResponseEntity<Boolean> removeByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("product_supplierinfo_id") Long product_supplierinfo_id) {
return ResponseEntity.status(HttpStatus.OK).body(product_supplierinfoService.remove(product_supplierinfo_id));
}
@PreAuthorize("hasPermission(this.product_supplierinfoService.getProductSupplierinfoByIds(#ids),'iBizBusinessCentral-Product_supplierinfo-Remove')")
@ApiOperation(value = "根据产品模板产品批量删除供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品批量删除供应商价格表")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/batch")
public ResponseEntity<Boolean> removeBatchByProduct_templateProduct_product(@RequestBody List<Long> ids) {
product_supplierinfoService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.product_supplierinfoMapping.toDomain(returnObject.body),'iBizBusinessCentral-Product_supplierinfo-Get')")
@ApiOperation(value = "根据产品模板产品获取供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品获取供应商价格表")
@RequestMapping(method = RequestMethod.GET, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/{product_supplierinfo_id}")
public ResponseEntity<Product_supplierinfoDTO> getByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("product_supplierinfo_id") Long product_supplierinfo_id) {
Product_supplierinfo domain = product_supplierinfoService.get(product_supplierinfo_id);
Product_supplierinfoDTO dto = product_supplierinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "根据产品模板产品获取供应商价格表草稿", tags = {"供应商价格表" }, notes = "根据产品模板产品获取供应商价格表草稿")
@RequestMapping(method = RequestMethod.GET, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/getdraft")
public ResponseEntity<Product_supplierinfoDTO> getDraftByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id) {
Product_supplierinfo domain = new Product_supplierinfo();
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(product_supplierinfoMapping.toDto(product_supplierinfoService.getDraft(domain)));
}
@ApiOperation(value = "根据产品模板产品检查供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品检查供应商价格表")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/checkkey")
public ResponseEntity<Boolean> checkKeyByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Product_supplierinfoDTO product_supplierinfodto) {
return ResponseEntity.status(HttpStatus.OK).body(product_supplierinfoService.checkKey(product_supplierinfoMapping.toDomain(product_supplierinfodto)));
}
@PreAuthorize("hasPermission(this.product_supplierinfoMapping.toDomain(#product_supplierinfodto),'iBizBusinessCentral-Product_supplierinfo-Save')")
@ApiOperation(value = "根据产品模板产品保存供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品保存供应商价格表")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/save")
public ResponseEntity<Boolean> saveByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Product_supplierinfoDTO product_supplierinfodto) {
Product_supplierinfo domain = product_supplierinfoMapping.toDomain(product_supplierinfodto);
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(product_supplierinfoService.save(domain));
}
@PreAuthorize("hasPermission(this.product_supplierinfoMapping.toDomain(#product_supplierinfodtos),'iBizBusinessCentral-Product_supplierinfo-Save')")
@ApiOperation(value = "根据产品模板产品批量保存供应商价格表", tags = {"供应商价格表" }, notes = "根据产品模板产品批量保存供应商价格表")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/savebatch")
public ResponseEntity<Boolean> saveBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Product_supplierinfoDTO> product_supplierinfodtos) {
List<Product_supplierinfo> domainlist=product_supplierinfoMapping.toDomain(product_supplierinfodtos);
for(Product_supplierinfo domain:domainlist){
domain.setProductId(product_product_id);
}
product_supplierinfoService.saveBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Product_supplierinfo-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Product_supplierinfo-Get')")
@ApiOperation(value = "根据产品模板产品获取数据集", tags = {"供应商价格表" } ,notes = "根据产品模板产品获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/fetchdefault")
public ResponseEntity<List<Product_supplierinfoDTO>> fetchProduct_supplierinfoDefaultByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id,Product_supplierinfoSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Product_supplierinfo> domains = product_supplierinfoService.searchDefault(context) ;
List<Product_supplierinfoDTO> list = product_supplierinfoMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Product_supplierinfo-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Product_supplierinfo-Get')")
@ApiOperation(value = "根据产品模板产品查询数据集", tags = {"供应商价格表" } ,notes = "根据产品模板产品查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/product_templates/{product_template_id}/product_products/{product_product_id}/product_supplierinfos/searchdefault")
public ResponseEntity<Page<Product_supplierinfoDTO>> searchProduct_supplierinfoDefaultByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Product_supplierinfoSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Product_supplierinfo> domains = product_supplierinfoService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(product_supplierinfoMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
} }
...@@ -159,6 +159,136 @@ public class Purchase_order_lineResource { ...@@ -159,6 +159,136 @@ public class Purchase_order_lineResource {
} }
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedto),'iBizBusinessCentral-Purchase_order_line-Create')")
@ApiOperation(value = "根据产品建立采购订单行", tags = {"采购订单行" }, notes = "根据产品建立采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_order_lines")
public ResponseEntity<Purchase_order_lineDTO> createByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
Purchase_order_line domain = purchase_order_lineMapping.toDomain(purchase_order_linedto);
domain.setProductId(product_product_id);
purchase_order_lineService.create(domain);
Purchase_order_lineDTO dto = purchase_order_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedtos),'iBizBusinessCentral-Purchase_order_line-Create')")
@ApiOperation(value = "根据产品批量建立采购订单行", tags = {"采购订单行" }, notes = "根据产品批量建立采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_order_lines/batch")
public ResponseEntity<Boolean> createBatchByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_order_lineDTO> purchase_order_linedtos) {
List<Purchase_order_line> domainlist=purchase_order_lineMapping.toDomain(purchase_order_linedtos);
for(Purchase_order_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_order_lineService.createBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "purchase_order_line" , versionfield = "writeDate")
@PreAuthorize("hasPermission(this.purchase_order_lineService.get(#purchase_order_line_id),'iBizBusinessCentral-Purchase_order_line-Update')")
@ApiOperation(value = "根据产品更新采购订单行", tags = {"采购订单行" }, notes = "根据产品更新采购订单行")
@RequestMapping(method = RequestMethod.PUT, value = "/product_products/{product_product_id}/purchase_order_lines/{purchase_order_line_id}")
public ResponseEntity<Purchase_order_lineDTO> updateByProduct_product(@PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_order_line_id") Long purchase_order_line_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
Purchase_order_line domain = purchase_order_lineMapping.toDomain(purchase_order_linedto);
domain.setProductId(product_product_id);
domain.setId(purchase_order_line_id);
purchase_order_lineService.update(domain);
Purchase_order_lineDTO dto = purchase_order_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.purchase_order_lineService.getPurchaseOrderLineByEntities(this.purchase_order_lineMapping.toDomain(#purchase_order_linedtos)),'iBizBusinessCentral-Purchase_order_line-Update')")
@ApiOperation(value = "根据产品批量更新采购订单行", tags = {"采购订单行" }, notes = "根据产品批量更新采购订单行")
@RequestMapping(method = RequestMethod.PUT, value = "/product_products/{product_product_id}/purchase_order_lines/batch")
public ResponseEntity<Boolean> updateBatchByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_order_lineDTO> purchase_order_linedtos) {
List<Purchase_order_line> domainlist=purchase_order_lineMapping.toDomain(purchase_order_linedtos);
for(Purchase_order_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_order_lineService.updateBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.purchase_order_lineService.get(#purchase_order_line_id),'iBizBusinessCentral-Purchase_order_line-Remove')")
@ApiOperation(value = "根据产品删除采购订单行", tags = {"采购订单行" }, notes = "根据产品删除采购订单行")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_products/{product_product_id}/purchase_order_lines/{purchase_order_line_id}")
public ResponseEntity<Boolean> removeByProduct_product(@PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_order_line_id") Long purchase_order_line_id) {
return ResponseEntity.status(HttpStatus.OK).body(purchase_order_lineService.remove(purchase_order_line_id));
}
@PreAuthorize("hasPermission(this.purchase_order_lineService.getPurchaseOrderLineByIds(#ids),'iBizBusinessCentral-Purchase_order_line-Remove')")
@ApiOperation(value = "根据产品批量删除采购订单行", tags = {"采购订单行" }, notes = "根据产品批量删除采购订单行")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_products/{product_product_id}/purchase_order_lines/batch")
public ResponseEntity<Boolean> removeBatchByProduct_product(@RequestBody List<Long> ids) {
purchase_order_lineService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(returnObject.body),'iBizBusinessCentral-Purchase_order_line-Get')")
@ApiOperation(value = "根据产品获取采购订单行", tags = {"采购订单行" }, notes = "根据产品获取采购订单行")
@RequestMapping(method = RequestMethod.GET, value = "/product_products/{product_product_id}/purchase_order_lines/{purchase_order_line_id}")
public ResponseEntity<Purchase_order_lineDTO> getByProduct_product(@PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_order_line_id") Long purchase_order_line_id) {
Purchase_order_line domain = purchase_order_lineService.get(purchase_order_line_id);
Purchase_order_lineDTO dto = purchase_order_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "根据产品获取采购订单行草稿", tags = {"采购订单行" }, notes = "根据产品获取采购订单行草稿")
@RequestMapping(method = RequestMethod.GET, value = "/product_products/{product_product_id}/purchase_order_lines/getdraft")
public ResponseEntity<Purchase_order_lineDTO> getDraftByProduct_product(@PathVariable("product_product_id") Long product_product_id) {
Purchase_order_line domain = new Purchase_order_line();
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(purchase_order_lineMapping.toDto(purchase_order_lineService.getDraft(domain)));
}
@ApiOperation(value = "根据产品检查采购订单行", tags = {"采购订单行" }, notes = "根据产品检查采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_order_lines/checkkey")
public ResponseEntity<Boolean> checkKeyByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
return ResponseEntity.status(HttpStatus.OK).body(purchase_order_lineService.checkKey(purchase_order_lineMapping.toDomain(purchase_order_linedto)));
}
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedto),'iBizBusinessCentral-Purchase_order_line-Save')")
@ApiOperation(value = "根据产品保存采购订单行", tags = {"采购订单行" }, notes = "根据产品保存采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_order_lines/save")
public ResponseEntity<Boolean> saveByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
Purchase_order_line domain = purchase_order_lineMapping.toDomain(purchase_order_linedto);
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(purchase_order_lineService.save(domain));
}
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedtos),'iBizBusinessCentral-Purchase_order_line-Save')")
@ApiOperation(value = "根据产品批量保存采购订单行", tags = {"采购订单行" }, notes = "根据产品批量保存采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_order_lines/savebatch")
public ResponseEntity<Boolean> saveBatchByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_order_lineDTO> purchase_order_linedtos) {
List<Purchase_order_line> domainlist=purchase_order_lineMapping.toDomain(purchase_order_linedtos);
for(Purchase_order_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_order_lineService.saveBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_order_line-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Purchase_order_line-Get')")
@ApiOperation(value = "根据产品获取数据集", tags = {"采购订单行" } ,notes = "根据产品获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/product_products/{product_product_id}/purchase_order_lines/fetchdefault")
public ResponseEntity<List<Purchase_order_lineDTO>> fetchPurchase_order_lineDefaultByProduct_product(@PathVariable("product_product_id") Long product_product_id,Purchase_order_lineSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Purchase_order_line> domains = purchase_order_lineService.searchDefault(context) ;
List<Purchase_order_lineDTO> list = purchase_order_lineMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_order_line-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Purchase_order_line-Get')")
@ApiOperation(value = "根据产品查询数据集", tags = {"采购订单行" } ,notes = "根据产品查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/product_products/{product_product_id}/purchase_order_lines/searchdefault")
public ResponseEntity<Page<Purchase_order_lineDTO>> searchPurchase_order_lineDefaultByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_order_lineSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Purchase_order_line> domains = purchase_order_lineService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(purchase_order_lineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedto),'iBizBusinessCentral-Purchase_order_line-Create')") @PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedto),'iBizBusinessCentral-Purchase_order_line-Create')")
@ApiOperation(value = "根据采购订单建立采购订单行", tags = {"采购订单行" }, notes = "根据采购订单建立采购订单行") @ApiOperation(value = "根据采购订单建立采购订单行", tags = {"采购订单行" }, notes = "根据采购订单建立采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/purchase_orders/{purchase_order_id}/purchase_order_lines") @RequestMapping(method = RequestMethod.POST, value = "/purchase_orders/{purchase_order_id}/purchase_order_lines")
...@@ -290,6 +420,136 @@ public class Purchase_order_lineResource { ...@@ -290,6 +420,136 @@ public class Purchase_order_lineResource {
.body(new PageImpl(purchase_order_lineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(purchase_order_lineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedto),'iBizBusinessCentral-Purchase_order_line-Create')") @PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedto),'iBizBusinessCentral-Purchase_order_line-Create')")
@ApiOperation(value = "根据产品模板产品建立采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品建立采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines")
public ResponseEntity<Purchase_order_lineDTO> createByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
Purchase_order_line domain = purchase_order_lineMapping.toDomain(purchase_order_linedto);
domain.setProductId(product_product_id);
purchase_order_lineService.create(domain);
Purchase_order_lineDTO dto = purchase_order_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedtos),'iBizBusinessCentral-Purchase_order_line-Create')")
@ApiOperation(value = "根据产品模板产品批量建立采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品批量建立采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/batch")
public ResponseEntity<Boolean> createBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_order_lineDTO> purchase_order_linedtos) {
List<Purchase_order_line> domainlist=purchase_order_lineMapping.toDomain(purchase_order_linedtos);
for(Purchase_order_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_order_lineService.createBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "purchase_order_line" , versionfield = "writeDate")
@PreAuthorize("hasPermission(this.purchase_order_lineService.get(#purchase_order_line_id),'iBizBusinessCentral-Purchase_order_line-Update')")
@ApiOperation(value = "根据产品模板产品更新采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品更新采购订单行")
@RequestMapping(method = RequestMethod.PUT, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/{purchase_order_line_id}")
public ResponseEntity<Purchase_order_lineDTO> updateByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_order_line_id") Long purchase_order_line_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
Purchase_order_line domain = purchase_order_lineMapping.toDomain(purchase_order_linedto);
domain.setProductId(product_product_id);
domain.setId(purchase_order_line_id);
purchase_order_lineService.update(domain);
Purchase_order_lineDTO dto = purchase_order_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.purchase_order_lineService.getPurchaseOrderLineByEntities(this.purchase_order_lineMapping.toDomain(#purchase_order_linedtos)),'iBizBusinessCentral-Purchase_order_line-Update')")
@ApiOperation(value = "根据产品模板产品批量更新采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品批量更新采购订单行")
@RequestMapping(method = RequestMethod.PUT, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/batch")
public ResponseEntity<Boolean> updateBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_order_lineDTO> purchase_order_linedtos) {
List<Purchase_order_line> domainlist=purchase_order_lineMapping.toDomain(purchase_order_linedtos);
for(Purchase_order_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_order_lineService.updateBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.purchase_order_lineService.get(#purchase_order_line_id),'iBizBusinessCentral-Purchase_order_line-Remove')")
@ApiOperation(value = "根据产品模板产品删除采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品删除采购订单行")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/{purchase_order_line_id}")
public ResponseEntity<Boolean> removeByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_order_line_id") Long purchase_order_line_id) {
return ResponseEntity.status(HttpStatus.OK).body(purchase_order_lineService.remove(purchase_order_line_id));
}
@PreAuthorize("hasPermission(this.purchase_order_lineService.getPurchaseOrderLineByIds(#ids),'iBizBusinessCentral-Purchase_order_line-Remove')")
@ApiOperation(value = "根据产品模板产品批量删除采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品批量删除采购订单行")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/batch")
public ResponseEntity<Boolean> removeBatchByProduct_templateProduct_product(@RequestBody List<Long> ids) {
purchase_order_lineService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(returnObject.body),'iBizBusinessCentral-Purchase_order_line-Get')")
@ApiOperation(value = "根据产品模板产品获取采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品获取采购订单行")
@RequestMapping(method = RequestMethod.GET, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/{purchase_order_line_id}")
public ResponseEntity<Purchase_order_lineDTO> getByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_order_line_id") Long purchase_order_line_id) {
Purchase_order_line domain = purchase_order_lineService.get(purchase_order_line_id);
Purchase_order_lineDTO dto = purchase_order_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "根据产品模板产品获取采购订单行草稿", tags = {"采购订单行" }, notes = "根据产品模板产品获取采购订单行草稿")
@RequestMapping(method = RequestMethod.GET, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/getdraft")
public ResponseEntity<Purchase_order_lineDTO> getDraftByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id) {
Purchase_order_line domain = new Purchase_order_line();
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(purchase_order_lineMapping.toDto(purchase_order_lineService.getDraft(domain)));
}
@ApiOperation(value = "根据产品模板产品检查采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品检查采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/checkkey")
public ResponseEntity<Boolean> checkKeyByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
return ResponseEntity.status(HttpStatus.OK).body(purchase_order_lineService.checkKey(purchase_order_lineMapping.toDomain(purchase_order_linedto)));
}
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedto),'iBizBusinessCentral-Purchase_order_line-Save')")
@ApiOperation(value = "根据产品模板产品保存采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品保存采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/save")
public ResponseEntity<Boolean> saveByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
Purchase_order_line domain = purchase_order_lineMapping.toDomain(purchase_order_linedto);
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(purchase_order_lineService.save(domain));
}
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedtos),'iBizBusinessCentral-Purchase_order_line-Save')")
@ApiOperation(value = "根据产品模板产品批量保存采购订单行", tags = {"采购订单行" }, notes = "根据产品模板产品批量保存采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/savebatch")
public ResponseEntity<Boolean> saveBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_order_lineDTO> purchase_order_linedtos) {
List<Purchase_order_line> domainlist=purchase_order_lineMapping.toDomain(purchase_order_linedtos);
for(Purchase_order_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_order_lineService.saveBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_order_line-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Purchase_order_line-Get')")
@ApiOperation(value = "根据产品模板产品获取数据集", tags = {"采购订单行" } ,notes = "根据产品模板产品获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/fetchdefault")
public ResponseEntity<List<Purchase_order_lineDTO>> fetchPurchase_order_lineDefaultByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id,Purchase_order_lineSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Purchase_order_line> domains = purchase_order_lineService.searchDefault(context) ;
List<Purchase_order_lineDTO> list = purchase_order_lineMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_order_line-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Purchase_order_line-Get')")
@ApiOperation(value = "根据产品模板产品查询数据集", tags = {"采购订单行" } ,notes = "根据产品模板产品查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_order_lines/searchdefault")
public ResponseEntity<Page<Purchase_order_lineDTO>> searchPurchase_order_lineDefaultByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_order_lineSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Purchase_order_line> domains = purchase_order_lineService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(purchase_order_lineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasPermission(this.purchase_order_lineMapping.toDomain(#purchase_order_linedto),'iBizBusinessCentral-Purchase_order_line-Create')")
@ApiOperation(value = "根据采购申请采购订单建立采购订单行", tags = {"采购订单行" }, notes = "根据采购申请采购订单建立采购订单行") @ApiOperation(value = "根据采购申请采购订单建立采购订单行", tags = {"采购订单行" }, notes = "根据采购申请采购订单建立采购订单行")
@RequestMapping(method = RequestMethod.POST, value = "/purchase_requisitions/{purchase_requisition_id}/purchase_orders/{purchase_order_id}/purchase_order_lines") @RequestMapping(method = RequestMethod.POST, value = "/purchase_requisitions/{purchase_requisition_id}/purchase_orders/{purchase_order_id}/purchase_order_lines")
public ResponseEntity<Purchase_order_lineDTO> createByPurchase_requisitionPurchase_order(@PathVariable("purchase_requisition_id") Long purchase_requisition_id, @PathVariable("purchase_order_id") Long purchase_order_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) { public ResponseEntity<Purchase_order_lineDTO> createByPurchase_requisitionPurchase_order(@PathVariable("purchase_requisition_id") Long purchase_requisition_id, @PathVariable("purchase_order_id") Long purchase_order_id, @RequestBody Purchase_order_lineDTO purchase_order_linedto) {
......
...@@ -158,6 +158,135 @@ public class Purchase_requisition_lineResource { ...@@ -158,6 +158,135 @@ public class Purchase_requisition_lineResource {
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Create-all')")
@ApiOperation(value = "根据产品建立采购申请行", tags = {"采购申请行" }, notes = "根据产品建立采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_requisition_lines")
public ResponseEntity<Purchase_requisition_lineDTO> createByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
Purchase_requisition_line domain = purchase_requisition_lineMapping.toDomain(purchase_requisition_linedto);
domain.setProductId(product_product_id);
purchase_requisition_lineService.create(domain);
Purchase_requisition_lineDTO dto = purchase_requisition_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Create-all')")
@ApiOperation(value = "根据产品批量建立采购申请行", tags = {"采购申请行" }, notes = "根据产品批量建立采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_requisition_lines/batch")
public ResponseEntity<Boolean> createBatchByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_requisition_lineDTO> purchase_requisition_linedtos) {
List<Purchase_requisition_line> domainlist=purchase_requisition_lineMapping.toDomain(purchase_requisition_linedtos);
for(Purchase_requisition_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_requisition_lineService.createBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Update-all')")
@ApiOperation(value = "根据产品更新采购申请行", tags = {"采购申请行" }, notes = "根据产品更新采购申请行")
@RequestMapping(method = RequestMethod.PUT, value = "/product_products/{product_product_id}/purchase_requisition_lines/{purchase_requisition_line_id}")
public ResponseEntity<Purchase_requisition_lineDTO> updateByProduct_product(@PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_requisition_line_id") Long purchase_requisition_line_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
Purchase_requisition_line domain = purchase_requisition_lineMapping.toDomain(purchase_requisition_linedto);
domain.setProductId(product_product_id);
domain.setId(purchase_requisition_line_id);
purchase_requisition_lineService.update(domain);
Purchase_requisition_lineDTO dto = purchase_requisition_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Update-all')")
@ApiOperation(value = "根据产品批量更新采购申请行", tags = {"采购申请行" }, notes = "根据产品批量更新采购申请行")
@RequestMapping(method = RequestMethod.PUT, value = "/product_products/{product_product_id}/purchase_requisition_lines/batch")
public ResponseEntity<Boolean> updateBatchByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_requisition_lineDTO> purchase_requisition_linedtos) {
List<Purchase_requisition_line> domainlist=purchase_requisition_lineMapping.toDomain(purchase_requisition_linedtos);
for(Purchase_requisition_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_requisition_lineService.updateBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Remove-all')")
@ApiOperation(value = "根据产品删除采购申请行", tags = {"采购申请行" }, notes = "根据产品删除采购申请行")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_products/{product_product_id}/purchase_requisition_lines/{purchase_requisition_line_id}")
public ResponseEntity<Boolean> removeByProduct_product(@PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_requisition_line_id") Long purchase_requisition_line_id) {
return ResponseEntity.status(HttpStatus.OK).body(purchase_requisition_lineService.remove(purchase_requisition_line_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Remove-all')")
@ApiOperation(value = "根据产品批量删除采购申请行", tags = {"采购申请行" }, notes = "根据产品批量删除采购申请行")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_products/{product_product_id}/purchase_requisition_lines/batch")
public ResponseEntity<Boolean> removeBatchByProduct_product(@RequestBody List<Long> ids) {
purchase_requisition_lineService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Get-all')")
@ApiOperation(value = "根据产品获取采购申请行", tags = {"采购申请行" }, notes = "根据产品获取采购申请行")
@RequestMapping(method = RequestMethod.GET, value = "/product_products/{product_product_id}/purchase_requisition_lines/{purchase_requisition_line_id}")
public ResponseEntity<Purchase_requisition_lineDTO> getByProduct_product(@PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_requisition_line_id") Long purchase_requisition_line_id) {
Purchase_requisition_line domain = purchase_requisition_lineService.get(purchase_requisition_line_id);
Purchase_requisition_lineDTO dto = purchase_requisition_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "根据产品获取采购申请行草稿", tags = {"采购申请行" }, notes = "根据产品获取采购申请行草稿")
@RequestMapping(method = RequestMethod.GET, value = "/product_products/{product_product_id}/purchase_requisition_lines/getdraft")
public ResponseEntity<Purchase_requisition_lineDTO> getDraftByProduct_product(@PathVariable("product_product_id") Long product_product_id) {
Purchase_requisition_line domain = new Purchase_requisition_line();
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(purchase_requisition_lineMapping.toDto(purchase_requisition_lineService.getDraft(domain)));
}
@ApiOperation(value = "根据产品检查采购申请行", tags = {"采购申请行" }, notes = "根据产品检查采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_requisition_lines/checkkey")
public ResponseEntity<Boolean> checkKeyByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
return ResponseEntity.status(HttpStatus.OK).body(purchase_requisition_lineService.checkKey(purchase_requisition_lineMapping.toDomain(purchase_requisition_linedto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Save-all')")
@ApiOperation(value = "根据产品保存采购申请行", tags = {"采购申请行" }, notes = "根据产品保存采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_requisition_lines/save")
public ResponseEntity<Boolean> saveByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
Purchase_requisition_line domain = purchase_requisition_lineMapping.toDomain(purchase_requisition_linedto);
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(purchase_requisition_lineService.save(domain));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Save-all')")
@ApiOperation(value = "根据产品批量保存采购申请行", tags = {"采购申请行" }, notes = "根据产品批量保存采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_products/{product_product_id}/purchase_requisition_lines/savebatch")
public ResponseEntity<Boolean> saveBatchByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_requisition_lineDTO> purchase_requisition_linedtos) {
List<Purchase_requisition_line> domainlist=purchase_requisition_lineMapping.toDomain(purchase_requisition_linedtos);
for(Purchase_requisition_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_requisition_lineService.saveBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-searchDefault-all')")
@ApiOperation(value = "根据产品获取数据集", tags = {"采购申请行" } ,notes = "根据产品获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/product_products/{product_product_id}/purchase_requisition_lines/fetchdefault")
public ResponseEntity<List<Purchase_requisition_lineDTO>> fetchPurchase_requisition_lineDefaultByProduct_product(@PathVariable("product_product_id") Long product_product_id,Purchase_requisition_lineSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Purchase_requisition_line> domains = purchase_requisition_lineService.searchDefault(context) ;
List<Purchase_requisition_lineDTO> list = purchase_requisition_lineMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-searchDefault-all')")
@ApiOperation(value = "根据产品查询数据集", tags = {"采购申请行" } ,notes = "根据产品查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/product_products/{product_product_id}/purchase_requisition_lines/searchdefault")
public ResponseEntity<Page<Purchase_requisition_lineDTO>> searchPurchase_requisition_lineDefaultByProduct_product(@PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_requisition_lineSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Purchase_requisition_line> domains = purchase_requisition_lineService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(purchase_requisition_lineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Create-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Create-all')")
@ApiOperation(value = "根据采购申请建立采购申请行", tags = {"采购申请行" }, notes = "根据采购申请建立采购申请行") @ApiOperation(value = "根据采购申请建立采购申请行", tags = {"采购申请行" }, notes = "根据采购申请建立采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/purchase_requisitions/{purchase_requisition_id}/purchase_requisition_lines") @RequestMapping(method = RequestMethod.POST, value = "/purchase_requisitions/{purchase_requisition_id}/purchase_requisition_lines")
...@@ -288,6 +417,135 @@ public class Purchase_requisition_lineResource { ...@@ -288,6 +417,135 @@ public class Purchase_requisition_lineResource {
.body(new PageImpl(purchase_requisition_lineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(purchase_requisition_lineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Create-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Create-all')")
@ApiOperation(value = "根据产品模板产品建立采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品建立采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines")
public ResponseEntity<Purchase_requisition_lineDTO> createByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
Purchase_requisition_line domain = purchase_requisition_lineMapping.toDomain(purchase_requisition_linedto);
domain.setProductId(product_product_id);
purchase_requisition_lineService.create(domain);
Purchase_requisition_lineDTO dto = purchase_requisition_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Create-all')")
@ApiOperation(value = "根据产品模板产品批量建立采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品批量建立采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/batch")
public ResponseEntity<Boolean> createBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_requisition_lineDTO> purchase_requisition_linedtos) {
List<Purchase_requisition_line> domainlist=purchase_requisition_lineMapping.toDomain(purchase_requisition_linedtos);
for(Purchase_requisition_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_requisition_lineService.createBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Update-all')")
@ApiOperation(value = "根据产品模板产品更新采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品更新采购申请行")
@RequestMapping(method = RequestMethod.PUT, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/{purchase_requisition_line_id}")
public ResponseEntity<Purchase_requisition_lineDTO> updateByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_requisition_line_id") Long purchase_requisition_line_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
Purchase_requisition_line domain = purchase_requisition_lineMapping.toDomain(purchase_requisition_linedto);
domain.setProductId(product_product_id);
domain.setId(purchase_requisition_line_id);
purchase_requisition_lineService.update(domain);
Purchase_requisition_lineDTO dto = purchase_requisition_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Update-all')")
@ApiOperation(value = "根据产品模板产品批量更新采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品批量更新采购申请行")
@RequestMapping(method = RequestMethod.PUT, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/batch")
public ResponseEntity<Boolean> updateBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_requisition_lineDTO> purchase_requisition_linedtos) {
List<Purchase_requisition_line> domainlist=purchase_requisition_lineMapping.toDomain(purchase_requisition_linedtos);
for(Purchase_requisition_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_requisition_lineService.updateBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Remove-all')")
@ApiOperation(value = "根据产品模板产品删除采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品删除采购申请行")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/{purchase_requisition_line_id}")
public ResponseEntity<Boolean> removeByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_requisition_line_id") Long purchase_requisition_line_id) {
return ResponseEntity.status(HttpStatus.OK).body(purchase_requisition_lineService.remove(purchase_requisition_line_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Remove-all')")
@ApiOperation(value = "根据产品模板产品批量删除采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品批量删除采购申请行")
@RequestMapping(method = RequestMethod.DELETE, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/batch")
public ResponseEntity<Boolean> removeBatchByProduct_templateProduct_product(@RequestBody List<Long> ids) {
purchase_requisition_lineService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Get-all')")
@ApiOperation(value = "根据产品模板产品获取采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品获取采购申请行")
@RequestMapping(method = RequestMethod.GET, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/{purchase_requisition_line_id}")
public ResponseEntity<Purchase_requisition_lineDTO> getByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @PathVariable("purchase_requisition_line_id") Long purchase_requisition_line_id) {
Purchase_requisition_line domain = purchase_requisition_lineService.get(purchase_requisition_line_id);
Purchase_requisition_lineDTO dto = purchase_requisition_lineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "根据产品模板产品获取采购申请行草稿", tags = {"采购申请行" }, notes = "根据产品模板产品获取采购申请行草稿")
@RequestMapping(method = RequestMethod.GET, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/getdraft")
public ResponseEntity<Purchase_requisition_lineDTO> getDraftByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id) {
Purchase_requisition_line domain = new Purchase_requisition_line();
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(purchase_requisition_lineMapping.toDto(purchase_requisition_lineService.getDraft(domain)));
}
@ApiOperation(value = "根据产品模板产品检查采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品检查采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/checkkey")
public ResponseEntity<Boolean> checkKeyByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
return ResponseEntity.status(HttpStatus.OK).body(purchase_requisition_lineService.checkKey(purchase_requisition_lineMapping.toDomain(purchase_requisition_linedto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Save-all')")
@ApiOperation(value = "根据产品模板产品保存采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品保存采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/save")
public ResponseEntity<Boolean> saveByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
Purchase_requisition_line domain = purchase_requisition_lineMapping.toDomain(purchase_requisition_linedto);
domain.setProductId(product_product_id);
return ResponseEntity.status(HttpStatus.OK).body(purchase_requisition_lineService.save(domain));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Save-all')")
@ApiOperation(value = "根据产品模板产品批量保存采购申请行", tags = {"采购申请行" }, notes = "根据产品模板产品批量保存采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/savebatch")
public ResponseEntity<Boolean> saveBatchByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody List<Purchase_requisition_lineDTO> purchase_requisition_linedtos) {
List<Purchase_requisition_line> domainlist=purchase_requisition_lineMapping.toDomain(purchase_requisition_linedtos);
for(Purchase_requisition_line domain:domainlist){
domain.setProductId(product_product_id);
}
purchase_requisition_lineService.saveBatch(domainlist);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-searchDefault-all')")
@ApiOperation(value = "根据产品模板产品获取数据集", tags = {"采购申请行" } ,notes = "根据产品模板产品获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/fetchdefault")
public ResponseEntity<List<Purchase_requisition_lineDTO>> fetchPurchase_requisition_lineDefaultByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id,Purchase_requisition_lineSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Purchase_requisition_line> domains = purchase_requisition_lineService.searchDefault(context) ;
List<Purchase_requisition_lineDTO> list = purchase_requisition_lineMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-searchDefault-all')")
@ApiOperation(value = "根据产品模板产品查询数据集", tags = {"采购申请行" } ,notes = "根据产品模板产品查询数据集")
@RequestMapping(method= RequestMethod.POST , value="/product_templates/{product_template_id}/product_products/{product_product_id}/purchase_requisition_lines/searchdefault")
public ResponseEntity<Page<Purchase_requisition_lineDTO>> searchPurchase_requisition_lineDefaultByProduct_templateProduct_product(@PathVariable("product_template_id") Long product_template_id, @PathVariable("product_product_id") Long product_product_id, @RequestBody Purchase_requisition_lineSearchContext context) {
context.setN_product_id_eq(product_product_id);
Page<Purchase_requisition_line> domains = purchase_requisition_lineService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(purchase_requisition_lineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_requisition_line-Create-all')")
@ApiOperation(value = "根据供应商采购申请建立采购申请行", tags = {"采购申请行" }, notes = "根据供应商采购申请建立采购申请行") @ApiOperation(value = "根据供应商采购申请建立采购申请行", tags = {"采购申请行" }, notes = "根据供应商采购申请建立采购申请行")
@RequestMapping(method = RequestMethod.POST, value = "/res_suppliers/{res_supplier_id}/purchase_requisitions/{purchase_requisition_id}/purchase_requisition_lines") @RequestMapping(method = RequestMethod.POST, value = "/res_suppliers/{res_supplier_id}/purchase_requisitions/{purchase_requisition_id}/purchase_requisition_lines")
public ResponseEntity<Purchase_requisition_lineDTO> createByRes_supplierPurchase_requisition(@PathVariable("res_supplier_id") Long res_supplier_id, @PathVariable("purchase_requisition_id") Long purchase_requisition_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) { public ResponseEntity<Purchase_requisition_lineDTO> createByRes_supplierPurchase_requisition(@PathVariable("res_supplier_id") Long res_supplier_id, @PathVariable("purchase_requisition_id") Long purchase_requisition_id, @RequestBody Purchase_requisition_lineDTO purchase_requisition_linedto) {
......
...@@ -11,6 +11,7 @@ import java.util.Map; ...@@ -11,6 +11,7 @@ import java.util.Map;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import cn.ibizlab.businesscentral.util.cache.listener.RedisPublisher; import cn.ibizlab.businesscentral.util.cache.listener.RedisPublisher;
import cn.ibizlab.businesscentral.util.enums.RedisChannelTopic; import cn.ibizlab.businesscentral.util.enums.RedisChannelTopic;
import org.springframework.util.ObjectUtils;
/** /**
* 缓存分层类 * 缓存分层类
...@@ -58,11 +59,16 @@ public class LayeringCache extends AbstractValueAdaptingCache { ...@@ -58,11 +59,16 @@ public class LayeringCache extends AbstractValueAdaptingCache {
@Override @Override
public ValueWrapper get(Object key) { public ValueWrapper get(Object key) {
ValueWrapper wrapper = caffeineCache.get(key); ValueWrapper wrapper = caffeineCache.get(key);
log.debug("查询一级缓存 key:{},value:{}", key,wrapper); Object value=ObjectUtils.isEmpty(wrapper)?null:wrapper.get();
if (wrapper == null) { log.debug("查询一级缓存 key:{} ,value:{}", key,value);
if (ObjectUtils.isEmpty(value)) {
wrapper = redisCache.get(key); wrapper = redisCache.get(key);
caffeineCache.put(key, wrapper == null ? null : wrapper.get()); value=ObjectUtils.isEmpty(wrapper)?null:wrapper.get();
log.debug("查询二级缓存,并将数据放到一级缓存。 key:{}", key); log.debug("查询二级缓存 key:{} ,value:{}", key,value);
if(!ObjectUtils.isEmpty(value)){
caffeineCache.put(key, value);
log.debug("查询二级缓存,并将数据放到一级缓存。 key:{} ,value:{}", key,value);
}
} }
return wrapper; return wrapper;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册