JavaSource/com/mandi/common/XmlUtils.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,159 @@ /** * Project Name:pay-protocol * File Name:Xml.java * Package Name:cn.swiftpass.pay.protocol * Date:2014-8-10ä¸å10:48:21 * */ package com.mandi.common; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; import org.xml.sax.InputSource; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import java.io.*; import java.util.*; /** * ClassName:Xml * Function: XMLçå·¥å ·æ¹æ³ * Date: 2014-8-10 ä¸å10:48:21 * @author */ @SuppressWarnings({"rawtypes","unchecked"}) public class XmlUtils { /** <ä¸å¥è¯åè½ç®è¿°> * <åè½è¯¦ç»æè¿°>request转å符串 * @param request * @return * @see [ç±»ãç±»#æ¹æ³ãç±»#æå] */ public static String parseRequst(HttpServletRequest request){ String body = ""; try { ServletInputStream inputStream = request.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream,"utf-8")); while(true){ String info = br.readLine(); if(info == null){ break; } if(body == null || "".equals(body)){ body = info; }else{ body += info; } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return body; } public static String parseXML(SortedMap<String, String> parameters) { StringBuffer sb = new StringBuffer(); sb.append("<xml>"); Set es = parameters.entrySet(); Iterator it = es.iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); String k = (String)entry.getKey(); String v = (String)entry.getValue(); if (null != v && !"".equals(v) && !"appkey".equals(k)) { sb.append("<" + k + ">" + parameters.get(k) + "</" + k + ">\n"); } } sb.append("</xml>"); return sb.toString(); } /** * ä»requestä¸è·å¾åæ°Mapï¼å¹¶è¿åå¯è¯»çMap * * @param request * @return */ public static SortedMap getParameterMap(HttpServletRequest request) { // åæ°Map Map properties = request.getParameterMap(); // è¿åå¼Map SortedMap returnMap = new TreeMap(); Iterator entries = properties.entrySet().iterator(); Map.Entry entry; String name = ""; String value = ""; while (entries.hasNext()) { entry = (Map.Entry) entries.next(); name = (String) entry.getKey(); Object valueObj = entry.getValue(); if(null == valueObj){ value = ""; }else if(valueObj instanceof String[]){ String[] values = (String[])valueObj; for(int i=0;i<values.length;i++){ value = values[i] + ","; } value = value.substring(0, value.length()-1); }else{ value = valueObj.toString(); } returnMap.put(name, value.trim()); } returnMap.remove("method"); return returnMap; } /** * 转XMLmap * @author * @param xmlBytes * @param charset * @return * @throws Exception */ public static Map<String, String> toMap(byte[] xmlBytes,String charset) throws Exception{ SAXReader reader = new SAXReader(false); InputSource source = new InputSource(new ByteArrayInputStream(xmlBytes)); source.setEncoding(charset); Document doc = reader.read(source); Map<String, String> params = XmlUtils.toMap(doc.getRootElement()); return params; } /** * 转MAP * @author * @param element * @return */ public static Map<String, String> toMap(Element element){ Map<String, String> rest = new HashMap<String, String>(); List<Element> els = element.elements(); for(Element el : els){ rest.put(el.getName().toLowerCase(), el.getText()); } return rest; } public static String toXml(Map<String, String> params){ StringBuilder buf = new StringBuilder(); List<String> keys = new ArrayList<String>(params.keySet()); Collections.sort(keys); buf.append("<xml>"); for(String key : keys){ buf.append("<").append(key).append(">"); buf.append("<![CDATA[").append(params.get(key)).append("]]>"); buf.append("</").append(key).append(">\n"); } buf.append("</xml>"); return buf.toString(); } } JavaSource/com/mandi/fendan/controller/SaleBackOrderController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,139 @@ package com.mandi.fendan.controller; import com.mandi.common.XmlUtils; import com.mandi.fendan.persist.SaleBackOrder; import com.mandi.fendan.persist.SalesReturn; import com.mandi.fendan.service.SaleBackOrderService; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; @RestController @RequestMapping(value="/api/saleBackOrder",method={RequestMethod.GET,RequestMethod.POST}) public class SaleBackOrderController { private Logger log=Logger.getLogger(SaleBackOrderController.class); @Resource private SaleBackOrderService saleBackOrderService; @RequestMapping(value = "/receive.htm", method = {RequestMethod.POST,RequestMethod.GET }) // public void insertSaleBackOrder(@RequestBody SaleBackOrder saleBackOrder){ public void insertSaleBackOrder(HttpServletRequest req, HttpServletResponse resp){ try { String strInfo = XmlUtils.parseRequst(req); if(StringUtils.isNotBlank(strInfo)){ JSONObject jsonObject = new JSONObject(strInfo); SaleBackOrder convert = convert(jsonObject); saleBackOrderService.saveOrUpdateOrDelete(convert); } } catch (Exception e) { e.printStackTrace(); } } private SaleBackOrder convert(JSONObject jsonObject) throws Exception { SaleBackOrder convert = new SaleBackOrder(); if (StringUtils.isNotBlank(jsonObject.getString("newSalesId"))) { convert.setNewSalesId(jsonObject.getString("newSalesId")); } if (StringUtils.isNotBlank(jsonObject.getString("docNum"))) { convert.setDocNum(jsonObject.getString("docNum")); } if (StringUtils.isNotBlank(jsonObject.getString("docTime"))) { convert.setDocTime(jsonObject.getString("docTime")); } if (StringUtils.isNotBlank(jsonObject.getString("newAccountNo"))) { convert.setNewAccountNo(jsonObject.getString("newAccountNo")); } if (StringUtils.isNotBlank(jsonObject.getString("createdBy"))) { convert.setCreatedBy(jsonObject.getString("createdBy")); } if (StringUtils.isNotBlank(jsonObject.getString("ncDepCode"))) { convert.setNcDepCode(jsonObject.getString("ncDepCode")); } if (StringUtils.isNotBlank(jsonObject.getString("userCode"))) { convert.setUserCode(jsonObject.getString("userCode")); } if (StringUtils.isNotBlank(jsonObject.getString("invoiceNum"))) { convert.setInvoiceNum(jsonObject.getString("invoiceNum")); } if (StringUtils.isNotBlank(jsonObject.getString("docRemark"))) { convert.setDocRemark(jsonObject.getString("docRemark")); } if (StringUtils.isNotBlank(jsonObject.getString("rcDepCode"))) { convert.setRcDepCode(jsonObject.getString("rcDepCode")); } if (StringUtils.isNotBlank(jsonObject.getString("rcLocCompCode"))) { convert.setRcLocCompCode(jsonObject.getString("rcLocCompCode")); } if (StringUtils.isNotBlank(jsonObject.getString("operState"))) { convert.setOperState(jsonObject.getString("operState")); } JSONArray itemList = jsonObject.getJSONArray("itemList"); List<SalesReturn> salesReturnList = new ArrayList<>(); for(int i=0;i<itemList.length();i++){ SalesReturn salesReturn = new SalesReturn(); JSONObject itemObject = itemList.getJSONObject(i); // 设置å个å段 if (StringUtils.isNotBlank(itemObject.getString("itemId"))) { salesReturn.setItemId(itemObject.getString("itemId")); } if (StringUtils.isNotBlank(itemObject.getString("batchNum"))) { salesReturn.setBatchNum(itemObject.getString("batchNum")); } if (StringUtils.isNotBlank(itemObject.getString("materialName"))) { salesReturn.setMaterialName(itemObject.getString("materialName")); } if (StringUtils.isNotBlank(itemObject.getString("specsName"))) { salesReturn.setSpecsName(itemObject.getString("specsName")); } if (StringUtils.isNotBlank(itemObject.getString("jzfmName"))) { salesReturn.setJzfmName(itemObject.getString("jzfmName")); } if (StringUtils.isNotBlank(itemObject.getString("materialSize"))) { salesReturn.setMaterialSize(itemObject.getString("materialSize")); } if (StringUtils.isNotBlank(itemObject.getString("outerPackingSize"))) { salesReturn.setOuterPackingSize(itemObject.getString("outerPackingSize")); } if (itemObject.has("grossWeight")) { salesReturn.setGrossWeight(itemObject.getDouble("grossWeight")); } if (itemObject.has("netWeight")) { salesReturn.setNetWeight(itemObject.getDouble("netWeight")); } if (StringUtils.isNotBlank(itemObject.getString("backTypeName"))) { salesReturn.setBackTypeName(itemObject.getString("backTypeName")); } if (StringUtils.isNotBlank(itemObject.getString("backReason"))) { salesReturn.setBackReason(itemObject.getString("backReason")); } if (StringUtils.isNotBlank(itemObject.getString("alloyStateName"))) { salesReturn.setAlloyStateName(itemObject.getString("alloyStateName")); } if (StringUtils.isNotBlank(itemObject.getString("itemRemark"))) { salesReturn.setItemRemark(itemObject.getString("itemRemark")); } if (StringUtils.isNotBlank(itemObject.getString("operState"))) { salesReturn.setOperState(itemObject.getString("operState")); } // æ·»å å°åè¡¨ä¸ salesReturnList.add(salesReturn); } convert.setItemList(salesReturnList); return convert; } } JavaSource/com/mandi/fendan/mapper/SaleBackOrderMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,22 @@ package com.mandi.fendan.mapper; import com.mandi.fendan.persist.SaleBackOrder; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; public interface SaleBackOrderMapper { //æ°å¢ void saveEntity(SaleBackOrder saleBackOrder); //æ ¹æ®Idæ¥è¯¢ @Select("select a.* from SaleBackOrder a where a.NewSalesId=#{newSalesId}") SaleBackOrder queryById(@Param("newSalesId") String newSalesId); //ä¿®æ¹ void updateEntity(SaleBackOrder saleBackOrder); @Delete("delete from SaleBackOrder where NewSalesId=#{newSalesId} ") void deleteByNewSalesId(@Param("newSalesId") String newSalesId); } JavaSource/com/mandi/fendan/mapper/SaleReturnMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,21 @@ package com.mandi.fendan.mapper; import com.mandi.fendan.persist.SalesReturn; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; public interface SaleReturnMapper { void saveEntity(SalesReturn salesReturn); //æ ¹æ®Idæ¥è¯¢ @Select("select a.* from SalesReturn a where a.itemId=#{itemId}") SalesReturn queryById(@Param("itemId") String itemId); void updateEntity(SalesReturn convert); //æ ¹æ®Idå é¤ @Delete("delete from SalesReturn where itemId=#{itemId} ") void deleteByItemId(@Param("itemId") String itemId); } JavaSource/com/mandi/fendan/mapper/xmls/SaleBackOrderMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ <?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="com.mandi.fendan.mapper.SaleBackOrderMapper"> <insert id="saveEntity"> INSERT INTO SaleBackOrder (newSalesId, docNum, docTime, newAccountNo, createdBy, ncDepCode, userCode, invoiceNum, docRemark, rcDepCode, rcLocCompCode, operState) VALUES (#{newSalesId}, #{docNum}, #{docTime}, #{newAccountNo}, #{createdBy}, #{ncDepCode}, #{userCode}, #{invoiceNum}, #{docRemark}, #{rcDepCode}, #{rcLocCompCode}, #{operState}) </insert> <update id="updateEntity"> UPDATE SaleBackOrder SET DocNum = #{docNum}, DocTime = #{docTime}, NewAccountNo = #{newAccountNo}, CreatedBy = #{createdBy}, NcDepCode = #{ncDepCode}, UserCode = #{userCode}, InvoiceNum = #{invoiceNum}, DocRemark = #{docRemark}, RcDepCode = #{rcDepCode}, RcLocCompCode = #{rcLocCompCode}, OperState = #{operState} WHERE NewSalesId = #{newSalesId} </update> </mapper> JavaSource/com/mandi/fendan/mapper/xmls/SaleReturnMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ <?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="com.mandi.fendan.mapper.SaleReturnMapper"> <insert id="saveEntity"> INSERT INTO SalesReturn (itemId, batchNum, materialName, specsName, jzfmName, materialSize, outerPackingSize, grossWeight, netWeight, backTypeName, backReason, alloyStateName, itemRemark, operState) VALUES (#{itemId}, #{batchNum}, #{materialName}, #{specsName}, #{jzfmName}, #{materialSize}, #{outerPackingSize}, #{grossWeight}, #{netWeight}, #{backTypeName}, #{backReason}, #{alloyStateName}, #{itemRemark}, #{operState}) </insert> <update id="updateEntity"> UPDATE SalesReturn SET batchNum = #{batchNum}, materialName = #{materialName}, specsName = #{specsName}, jzfmName = #{jzfmName}, materialSize = #{materialSize}, outerPackingSize = #{outerPackingSize}, grossWeight = #{grossWeight}, netWeight = #{netWeight}, backTypeName = #{backTypeName}, backReason = #{backReason}, alloyStateName = #{alloyStateName}, itemRemark = #{itemRemark}, operState = #{operState} WHERE itemId = #{itemId} </update> </mapper> JavaSource/com/mandi/fendan/persist/SaleBackOrder.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,131 @@ package com.mandi.fendan.persist; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.io.Serializable; import java.util.List; @Entity @Table(name="fd_SeparateList") public class SaleBackOrder implements Serializable { @Id private String newSalesId;//ä¸»é® private String docNum;//åæ®å· private String docTime;//åæ®æ¥æ private String newAccountNo;//å®¢æ· private String createdBy;//å建人 private String ncDepCode;//é¨é¨ private String userCode;//ä¸å¡å private String invoiceNum;//åç¥¨å· private String docRemark;//å¤æ³¨ private String rcDepCode;//æ¶è´§åä½ private String rcLocCompCode;//客æ·éè´§è¡æ¿åºå private String operState;//å¤çæä½ private List<SalesReturn> itemList; public String getNewSalesId() { return newSalesId; } public void setNewSalesId(String newSalesId) { this.newSalesId = newSalesId; } public String getDocNum() { return docNum; } public void setDocNum(String docNum) { this.docNum = docNum; } public String getDocTime() { return docTime; } public void setDocTime(String docTime) { this.docTime = docTime; } public String getNewAccountNo() { return newAccountNo; } public void setNewAccountNo(String newAccountNo) { this.newAccountNo = newAccountNo; } public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public String getNcDepCode() { return ncDepCode; } public void setNcDepCode(String ncDepCode) { this.ncDepCode = ncDepCode; } public String getUserCode() { return userCode; } public void setUserCode(String userCode) { this.userCode = userCode; } public String getInvoiceNum() { return invoiceNum; } public void setInvoiceNum(String invoiceNum) { this.invoiceNum = invoiceNum; } public String getDocRemark() { return docRemark; } public void setDocRemark(String docRemark) { this.docRemark = docRemark; } public String getRcDepCode() { return rcDepCode; } public void setRcDepCode(String rcDepCode) { this.rcDepCode = rcDepCode; } public String getRcLocCompCode() { return rcLocCompCode; } public void setRcLocCompCode(String rcLocCompCode) { this.rcLocCompCode = rcLocCompCode; } public String getOperState() { return operState; } public void setOperState(String operState) { this.operState = operState; } public List<SalesReturn> getItemList() { return itemList; } public void setItemList(List<SalesReturn> itemList) { this.itemList = itemList; } } JavaSource/com/mandi/fendan/persist/SalesReturn.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,140 @@ package com.mandi.fendan.persist; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.io.Serializable; @Entity @Table(name="SalesReturn") public class SalesReturn implements Serializable { @Id private String itemId; // ç©æç¼å· private String batchNum; // æ¹æ¬¡å· private String materialName; // ç©æå称 private String specsName; // è§æ ¼å称 private String jzfmName; // 夹纸è¦èå称 private String materialSize; // 尺寸 private String outerPackingSize; // å¤å è£ å°ºå¯¸ private Double grossWeight; // æ¯é private Double netWeight; // åé private String backTypeName; // é货类å private String backReason; // éè´§åå private String alloyStateName; // åéç¶æå称 private String itemRemark; // å¤æ³¨ private String operState; // å¤çæä½ public String getItemId() { return itemId; } public void setItemId(String itemId) { this.itemId = itemId; } public String getBatchNum() { return batchNum; } public void setBatchNum(String batchNum) { this.batchNum = batchNum; } public String getMaterialName() { return materialName; } public void setMaterialName(String materialName) { this.materialName = materialName; } public String getSpecsName() { return specsName; } public void setSpecsName(String specsName) { this.specsName = specsName; } public String getJzfmName() { return jzfmName; } public void setJzfmName(String jzfmName) { this.jzfmName = jzfmName; } public String getMaterialSize() { return materialSize; } public void setMaterialSize(String materialSize) { this.materialSize = materialSize; } public String getOuterPackingSize() { return outerPackingSize; } public void setOuterPackingSize(String outerPackingSize) { this.outerPackingSize = outerPackingSize; } public Double getGrossWeight() { return grossWeight; } public void setGrossWeight(Double grossWeight) { this.grossWeight = grossWeight; } public Double getNetWeight() { return netWeight; } public void setNetWeight(Double netWeight) { this.netWeight = netWeight; } public String getBackTypeName() { return backTypeName; } public void setBackTypeName(String backTypeName) { this.backTypeName = backTypeName; } public String getBackReason() { return backReason; } public void setBackReason(String backReason) { this.backReason = backReason; } public String getAlloyStateName() { return alloyStateName; } public void setAlloyStateName(String alloyStateName) { this.alloyStateName = alloyStateName; } public String getItemRemark() { return itemRemark; } public void setItemRemark(String itemRemark) { this.itemRemark = itemRemark; } public String getOperState() { return operState; } public void setOperState(String operState) { this.operState = operState; } } JavaSource/com/mandi/fendan/service/SaleBackOrderService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.mandi.fendan.service; import com.mandi.fendan.persist.SaleBackOrder; public interface SaleBackOrderService { void saveOrUpdateOrDelete(SaleBackOrder saleBackOrder); } JavaSource/com/mandi/fendan/service/SaleReturnService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,13 @@ package com.mandi.fendan.service; import com.mandi.fendan.persist.SalesReturn; public interface SaleReturnService{ void saveEntity(SalesReturn salesReturn); SalesReturn queryById(String itemId); void updateEntity(SalesReturn convert); void deleteByItemId(String itemId); } JavaSource/com/mandi/fendan/service/impl/SaleBackOrderServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,189 @@ package com.mandi.fendan.service.impl; import com.mandi.fendan.mapper.SaleBackOrderMapper; import com.mandi.fendan.persist.SaleBackOrder; import com.mandi.fendan.persist.SalesReturn; import com.mandi.fendan.service.SaleBackOrderService; import com.mandi.fendan.service.SaleReturnService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @Service public class SaleBackOrderServiceImpl implements SaleBackOrderService { @Resource private SaleBackOrderMapper saleBackOrderMapper; @Resource private SaleReturnService saleReturnService; public void saveOrUpdateOrDelete(SaleBackOrder saleBackOrder) { //æ´æ°ææ°å¢å®ä½ if(StringUtils.isNotBlank(saleBackOrder.getNewSalesId())){ SaleBackOrder saleBackOrder1 = saleBackOrderMapper.queryById(saleBackOrder.getNewSalesId()); //æ主é®æ°æ® æ´æ° if(saleBackOrder1!=null){ //æ主é®æ°æ® 并å¤çç¶æ为å é¤åå é¤ if("1".equals(saleBackOrder.getOperState())) { saleBackOrderMapper.deleteByNewSalesId(saleBackOrder.getNewSalesId()); }else{ SaleBackOrder convert = convert(saleBackOrder, saleBackOrder1); saleBackOrderMapper.updateEntity(convert); } }else { //æ 主é®æ°æ® æ°å¢ saleBackOrderMapper.saveEntity(saleBackOrder); } } //æ´æ°ææ°å¢åå®ä½ if(!saleBackOrder.getItemList().isEmpty() || saleBackOrder.getItemList().size()!=0){ List<SalesReturn> salesReturnList = saleBackOrder.getItemList(); for(SalesReturn salesReturn:salesReturnList){ if(StringUtils.isNotBlank(salesReturn.getItemId())) { SalesReturn salesReturn1=saleReturnService.queryById(salesReturn.getItemId()); //æ主é®æ°æ® æ´æ° if(salesReturn1!=null){ //æ主é®æ°æ® 并å¤çç¶æ为å é¤åå é¤ if("1".equals(salesReturn.getOperState())) { saleReturnService.deleteByItemId(salesReturn.getItemId()); }else { SalesReturn convert = convertSalesReturn(salesReturn, salesReturn1); saleReturnService.updateEntity(convert); } }else{ //æ 主é®æ°æ® æ°å¢ saleReturnService.saveEntity(salesReturn); } } } } } private SalesReturn convertSalesReturn(SalesReturn salesReturn,SalesReturn salesReturn1){ if (StringUtils.isNotBlank(salesReturn.getItemId()) && !salesReturn.getItemId().equals(salesReturn1.getItemId())) { salesReturn1.setItemId(salesReturn.getItemId()); } if (StringUtils.isNotBlank(salesReturn.getBatchNum()) && !salesReturn.getBatchNum().equals(salesReturn1.getBatchNum())) { salesReturn1.setBatchNum(salesReturn.getBatchNum()); } if (StringUtils.isNotBlank(salesReturn.getMaterialName()) && !salesReturn.getMaterialName().equals(salesReturn1.getMaterialName())) { salesReturn1.setMaterialName(salesReturn.getMaterialName()); } if (StringUtils.isNotBlank(salesReturn.getSpecsName()) && !salesReturn.getSpecsName().equals(salesReturn1.getSpecsName())) { salesReturn1.setSpecsName(salesReturn.getSpecsName()); } if (StringUtils.isNotBlank(salesReturn.getJzfmName()) && !salesReturn.getJzfmName().equals(salesReturn1.getJzfmName())) { salesReturn1.setJzfmName(salesReturn.getJzfmName()); } if (StringUtils.isNotBlank(salesReturn.getMaterialSize()) && !salesReturn.getMaterialSize().equals(salesReturn1.getMaterialSize())) { salesReturn1.setMaterialSize(salesReturn.getMaterialSize()); } if (StringUtils.isNotBlank(salesReturn.getOuterPackingSize()) && !salesReturn.getOuterPackingSize().equals(salesReturn1.getOuterPackingSize())) { salesReturn1.setOuterPackingSize(salesReturn.getOuterPackingSize()); } if (salesReturn.getGrossWeight() != null && !salesReturn.getGrossWeight().equals(salesReturn1.getGrossWeight())) { salesReturn1.setGrossWeight(salesReturn.getGrossWeight()); } if (salesReturn.getNetWeight() != null && !salesReturn.getNetWeight().equals(salesReturn1.getNetWeight())) { salesReturn1.setNetWeight(salesReturn.getNetWeight()); } if (StringUtils.isNotBlank(salesReturn.getBackTypeName()) && !salesReturn.getBackTypeName().equals(salesReturn1.getBackTypeName())) { salesReturn1.setBackTypeName(salesReturn.getBackTypeName()); } if (StringUtils.isNotBlank(salesReturn.getBackReason()) && !salesReturn.getBackReason().equals(salesReturn1.getBackReason())) { salesReturn1.setBackReason(salesReturn.getBackReason()); } if (StringUtils.isNotBlank(salesReturn.getAlloyStateName()) && !salesReturn.getAlloyStateName().equals(salesReturn1.getAlloyStateName())) { salesReturn1.setAlloyStateName(salesReturn.getAlloyStateName()); } if (StringUtils.isNotBlank(salesReturn.getItemRemark()) && !salesReturn.getItemRemark().equals(salesReturn1.getItemRemark())) { salesReturn1.setItemRemark(salesReturn.getItemRemark()); } if (StringUtils.isNotBlank(salesReturn.getOperState()) && !salesReturn.getOperState().equals(salesReturn1.getOperState())) { salesReturn1.setOperState(salesReturn.getOperState()); } return salesReturn1; } private SaleBackOrder convert(SaleBackOrder saleBackOrder,SaleBackOrder saleBackOrder1){ if (StringUtils.isNotBlank(saleBackOrder.getNewSalesId()) && !saleBackOrder.getNewSalesId().equals(saleBackOrder1.getNewSalesId())) { saleBackOrder1.setNewSalesId(saleBackOrder.getNewSalesId()); } if (StringUtils.isNotBlank(saleBackOrder.getDocNum()) && !saleBackOrder.getDocNum().equals(saleBackOrder1.getDocNum())) { saleBackOrder1.setDocNum(saleBackOrder.getDocNum()); } if (StringUtils.isNotBlank(saleBackOrder.getDocTime()) && !saleBackOrder.getDocTime().equals(saleBackOrder1.getDocTime())) { saleBackOrder1.setDocTime(saleBackOrder.getDocTime()); } if (StringUtils.isNotBlank(saleBackOrder.getNewAccountNo()) && !saleBackOrder.getNewAccountNo().equals(saleBackOrder1.getNewAccountNo())) { saleBackOrder1.setNewAccountNo(saleBackOrder.getNewAccountNo()); } if (StringUtils.isNotBlank(saleBackOrder.getCreatedBy()) && !saleBackOrder.getCreatedBy().equals(saleBackOrder1.getCreatedBy())) { saleBackOrder1.setCreatedBy(saleBackOrder.getCreatedBy()); } if (StringUtils.isNotBlank(saleBackOrder.getNcDepCode()) && !saleBackOrder.getNcDepCode().equals(saleBackOrder1.getNcDepCode())) { saleBackOrder1.setNcDepCode(saleBackOrder.getNcDepCode()); } if (StringUtils.isNotBlank(saleBackOrder.getUserCode()) && !saleBackOrder.getUserCode().equals(saleBackOrder1.getUserCode())) { saleBackOrder1.setUserCode(saleBackOrder.getUserCode()); } if (StringUtils.isNotBlank(saleBackOrder.getInvoiceNum()) && !saleBackOrder.getInvoiceNum().equals(saleBackOrder1.getInvoiceNum())) { saleBackOrder1.setInvoiceNum(saleBackOrder.getInvoiceNum()); } if (StringUtils.isNotBlank(saleBackOrder.getDocRemark()) && !saleBackOrder.getDocRemark().equals(saleBackOrder1.getDocRemark())) { saleBackOrder1.setDocRemark(saleBackOrder.getDocRemark()); } if (StringUtils.isNotBlank(saleBackOrder.getRcDepCode()) && !saleBackOrder.getRcDepCode().equals(saleBackOrder1.getRcDepCode())) { saleBackOrder1.setRcDepCode(saleBackOrder.getRcDepCode()); } if (StringUtils.isNotBlank(saleBackOrder.getRcLocCompCode()) && !saleBackOrder.getRcLocCompCode().equals(saleBackOrder1.getRcLocCompCode())) { saleBackOrder1.setRcLocCompCode(saleBackOrder.getRcLocCompCode()); } if (StringUtils.isNotBlank(saleBackOrder.getOperState()) && !saleBackOrder.getOperState().equals(saleBackOrder1.getOperState())) { saleBackOrder1.setOperState(saleBackOrder.getOperState()); } return saleBackOrder1; } } JavaSource/com/mandi/fendan/service/impl/SaleReturnServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,36 @@ package com.mandi.fendan.service.impl; import com.mandi.fendan.mapper.SaleBackOrderMapper; import com.mandi.fendan.mapper.SaleReturnMapper; import com.mandi.fendan.persist.SalesReturn; import com.mandi.fendan.service.SaleReturnService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @Service public class SaleReturnServiceImpl implements SaleReturnService{ @Resource private SaleReturnMapper saleReturnMapper; @Override public void saveEntity(SalesReturn salesReturn) { saleReturnMapper.saveEntity(salesReturn); } @Override public SalesReturn queryById(String itemId) { return saleReturnMapper.queryById(itemId); } @Override public void updateEntity(SalesReturn convert) { saleReturnMapper.updateEntity(convert); } @Override public void deleteByItemId(String itemId) { saleReturnMapper.deleteByItemId(itemId); } }