Kaynağa Gözat

出口价格库

lazhaoqian 3 yıl önce
ebeveyn
işleme
1fdbc7f4bd

+ 3 - 0
blade-ops/blade-swagger/src/main/resources/application-dev.yml

@@ -25,4 +25,7 @@ knife4j:
       - name: 商城管理
         uri: 127.0.0.1:1080
         location: /store-goods/v2/api-docs
+      - name: 运维管理
+        uri: 127.0.0.1:1080
+        location: /blade-mocha-item/v2/api-docs
 

+ 213 - 0
blade-service-api/blade-mocha-item-api/src/main/java/org/springblade/mocha/entity/PriceBank.java

@@ -0,0 +1,213 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.mocha.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 出口价格库实体类
+ *
+ * @author BladeX
+ * @since 2021-12-06
+ */
+@Data
+@TableName("basic_price_bank")
+@ApiModel(value = "PriceBank对象", description = "出口价格库")
+public class PriceBank implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 主键
+	*/
+		@ApiModelProperty(value = "主键")
+		private Long id;
+	/**
+	* 货物id
+	*/
+		@ApiModelProperty(value = "货物id")
+		private Long itemId;
+	/**
+	* 商品编码
+	*/
+		@ApiModelProperty(value = "商品编码")
+		private String code;
+	/**
+	* 商品名称
+	*/
+		@ApiModelProperty(value = "商品名称")
+		private String cname;
+	/**
+	* 规格
+	*/
+		@ApiModelProperty(value = "规格")
+		private String specs;
+	/**
+	 * 产品属性
+	 */
+		@ApiModelProperty(value = "产品属性")
+		private String goodNature;
+
+	/**
+	* 供应商
+	*/
+		@ApiModelProperty(value = "供应商")
+		private Long corpId;
+	/**
+	* 供应商名称
+	*/
+		@ApiModelProperty(value = "供应商名称")
+		private String corpName;
+	/**
+	* 币别
+	*/
+		@ApiModelProperty(value = "币别")
+		private String currency;
+	/**
+	* FOB系数
+	*/
+		@ApiModelProperty(value = "FOB系数")
+		private BigDecimal coefficient;
+	/**
+	* 价格类型 销售价格 XS 采购价格 CG
+	*/
+		@ApiModelProperty(value = "价格类型 销售价格 XS 采购价格 CG")
+		private String billType;
+	/**
+	* 价格类型(枚举:国内、进口、出口)
+	*/
+		@ApiModelProperty(value = "价格类型(枚举:国内、进口、出口)")
+		private String tradeType;
+	/**
+	* 有效期开始
+	*/
+		@ApiModelProperty(value = "有效期开始")
+		private Date startTime;
+	/**
+	* 有效期结束
+	*/
+		@ApiModelProperty(value = "有效期结束")
+		private Date endTime;
+	/**
+	* 采购人或销售人
+	*/
+		@ApiModelProperty(value = "采购人或销售人")
+		private String person;
+	/**
+	* 最新采购价或最新销售价
+	*/
+		@ApiModelProperty(value = "最新采购价或最新销售价")
+		private BigDecimal price;
+	/**
+	* 最新价格日期
+	*/
+		@ApiModelProperty(value = "最新价格日期")
+		private Date priceTime;
+	/**
+	* 历史价格1
+	*/
+		@ApiModelProperty(value = "历史价格1")
+		private BigDecimal priceOne;
+	/**
+	* 历史价格日期
+	*/
+		@ApiModelProperty(value = "历史价格日期")
+		private Date priceOneTime;
+	/**
+	* 历史价格2
+	*/
+		@ApiModelProperty(value = "历史价格2")
+		private BigDecimal priceTwo;
+	/**
+	* 历史价格日期
+	*/
+		@ApiModelProperty(value = "历史价格日期")
+		private Date priceTwoTime;
+	/**
+	* 历史价格3
+	*/
+		@ApiModelProperty(value = "历史价格3")
+		private BigDecimal priceThree;
+	/**
+	* 历史价格日期
+	*/
+		@ApiModelProperty(value = "历史价格日期")
+		private Date priceThreeTime;
+	/**
+	* 采购备注或销售备注
+	*/
+		@ApiModelProperty(value = "采购备注或销售备注")
+		private String remarks;
+	/**
+	* 版本
+	*/
+		@ApiModelProperty(value = "版本")
+		private String version;
+	/**
+	 * 租户id
+	 */
+		@ApiModelProperty(value = "租户id")
+		private String tenantId;
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+	/**
+	* 修改人
+	*/
+		@ApiModelProperty(value = "修改人")
+		private Long updateUser;
+	/**
+	* 修改时间
+	*/
+		@ApiModelProperty(value = "修改时间")
+		private Date updateTime;
+	/**
+	* 状态(0 正常 1停用)
+	*/
+		@ApiModelProperty(value = "状态(0 正常 1停用)")
+		private Integer status;
+	/**
+	* 是否已删除(0 否 1是)
+	*/
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		@TableLogic
+		private Integer isDeleted;
+
+
+}

