Procházet zdrojové kódy

Merge remote-tracking branch 'origin/dev' into dev

hejq před 8 roky
rodič
revize
8f9d56bd90

+ 21 - 21
src/main/java/com/uas/platform/b2b/controller/BaseInfoController.java

@@ -532,25 +532,25 @@ public class BaseInfoController {
 		return new ModelMap("content", list);
 	}
 
-	/**
-	 * 统计未阅读单据各个状态数量
-	 *
-	 * @return
-	 * @author wangmh
-	 */
-	@RequestMapping(value = "/unread", method = RequestMethod.GET, headers = "Accept=application/json")
-	@ResponseBody
-	@ResponseStatus(value = HttpStatus.OK)
-	public ModelMap getOrderUnreadCount() {
-		final ModelMap modelMap = new ModelMap();
-		List<Object[]> list = productService.getProductCount("sale");
-		int all = 0;
-		int value;
-		for(Object[] objects : list){
-			value = Integer.valueOf(objects[0].toString());
-			all = all + value;
-		}
-		modelMap.put("all", all);
-		return modelMap;
-	}
+//	/**
+//	 * 统计未阅读单据各个状态数量
+//	 *
+//	 * @return
+//	 * @author wangmh
+//	 */
+//	@RequestMapping(value = "/unread", method = RequestMethod.GET, headers = "Accept=application/json")
+//	@ResponseBody
+//	@ResponseStatus(value = HttpStatus.OK)
+//	public ModelMap getOrderUnreadCount() {
+//		final ModelMap modelMap = new ModelMap();
+//		List<Object[]> list = productService.getProductCount("sale");
+//		int all = 0;
+//		int value;
+//		for(Object[] objects : list){
+//			value = Integer.valueOf(objects[0].toString());
+//			all = all + value;
+//		}
+//		modelMap.put("all", all);
+//		return modelMap;
+//	}
 }

+ 11 - 11
src/main/java/com/uas/platform/b2b/dao/ProductDao.java

@@ -230,14 +230,14 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
 	@Procedure(procedureName = "PRODUCT$BUSINESSSTATUS")
 	public Integer findProductBusinessStatusById(Long id);
 
-	/**
-	 * 获得每种单据状态的数量
-	 *
-	 * @param ids 单据id
-	 * @return
-	 */
-	@Query("select count(p), p.status from Product p where p.id in :ids group by p.status")
-	public List<Object[]> getUnreadCountEveryStatus(@Param("ids") List<Long> ids);
+//	/**
+//	 * 获得每种单据状态的数量
+//	 *
+//	 * @param ids 单据id
+//	 * @return
+//	 */
+//	@Query("select count(p), p.status from Product p where p.id in :ids group by p.status")
+//	public List<Object[]> getUnreadCountEveryStatus(@Param("ids") List<Long> ids);
 
 	/**
 	 * 通过型号和品牌查询物料是否存在
@@ -254,10 +254,10 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
 	 *
 	 * @param enUU 物料所属企业UU
 	 * @param code 物料号
-	 * @param b2benabled 是否启用字段
+	 * @param b2bDisabled 是否禁用  1为禁用  其他为未禁用
 	 */
 	@Transactional
 	@Modifying
-	@Query("update Product p set p.b2benabled = :b2benabled where p.enUU = :enUU and p.code = :code")
-	int updateB2bEnabled(@Param("enUU") Long enUU, @Param("code") String code, @Param("b2benabled") Short b2benabled);
+	@Query("update Product p set p.productStatus.b2bDisabled = :b2bDisabled where p.enUU = :enUU and p.code = :code")
+	int updateB2bEnabled(@Param("enUU") Long enUU, @Param("code") String code, @Param("b2bDisabled") Short b2bDisabled);
 }

+ 3 - 3
src/main/java/com/uas/platform/b2b/erp/controller/ProdController.java

@@ -112,14 +112,14 @@ public class ProdController {
 	 * UAS端禁用物料时调用此接口使B2B也禁用此物料
 	 * 通过物料编码(code)
 	 *
-	 * @param data
+	 * @param data 禁用的物料单号
 	 */
 	@RequestMapping(value = "/updateB2bEnabled", method = RequestMethod.POST)
 	@ResponseBody
 	public int updateB2bEnabled(@RequestParam("data") String data) throws UnsupportedEncodingException {
 		String code = URLDecoder.decode(data, "UTF-8");
-		Short b2benabled = Constant.YES;
-		return productService.updateB2bEnabled(code, b2benabled);
+		Short b2bDisabled = Constant.YES;
+		return productService.updateB2bEnabled(code, b2bDisabled);
 	}
 
 	/**

+ 2 - 2
src/main/java/com/uas/platform/b2b/erp/model/Prod.java

@@ -277,9 +277,9 @@ public class Prod {
 		product.setBrand(this.pr_brand);
 		if (this.pr_status != null) {
 			if (this.pr_status.equals(Status.DISABLED.getPhrase())) {
-				product.setB2benabled(Constant.YES);
+				product.getProductStatus().setB2bDisabled(Constant.YES);
 			} else {
-				product.setB2benabled(null);
+				product.getProductStatus().setB2bDisabled(null);
 			}
 
 //			if (this.pr_status.equals(Status.AUDITED.getPhrase())) {

+ 12 - 11
src/main/java/com/uas/platform/b2b/mobile/controller/SaleController.java

@@ -498,19 +498,20 @@ public class SaleController {
 	/**
 	 * 作为卖家,回复收到的采购订单
 	 *
-	 * @param json
-	 * @param orderItemId
+	 * @param json   采购单回复实体json串
 	 * @return
 	 */
-	@RequestMapping(value = "/items/{orderItemId}/reply", method = RequestMethod.POST)
-	public ModelMap replyOrderItem(@RequestParam String json, @PathVariable("orderItemId") Long orderItemId) throws UnsupportedEncodingException {
-		PurchaseOrderReply reply = FlexJsonUtils.fromJson(URLDecoder.decode(json, "utf-8"), PurchaseOrderReply.class);
-		PurchaseOrderItem orderItem = new PurchaseOrderItem();
-		orderItem.setId(orderItemId);
-		reply.setOrderItem(orderItem);
-		reply = purchaseOrderService.reply(reply);
-		logger.log("客户采购单", "App单个回复客户采购明细", reply.replyDescription(), reply.getOrderItem().getOrder().getCode(),
-				orderItemId);
+	@RequestMapping(value = "/reply", method = RequestMethod.POST)
+	public ModelMap replyOrderItem(String json) throws UnsupportedEncodingException {
+		List<PurchaseOrderReply> replies = FlexJsonUtils.fromJsonArray(URLDecoder.decode(json, "utf-8"), PurchaseOrderReply.class);
+		for (PurchaseOrderReply reply : replies) {
+            PurchaseOrderItem item = new PurchaseOrderItem();
+            item.setId(reply.getPdId());
+            reply.setOrderItem(item);
+            reply = purchaseOrderService.reply(reply);
+            logger.log("客户采购单", "App回复单个客户采购单明细", reply.replyDescription(), reply.getOrderItem().getOrder().getCode(),
+                    item.getId());
+        }
 		return new ModelMap("success", "true");
 	}
 

+ 164 - 117
src/main/java/com/uas/platform/b2b/model/Product.java

@@ -92,19 +92,6 @@ public class Product {
 	@Column(name = "pr_ltinstock")
 	private Double ltinstock;
 
-	/**
-	 * 状态
-	 */
-	@Column(name = "pr_status")
-	@StatusColumn
-	private Integer status;
-
-	/**
-	 * 库存数
-	 */
-	@Column(name = "pr_stock")
-	private Double stock;
-
 	/**
 	 * 价格
 	 */
@@ -117,12 +104,6 @@ public class Product {
 	@Column(name = "pr_brand")
 	private String brand;
 
-	/**
-	 * 发货地址
-	 */
-	@Column(name = "pr_shipaddr")
-	private String shipAddr;
-
 	/**
 	 * 买方ERP物料ID
 	 */
@@ -198,9 +179,8 @@ public class Product {
 	/**
 	 * 附件
 	 */
-	@OneToOne(cascade = { CascadeType.ALL })
-	@JoinColumn(name = "pr_attachment")
-	private Attach attach;
+	@Column(name = "pr_attachment")
+	private String attachment;
 
 	/**
 	 * 类目(平台)(中文)
@@ -220,12 +200,6 @@ public class Product {
 	@Column(name = "pr_pcmpcode")
 	private String pcmpcode;
 
-	/**
-	 * 信息提示(导入物料时给出提示)
-	 */
-	@Column(name = "pr_message")
-	private String message;
-
 	/**
 	 * 是否是标准物料<br>
 	 * 1.YES<br>
@@ -270,14 +244,6 @@ public class Product {
 	@Column(name = "pr_downloadstatus")
 	private Integer downloadstatus;
 
-	/**
-	 * 是否有业务逻辑关系<br>
-	 * 1. 是<br>
-	 * 0. 否
-	 */
-	@Column(name = "pr_isbusiness")
-	private Short isbusiness;
-
 	/**
 	 * 图片
 	 */
@@ -285,27 +251,11 @@ public class Product {
 	private String img;
 
 	/**
-	 * 
+	 * 
 	 */
 	@Column(name = "pr_encapsulation")
 	private String encapsulation;
 
-	/**
-	 * b2c可用状态;<br>
-	 * 1 为不存在相同的记录。<br>
-	 * 0 为已经存在相同的记录
-	 */
-	@Column(name = "pr_b2cenabled")
-	private Short b2cenabled;
-
-	/**
-	 * uas与b2b可用状态;<br>
-	 * 1 已禁用 <br>
-	 * 0 可用状态,未禁用
-	 */
-	@Column(name = "pr_b2benabled")
-	private Short b2benabled;
-
 	/**
 	 * 匹配成标准的日期
 	 */
@@ -336,6 +286,71 @@ public class Product {
 	@Column(name = "pr_taxprecon")
 	private String taxprecon;
 
+	/**
+	 * ERP库存
+	 */
+	@Column(name = "pr_reserve")
+	private Double reserve;
+
+	/**
+	 * 标准类目id
+	 */
+	@Column(name = "pr_kindid")
+	private Long kindId;
+
+	/**
+	 * 标准品牌id
+	 */
+	@Column(name = "pr_pbrandid")
+	private Long pbrandId;
+
+	/**
+	 * 标准品牌uuid
+	 */
+	@Column(name = "pr_pbranduuid")
+	private Long pbrandUuid;
+
+	/**
+	 * 包装方式
+	 */
+	@Column(name = "pr_packaging")
+	private String packaging;
+
+	/**
+	 * 产品建立时间
+	 */
+	@Column(name = "pr_create_time")
+	private Date createTime;
+
+	/**
+	 * 产品生产日期
+	 */
+	@Column(name = "pr_manufacturedate")
+	private Date manufactureDate;
+
+	/**
+	 * 最大交期
+	 */
+	@Column(name = "pr_maxdelivery")
+	private Short maxDelivery;
+
+	/**
+	 * 最小交期
+	 */
+	@Column(name = "pr_mindelivery")
+	private Short minDelivery;
+
+	/**
+	 * 是否可拆卖
+	 */
+	@Column(name = "pr_isbreakup")
+	private Boolean isBreakUp;
+
+	/**
+	 * 关联B2B物料状态
+	 */
+	@OneToOne(mappedBy = "product", cascade = CascadeType.ALL)
+	private ProductStatus productStatus;
 
 	public Product() {
 	}
@@ -428,22 +443,6 @@ public class Product {
 		this.leadtime = leadtime;
 	}
 
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-
-	public Double getStock() {
-		return stock;
-	}
-
-	public void setStock(Double stock) {
-		this.stock = stock;
-	}
-
 	public Double getPrice() {
 		return price;
 	}
@@ -460,14 +459,6 @@ public class Product {
 		this.brand = brand;
 	}
 
-	public String getShipAddr() {
-		return shipAddr;
-	}
-
-	public void setShipAddr(String shipAddr) {
-		this.shipAddr = shipAddr;
-	}
-
 	public Double getLtinstock() {
 		return ltinstock;
 	}
@@ -521,14 +512,6 @@ public class Product {
 		this.sourceApp = sourceApp;
 	}
 
-	public Attach getAttach() {
-		return attach;
-	}
-
-	public void setAttach(Attach attach) {
-		this.attach = attach;
-	}
-
 	public Short getIsSale() {
 		return isSale;
 	}
@@ -585,14 +568,6 @@ public class Product {
 		this.pcmpcode = pcmpcode;
 	}
 
-	public String getMessage() {
-		return message;
-	}
-
-	public void setMessage(String message) {
-		this.message = message;
-	}
-
 	public Short getStandard() {
 		return standard;
 	}
@@ -649,14 +624,6 @@ public class Product {
 		this.downloadstatus = downloadstatus;
 	}
 
-	public Short getIsbusiness() {
-		return isbusiness;
-	}
-
-	public void setIsbusiness(Short isbusiness) {
-		this.isbusiness = isbusiness;
-	}
-
 	public String getImg() {
 		return img;
 	}
@@ -673,22 +640,6 @@ public class Product {
 		this.encapsulation = encapsulation;
 	}
 
-	public Short getB2cenabled() {
-		return b2cenabled;
-	}
-
-	public void setB2cenabled(Short b2cenabled) {
-		this.b2cenabled = b2cenabled;
-	}
-
-	public Short getB2benabled() {
-		return b2benabled;
-	}
-
-	public void setB2benabled(Short b2benabled) {
-		this.b2benabled = b2benabled;
-	}
-
 	public Date getTostandard() {
 		return tostandard;
 	}
@@ -728,4 +679,100 @@ public class Product {
 	public void setTaxprecon(String taxprecon) {
 		this.taxprecon = taxprecon;
 	}
+
+	public String getAttachment() {
+		return attachment;
+	}
+
+	public void setAttachment(String attachment) {
+		this.attachment = attachment;
+	}
+
+	public Double getReserve() {
+		return reserve;
+	}
+
+	public void setReserve(Double reserve) {
+		this.reserve = reserve;
+	}
+
+	public Long getKindId() {
+		return kindId;
+	}
+
+	public void setKindId(Long kindId) {
+		this.kindId = kindId;
+	}
+
+	public Long getPbrandId() {
+		return pbrandId;
+	}
+
+	public void setPbrandId(Long pbrandId) {
+		this.pbrandId = pbrandId;
+	}
+
+	public Long getPbrandUuid() {
+		return pbrandUuid;
+	}
+
+	public void setPbrandUuid(Long pbrandUuid) {
+		this.pbrandUuid = pbrandUuid;
+	}
+
+	public String getPackaging() {
+		return packaging;
+	}
+
+	public void setPackaging(String packaging) {
+		this.packaging = packaging;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public Date getManufactureDate() {
+		return manufactureDate;
+	}
+
+	public void setManufactureDate(Date manufactureDate) {
+		this.manufactureDate = manufactureDate;
+	}
+
+	public Short getMaxDelivery() {
+		return maxDelivery;
+	}
+
+	public void setMaxDelivery(Short maxDelivery) {
+		this.maxDelivery = maxDelivery;
+	}
+
+	public Short getMinDelivery() {
+		return minDelivery;
+	}
+
+	public void setMinDelivery(Short minDelivery) {
+		this.minDelivery = minDelivery;
+	}
+
+	public Boolean getBreakUp() {
+		return isBreakUp;
+	}
+
+	public void setBreakUp(Boolean breakUp) {
+		isBreakUp = breakUp;
+	}
+
+	public ProductStatus getProductStatus() {
+		return productStatus;
+	}
+
+	public void setProductStatus(ProductStatus productStatus) {
+		this.productStatus = productStatus;
+	}
 }

+ 69 - 0
src/main/java/com/uas/platform/b2b/model/ProductStatus.java

@@ -0,0 +1,69 @@
+package com.uas.platform.b2b.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * 物料状态表
+ * Created by dongbw
+ * 18/01/19 13:38.
+ */
+@Entity
+@Table(name = "product$status")
+public class ProductStatus implements Serializable{
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "product$status_gen")
+    @SequenceGenerator(name = "product$status_gen", sequenceName = "product$status_seq", allocationSize = 1)
+    @Column(name = "prs_id")
+    private Long id;
+
+    /**
+     * uas与b2b可用状态;<br>
+     * 1 已禁用 <br>
+     * 非1 (0 或 null) 可用状态,未禁用
+     */
+    @Column(name = "prs_b2bdiabled")
+    private Short b2bDisabled;
+
+    /**
+     * 关联物料
+     */
+    @OneToOne(cascade = CascadeType.REFRESH)
+    @JoinColumn(name = "prs_prid")
+    private Product product;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Short getB2bDisabled() {
+        return b2bDisabled;
+    }
+
+    public void setB2bDisabled(Short b2bDisabled) {
+        this.b2bDisabled = b2bDisabled;
+    }
+
+    @JsonIgnore
+    @JSONField(serialize = false)
+    public Product getProduct() {
+        return product;
+    }
+
+    public void setProduct(Product product) {
+        this.product = product;
+    }
+}

+ 15 - 1
src/main/java/com/uas/platform/b2b/model/PurchaseOrderReply.java

@@ -49,11 +49,17 @@ public class PurchaseOrderReply implements Serializable {
 	@OrderBy
 	private Date date;
 
+	/**
+	 * 采购订单明细id
+	 */
+	@Column(name = "pr_pdid")
+	private Long pdId;
+
 	/**
 	 * 采购订单明细
 	 */
 	@ManyToOne(cascade = { CascadeType.REFRESH, CascadeType.MERGE })
-	@JoinColumn(name = "pr_pdid")
+	@JoinColumn(name = "pr_pdid", insertable = false, updatable = false)
 	private PurchaseOrderItem orderItem;
 
 	/**
@@ -212,6 +218,14 @@ public class PurchaseOrderReply implements Serializable {
 		this.erpDate = erpDate;
 	}
 
+	public Long getPdId() {
+		return pdId;
+	}
+
+	public void setPdId(Long pdId) {
+		this.pdId = pdId;
+	}
+
 	/**
 	 * 回复详情
 	 * 

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/ProductService.java

@@ -187,7 +187,7 @@ public interface ProductService {
 
 	void setReadByOrder(String category, Long[] sourceId);
 
-	List<Object[]> getProductCount(String category);
+//	List<Object[]> getProductCount(String category);
 
 	/**
 	 * 禁用物料

+ 12 - 12
src/main/java/com/uas/platform/b2b/service/impl/ProductServiceImpl.java

@@ -312,9 +312,9 @@ public class ProductServiceImpl implements ProductService {
 			List<Product> prods = productDao.findByEnUUAndPcmpcodeAndPbrand(
 					SystemSession.getUser().getEnterprise().getUu(), prod.getPcmpcode(), prod.getPbrand());
 			if (prods.size() == 0) {
-				prod.setB2cenabled(Constant.YES);
+				prod.getProductStatus().setB2bDisabled(Constant.YES);
 			} else {
-				prod.setB2cenabled(Constant.NO);
+				prod.getProductStatus().setB2bDisabled(Constant.NO);
 			}
 			try {
 				prod = productDao.save(prod);
@@ -483,14 +483,14 @@ public class ProductServiceImpl implements ProductService {
 	 * return map; }
 	 */
 
-	@Override
-	public List<Object[]> getProductCount(String category) {
-		List<Long> ids = getUnreadIds(category);
-		if (CollectionUtils.isEmpty(ids)){
-			return new ArrayList<>();
-		}
-		return productDao.getUnreadCountEveryStatus(ids);
-	}
+//	@Override
+//	public List<Object[]> getProductCount(String category) {
+//		List<Long> ids = getUnreadIds(category);
+//		if (CollectionUtils.isEmpty(ids)){
+//			return new ArrayList<>();
+//		}
+//		return productDao.getUnreadCountEveryStatus(ids);
+//	}
 
 	@Override
 	public List<Long> getUnreadIds(String category) {
@@ -512,8 +512,8 @@ public class ProductServiceImpl implements ProductService {
 	}
 
 	@Override
-	public int updateB2bEnabled(String code, Short b2benabled) {
-		return productDao.updateB2bEnabled(SystemSession.getUser().getEnterprise().getUu(), code, b2benabled);
+	public int updateB2bEnabled(String code, Short b2bDisabled) {
+		return productDao.updateB2bEnabled(SystemSession.getUser().getEnterprise().getUu(), code, b2bDisabled);
 	}
 
 	/**