+ 36 - 0
blade-service-api/blade-mocha-item-api/src/main/java/org/springblade/mocha/vo/PriceBankVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.mocha.vo;
+
+import org.springblade.mocha.entity.PriceBank;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 出口价格库视图实体类
+ *
+ * @author BladeX
+ * @since 2021-12-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "PriceBankVO对象", description = "出口价格库")
+public class PriceBankVO extends PriceBank {
+	private static final long serialVersionUID = 1L;
+
+}

+ 126 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/controller/PriceBankController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.mocha.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.mocha.entity.PriceBank;
+import org.springblade.mocha.vo.PriceBankVO;
+import org.springblade.mocha.service.IPriceBankService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 出口价格库 控制器
+ *
+ * @author BladeX
+ * @since 2021-12-06
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/pricebank")
+@Api(value = "出口价格库", tags = "出口价格库接口")
+public class PriceBankController extends BladeController {
+
+	private final IPriceBankService priceBankService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入priceBank")
+	public R<PriceBank> detail(PriceBank priceBank) {
+		PriceBank detail = priceBankService.getOne(Condition.getQueryWrapper(priceBank));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 出口价格库
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入priceBank")
+	public R<IPage<PriceBank>> list(PriceBank priceBank, Query query) {
+		IPage<PriceBank> pages = priceBankService.page(Condition.getPage(query), Condition.getQueryWrapper(priceBank));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 出口价格库
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入priceBank")
+	public R<IPage<PriceBankVO>> page(PriceBankVO priceBank, Query query) {
+		IPage<PriceBankVO> pages = priceBankService.selectPriceBankPage(Condition.getPage(query), priceBank);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 出口价格库
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入priceBank")
+	public R save(@Valid @RequestBody PriceBank priceBank) {
+		return R.status(priceBankService.save(priceBank));
+	}
+
+	/**
+	 * 修改 出口价格库
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入priceBank")
+	public R update(@Valid @RequestBody PriceBank priceBank) {
+		return R.status(priceBankService.updateById(priceBank));
+	}
+
+	/**
+	 * 新增或修改 出口价格库
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入priceBank")
+	public R submit(@Valid @RequestBody PriceBank priceBank) {
+		return R.data(priceBankService.savePrice(priceBank));
+	}
+
+
+	/**
+	 * 删除 出口价格库
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(priceBankService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 50 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/mapper/PriceBankMapper.java

@@ -0,0 +1,50 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.mocha.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.mocha.entity.PriceBank;
+import org.springblade.mocha.vo.PriceBankVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 出口价格库 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-12-06
+ */
+public interface PriceBankMapper extends BaseMapper<PriceBank> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param priceBank
+	 * @return
+	 */
+	List<PriceBankVO> selectPriceBankPage(IPage page, PriceBankVO priceBank);
+
+	/**
+	 * 更新价格库信息
+	 * @param id
+	 * @return
+	 */
+	boolean updatePrice(@Param("id") Long id);
+
+}

+ 60 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/mapper/PriceBankMapper.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.mocha.mapper.PriceBankMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="priceBankResultMap" type="org.springblade.mocha.entity.PriceBank">
+        <id column="id" property="id"/>
+        <result column="pid" property="pid"/>
+        <result column="item_id" property="itemId"/>
+        <result column="code" property="code"/>
+        <result column="cname" property="cname"/>
+        <result column="specs" property="specs"/>
+        <result column="corp_id" property="corpId"/>
+        <result column="corp_name" property="corpName"/>
+        <result column="currency" property="currency"/>
+        <result column="coefficient" property="coefficient"/>
+        <result column="bill_type" property="billType"/>
+        <result column="trade_type" property="tradeType"/>
+        <result column="start_time" property="startTime"/>
+        <result column="end_time" property="endTime"/>
+        <result column="person" property="person"/>
+        <result column="price" property="price"/>
+        <result column="price_time" property="priceTime"/>
+        <result column="price_one" property="priceOne"/>
+        <result column="price_one_time" property="priceOneTime"/>
+        <result column="price_two" property="priceTwo"/>
+        <result column="price_two_time" property="priceTwoTime"/>
+        <result column="price_three" property="priceThree"/>
+        <result column="price_three_time" property="priceThreeTime"/>
+        <result column="remarks" property="remarks"/>
+        <result column="version" property="version"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="good_nature" property="goodNature"/>
+    </resultMap>
+
+
+    <select id="selectPriceBankPage" resultMap="priceBankResultMap">
+        select * from basic_price_bank where is_deleted = 0
+    </select>
+    <update id="updatePrice" parameterType="long">
+        UPDATE
+	basic_price_bank
+	SET
+		price_one = price,
+		price_one_time = price_time,
+		price_two = price_one,
+		price_two_time = price_one_time,
+		price_three = price_two,
+		price_three_time = price_two_time
+	WHERE
+		id = #{id}
+    </update>
+
+</mapper>

+ 48 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/service/IPriceBankService.java

@@ -0,0 +1,48 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.mocha.service;
+
+import org.springblade.mocha.entity.PriceBank;
+import org.springblade.mocha.vo.PriceBankVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 出口价格库 服务类
+ *
+ * @author BladeX
+ * @since 2021-12-06
+ */
+public interface IPriceBankService extends IService<PriceBank> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param priceBank
+	 * @return
+	 */
+	IPage<PriceBankVO> selectPriceBankPage(IPage<PriceBankVO> page, PriceBankVO priceBank);
+
+	/**
+	 * 保存修改价格库信息
+	 * @param priceBank
+	 * @return
+	 */
+	PriceBank savePrice(PriceBank priceBank);
+
+}

+ 69 - 0
blade-service/blade-mocha-item/src/main/java/org/springblade/mocha/service/impl/PriceBankServiceImpl.java

@@ -0,0 +1,69 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.mocha.service.impl;
+
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.mocha.entity.PriceBank;
+import org.springblade.mocha.vo.PriceBankVO;
+import org.springblade.mocha.mapper.PriceBankMapper;
+import org.springblade.mocha.service.IPriceBankService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.Date;
+
+/**
+ * 出口价格库 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-12-06
+ */
+@Service
+public class PriceBankServiceImpl extends ServiceImpl<PriceBankMapper, PriceBank> implements IPriceBankService {
+
+	@Override
+	public IPage<PriceBankVO> selectPriceBankPage(IPage<PriceBankVO> page, PriceBankVO priceBank) {
+		return page.setRecords(baseMapper.selectPriceBankPage(page, priceBank));
+	}
+
+	@Override
+	public PriceBank savePrice(PriceBank priceBank) {
+		if (priceBank.getId() == null){
+			priceBank.setCreateTime(new Date());
+			priceBank.setCreateUser(SecureUtil.getUserId());
+			priceBank.setPerson(SecureUtil.getUserName());
+			priceBank.setTenantId(SecureUtil.getTenantId());
+			priceBank.setPriceTime(new Date());
+			baseMapper.insert(priceBank);
+		}else {
+			baseMapper.updatePrice(priceBank.getId());//更新历史价格
+			PriceBank bank = baseMapper.selectById(priceBank.getId());//查询最新历史价格
+			priceBank.setPriceOne(bank.getPriceOne());
+			priceBank.setPriceOneTime(bank.getPriceOneTime());
+			priceBank.setPriceTwo(bank.getPriceTwo());
+			priceBank.setPriceTwoTime(bank.getPriceTwoTime());
+			priceBank.setPriceThree(bank.getPriceThree());
+			priceBank.setPriceThreeTime(bank.getPriceThreeTime());
+			priceBank.setUpdateTime(new Date());
+			priceBank.setUpdateUser(SecureUtil.getUserId());
+			baseMapper.updateById(priceBank);
+		}
+		return priceBank;
+	}
+
+}

+ 5 - 0
blade-service/blade-mocha-item/src/main/resources/application-dev.yml

@@ -19,3 +19,8 @@ oss:
   secret-key: minioadmin
   bucket-name: bladex
 
+#swagger文档
+swagger:
+  base-packages:
+    - org.springblade.mocha
+