项目现场调试修改
This commit is contained in:
@@ -10,7 +10,7 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* mes出库子单中间表对象 mes_outorder_detail_middle
|
* mes出库子单中间表对象 mes_outorder_detail_middle
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
* @date 2024-06-17
|
* @date 2024-06-17
|
||||||
*/
|
*/
|
||||||
@@ -114,6 +114,16 @@ public class MesOutorderDetailMiddle extends BaseEntity
|
|||||||
@Excel(name="客户简称")
|
@Excel(name="客户简称")
|
||||||
private String saleUnit;
|
private String saleUnit;
|
||||||
|
|
||||||
|
private String printDate;
|
||||||
|
|
||||||
|
public String getPrintDate() {
|
||||||
|
return printDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrintDate(String printDate) {
|
||||||
|
this.printDate = printDate;
|
||||||
|
}
|
||||||
|
|
||||||
public String getOnLineType() {
|
public String getOnLineType() {
|
||||||
return onLineType;
|
return onLineType;
|
||||||
}
|
}
|
||||||
@@ -298,116 +308,116 @@ public class MesOutorderDetailMiddle extends BaseEntity
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
public void setOrderId(String orderId)
|
public void setOrderId(String orderId)
|
||||||
{
|
{
|
||||||
this.orderId = orderId;
|
this.orderId = orderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrderId()
|
public String getOrderId()
|
||||||
{
|
{
|
||||||
return orderId;
|
return orderId;
|
||||||
}
|
}
|
||||||
public void setLineNo(String lineNo)
|
public void setLineNo(String lineNo)
|
||||||
{
|
{
|
||||||
this.lineNo = lineNo;
|
this.lineNo = lineNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLineNo()
|
public String getLineNo()
|
||||||
{
|
{
|
||||||
return lineNo;
|
return lineNo;
|
||||||
}
|
}
|
||||||
public void setMaterialCode(String materialCode)
|
public void setMaterialCode(String materialCode)
|
||||||
{
|
{
|
||||||
this.materialCode = materialCode;
|
this.materialCode = materialCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMaterialCode()
|
public String getMaterialCode()
|
||||||
{
|
{
|
||||||
return materialCode;
|
return materialCode;
|
||||||
}
|
}
|
||||||
public void setErpCode(String erpCode)
|
public void setErpCode(String erpCode)
|
||||||
{
|
{
|
||||||
this.erpCode = erpCode;
|
this.erpCode = erpCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getErpCode()
|
public String getErpCode()
|
||||||
{
|
{
|
||||||
return erpCode;
|
return erpCode;
|
||||||
}
|
}
|
||||||
public void setProductBatch(String productBatch)
|
public void setProductBatch(String productBatch)
|
||||||
{
|
{
|
||||||
this.productBatch = productBatch;
|
this.productBatch = productBatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductBatch()
|
public String getProductBatch()
|
||||||
{
|
{
|
||||||
return productBatch;
|
return productBatch;
|
||||||
}
|
}
|
||||||
public void setWeight(String weight)
|
public void setWeight(String weight)
|
||||||
{
|
{
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWeight()
|
public String getWeight()
|
||||||
{
|
{
|
||||||
return weight;
|
return weight;
|
||||||
}
|
}
|
||||||
public void setShape(String shape)
|
public void setShape(String shape)
|
||||||
{
|
{
|
||||||
this.shape = shape;
|
this.shape = shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getShape()
|
public String getShape()
|
||||||
{
|
{
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
public void setPalletType(String palletType)
|
public void setPalletType(String palletType)
|
||||||
{
|
{
|
||||||
this.palletType = palletType;
|
this.palletType = palletType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPalletType()
|
public String getPalletType()
|
||||||
{
|
{
|
||||||
return palletType;
|
return palletType;
|
||||||
}
|
}
|
||||||
public void setLayerQuantity(String layerQuantity)
|
public void setLayerQuantity(String layerQuantity)
|
||||||
{
|
{
|
||||||
this.layerQuantity = layerQuantity;
|
this.layerQuantity = layerQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLayerQuantity()
|
public String getLayerQuantity()
|
||||||
{
|
{
|
||||||
return layerQuantity;
|
return layerQuantity;
|
||||||
}
|
}
|
||||||
public void setLayers(String layers)
|
public void setLayers(String layers)
|
||||||
{
|
{
|
||||||
this.layers = layers;
|
this.layers = layers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLayers()
|
public String getLayers()
|
||||||
{
|
{
|
||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProduceDate(String produceDate)
|
public void setProduceDate(String produceDate)
|
||||||
{
|
{
|
||||||
this.produceDate = produceDate;
|
this.produceDate = produceDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProduceDate()
|
public String getProduceDate()
|
||||||
{
|
{
|
||||||
return produceDate;
|
return produceDate;
|
||||||
}
|
}
|
||||||
public void setXfTime(String xfTime)
|
public void setXfTime(String xfTime)
|
||||||
{
|
{
|
||||||
this.xfTime = xfTime;
|
this.xfTime = xfTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getXfTime()
|
public String getXfTime()
|
||||||
{
|
{
|
||||||
return xfTime;
|
return xfTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 库存物料对象 view_product_and_stock
|
* 库存物料对象 view_product_and_stock
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
* @date 2024-06-20
|
* @date 2024-06-20
|
||||||
*/
|
*/
|
||||||
@@ -45,8 +45,19 @@ public class ViewProductAndStock extends BaseEntity
|
|||||||
@Excel(name = "库存数量")
|
@Excel(name = "库存数量")
|
||||||
private BigDecimal quantity;
|
private BigDecimal quantity;
|
||||||
|
|
||||||
|
@Excel(name = "出库时间")
|
||||||
|
private String printDate;
|
||||||
|
|
||||||
private String outType;
|
private String outType;
|
||||||
|
|
||||||
|
public String getPrintDate() {
|
||||||
|
return printDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrintDate(String printDate) {
|
||||||
|
this.printDate = printDate;
|
||||||
|
}
|
||||||
|
|
||||||
public String getOutType() {
|
public String getOutType() {
|
||||||
return outType;
|
return outType;
|
||||||
}
|
}
|
||||||
@@ -60,61 +71,61 @@ public class ViewProductAndStock extends BaseEntity
|
|||||||
this.onlyIdentity = onlyIdentity;
|
this.onlyIdentity = onlyIdentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getOnlyIdentity()
|
public Integer getOnlyIdentity()
|
||||||
{
|
{
|
||||||
return onlyIdentity;
|
return onlyIdentity;
|
||||||
}
|
}
|
||||||
public void setProductId(String productId)
|
public void setProductId(String productId)
|
||||||
{
|
{
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductId()
|
public String getProductId()
|
||||||
{
|
{
|
||||||
return productId;
|
return productId;
|
||||||
}
|
}
|
||||||
public void setProductName(String productName)
|
public void setProductName(String productName)
|
||||||
{
|
{
|
||||||
this.productName = productName;
|
this.productName = productName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductName()
|
public String getProductName()
|
||||||
{
|
{
|
||||||
return productName;
|
return productName;
|
||||||
}
|
}
|
||||||
public void setLotNo(String lotNo)
|
public void setLotNo(String lotNo)
|
||||||
{
|
{
|
||||||
this.lotNo = lotNo;
|
this.lotNo = lotNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLotNo()
|
public String getLotNo()
|
||||||
{
|
{
|
||||||
return lotNo;
|
return lotNo;
|
||||||
}
|
}
|
||||||
public void setInClassName(String inClassName)
|
public void setInClassName(String inClassName)
|
||||||
{
|
{
|
||||||
this.inClassName = inClassName;
|
this.inClassName = inClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInClassName()
|
public String getInClassName()
|
||||||
{
|
{
|
||||||
return inClassName;
|
return inClassName;
|
||||||
}
|
}
|
||||||
public void setClassgroupNumber(String classgroupNumber)
|
public void setClassgroupNumber(String classgroupNumber)
|
||||||
{
|
{
|
||||||
this.classgroupNumber = classgroupNumber;
|
this.classgroupNumber = classgroupNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getClassgroupNumber()
|
public String getClassgroupNumber()
|
||||||
{
|
{
|
||||||
return classgroupNumber;
|
return classgroupNumber;
|
||||||
}
|
}
|
||||||
public void setQuantity(BigDecimal quantity)
|
public void setQuantity(BigDecimal quantity)
|
||||||
{
|
{
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQuantity()
|
public BigDecimal getQuantity()
|
||||||
{
|
{
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 出库汇总对象 view_out_job_all
|
* 出库汇总对象 view_out_job_all
|
||||||
*
|
*
|
||||||
* @author wld
|
* @author wld
|
||||||
* @date 2024-11-23
|
* @date 2024-11-23
|
||||||
*/
|
*/
|
||||||
@@ -64,112 +64,123 @@ public class ViewOutJobAll extends BaseEntity
|
|||||||
@Excel(name = "出库时间")
|
@Excel(name = "出库时间")
|
||||||
private String inDate;
|
private String inDate;
|
||||||
private String inFDate;
|
private String inFDate;
|
||||||
|
/** 客户名称 */
|
||||||
|
@Excel(name = "客户名称")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
public void setOrderType(String orderType)
|
public String getCustomerName() {
|
||||||
|
return customerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomerName(String customerName) {
|
||||||
|
this.customerName = customerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderType(String orderType)
|
||||||
{
|
{
|
||||||
this.orderType = orderType;
|
this.orderType = orderType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrderType()
|
public String getOrderType()
|
||||||
{
|
{
|
||||||
return orderType;
|
return orderType;
|
||||||
}
|
}
|
||||||
public void setDictLabel(String dictLabel)
|
public void setDictLabel(String dictLabel)
|
||||||
{
|
{
|
||||||
this.dictLabel = dictLabel;
|
this.dictLabel = dictLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDictLabel()
|
public String getDictLabel()
|
||||||
{
|
{
|
||||||
return dictLabel;
|
return dictLabel;
|
||||||
}
|
}
|
||||||
public void setLength(String length)
|
public void setLength(String length)
|
||||||
{
|
{
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLength()
|
public String getLength()
|
||||||
{
|
{
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
public void setProductName(String productName)
|
public void setProductName(String productName)
|
||||||
{
|
{
|
||||||
this.productName = productName;
|
this.productName = productName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductName()
|
public String getProductName()
|
||||||
{
|
{
|
||||||
return productName;
|
return productName;
|
||||||
}
|
}
|
||||||
public void setProductId(String productId)
|
public void setProductId(String productId)
|
||||||
{
|
{
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductId()
|
public String getProductId()
|
||||||
{
|
{
|
||||||
return productId;
|
return productId;
|
||||||
}
|
}
|
||||||
public void setLotNo(String lotNo)
|
public void setLotNo(String lotNo)
|
||||||
{
|
{
|
||||||
this.lotNo = lotNo;
|
this.lotNo = lotNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLotNo()
|
public String getLotNo()
|
||||||
{
|
{
|
||||||
return lotNo;
|
return lotNo;
|
||||||
}
|
}
|
||||||
public void setQuantity(String quantity)
|
public void setQuantity(String quantity)
|
||||||
{
|
{
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQuantity()
|
public String getQuantity()
|
||||||
{
|
{
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
public void setProductUnit(String productUnit)
|
public void setProductUnit(String productUnit)
|
||||||
{
|
{
|
||||||
this.productUnit = productUnit;
|
this.productUnit = productUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductUnit()
|
public String getProductUnit()
|
||||||
{
|
{
|
||||||
return productUnit;
|
return productUnit;
|
||||||
}
|
}
|
||||||
public void setTrayCount(Long trayCount)
|
public void setTrayCount(Long trayCount)
|
||||||
{
|
{
|
||||||
this.trayCount = trayCount;
|
this.trayCount = trayCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getTrayCount()
|
public Long getTrayCount()
|
||||||
{
|
{
|
||||||
return trayCount;
|
return trayCount;
|
||||||
}
|
}
|
||||||
public void setSimpleName(String simpleName)
|
public void setSimpleName(String simpleName)
|
||||||
{
|
{
|
||||||
this.simpleName = simpleName;
|
this.simpleName = simpleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSimpleName()
|
public String getSimpleName()
|
||||||
{
|
{
|
||||||
return simpleName;
|
return simpleName;
|
||||||
}
|
}
|
||||||
public void setWeigth(String weigth)
|
public void setWeigth(String weigth)
|
||||||
{
|
{
|
||||||
this.weigth = weigth;
|
this.weigth = weigth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWeigth()
|
public String getWeigth()
|
||||||
{
|
{
|
||||||
return weigth;
|
return weigth;
|
||||||
}
|
}
|
||||||
public void setInDate(String inDate)
|
public void setInDate(String inDate)
|
||||||
{
|
{
|
||||||
this.inDate = inDate;
|
this.inDate = inDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInDate()
|
public String getInDate()
|
||||||
{
|
{
|
||||||
return inDate;
|
return inDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.alibaba.druid.support.json.JSONUtils;
|
|||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
import com.ruoyi.common.json.JSONObject;
|
import com.ruoyi.common.json.JSONObject;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
|
import com.ruoyi.common.utils.security.RsaUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
@@ -77,6 +78,11 @@ public class SysLoginController extends BaseController
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult ajaxLogin(HttpServletRequest request,String username, String password, Boolean rememberMe)
|
public AjaxResult ajaxLogin(HttpServletRequest request,String username, String password, Boolean rememberMe)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
password = RsaUtils.decryptByPrivateKey(password);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
|
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.project.middle.mesOutorderDetail.mapper.MesOutorderDetailMiddleMapper">
|
<mapper namespace="com.ruoyi.project.middle.mesOutorderDetail.mapper.MesOutorderDetailMiddleMapper">
|
||||||
|
|
||||||
<resultMap type="MesOutorderDetailMiddle" id="MesOutorderDetailMiddleResult">
|
<resultMap type="MesOutorderDetailMiddle" id="MesOutorderDetailMiddleResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="orderId" column="order_id" />
|
<result property="orderId" column="order_id" />
|
||||||
@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="inOut" column="in_out" />
|
<result property="inOut" column="in_out" />
|
||||||
<result property="onLineType" column="on_line_type" />
|
<result property="onLineType" column="on_line_type" />
|
||||||
<result property="saleUnit" column="sale_unit" />
|
<result property="saleUnit" column="sale_unit" />
|
||||||
|
<result property="printDate" column="print_date" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectMesOutorderDetailMiddleVo">
|
<sql id="selectMesOutorderDetailMiddleVo">
|
||||||
@@ -104,11 +105,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select m.id, m.order_id, m.line_no, m.material_code, erp_code, product_batch, weight, shape,
|
select m.id, m.order_id, m.line_no, m.material_code, erp_code, product_batch, weight, shape,
|
||||||
pallet_type, layer_quantity, layers, m.plan_in_quantity, m.produce_date, m.xf_time,p.product_name,
|
pallet_type, layer_quantity, layers, m.plan_in_quantity, m.produce_date, m.xf_time,p.product_name,
|
||||||
m.remark,cm,spdd,zbq,mbq,czdd,hgz,hp,allot_num,confirm_num,m.out_id,detail_status,m.floor,mdfs,
|
m.remark,cm,spdd,zbq,mbq,czdd,hgz,hp,allot_num,confirm_num,m.out_id,detail_status,m.floor,mdfs,
|
||||||
md_num,num_of_times,time_of_num,in_out,m.on_line_type
|
md_num,num_of_times,time_of_num,in_out,m.on_line_type,m.print_date
|
||||||
from mes_outorder_detail_middle m
|
from mes_outorder_detail_middle m
|
||||||
left join bas_product p on p.simple_name=m.produce_date and p.spare1=m.material_code
|
left join bas_product p on p.simple_name=m.produce_date and p.spare1=m.material_code
|
||||||
left join mes_outorder_middle o on o.order_id=m.order_id
|
left join mes_outorder_middle o on o.order_id=m.order_id
|
||||||
<where>
|
<where>
|
||||||
<if test="orderId != null and orderId != ''"> and m.order_id = #{orderId}</if>
|
<if test="orderId != null and orderId != ''"> and m.order_id = #{orderId}</if>
|
||||||
<if test="lineNo != null and lineNo != ''"> and m.line_no = #{lineNo}</if>
|
<if test="lineNo != null and lineNo != ''"> and m.line_no = #{lineNo}</if>
|
||||||
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
|
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
|
||||||
@@ -169,7 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertMesOutorderDetailMiddle" parameterType="MesOutorderDetailMiddle">
|
<insert id="insertMesOutorderDetailMiddle" parameterType="MesOutorderDetailMiddle">
|
||||||
insert into mes_outorder_detail_middle
|
insert into mes_outorder_detail_middle
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -202,6 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="floor != null">floor,</if>
|
<if test="floor != null">floor,</if>
|
||||||
<if test="mdfs != null">mdfs,</if>
|
<if test="mdfs != null">mdfs,</if>
|
||||||
<if test="mdNum != null">md_num,</if>
|
<if test="mdNum != null">md_num,</if>
|
||||||
|
<if test="printDate != null">print_date,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">#{id},</if>
|
<if test="id != null">#{id},</if>
|
||||||
@@ -233,7 +235,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="floor != null">#{floor},</if>
|
<if test="floor != null">#{floor},</if>
|
||||||
<if test="mdfs != null">#{mdfs},</if>
|
<if test="mdfs != null">#{mdfs},</if>
|
||||||
<if test="mdNum != null">#{mdNum},</if>
|
<if test="mdNum != null">#{mdNum},</if>
|
||||||
</trim>
|
<if test="printDate != null">#{printDate},</if>
|
||||||
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<update id="updateMesOutorderDetailMiddle" parameterType="MesOutorderDetailMiddle">
|
<update id="updateMesOutorderDetailMiddle" parameterType="MesOutorderDetailMiddle">
|
||||||
update mes_outorder_detail_middle
|
update mes_outorder_detail_middle
|
||||||
@@ -276,7 +279,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteMesOutorderDetailMiddleByIds" parameterType="String">
|
<delete id="deleteMesOutorderDetailMiddleByIds" parameterType="String">
|
||||||
delete from mes_outorder_detail_middle where id in
|
delete from mes_outorder_detail_middle where id in
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
@@ -397,4 +400,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.project.out.productAndStock.mapper.ViewProductAndStockMapper">
|
<mapper namespace="com.ruoyi.project.out.productAndStock.mapper.ViewProductAndStockMapper">
|
||||||
|
|
||||||
<resultMap type="ViewProductAndStock" id="ViewProductAndStockResult">
|
<resultMap type="ViewProductAndStock" id="ViewProductAndStockResult">
|
||||||
<result property="onlyIdentity" column="only_identity" />
|
<result property="onlyIdentity" column="only_identity" />
|
||||||
<result property="productId" column="product_id" />
|
<result property="productId" column="product_id" />
|
||||||
@@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="classgroupNumber" column="classgroup_number" />
|
<result property="classgroupNumber" column="classgroup_number" />
|
||||||
<result property="quantity" column="quantity" />
|
<result property="quantity" column="quantity" />
|
||||||
<result property="productDetailId" column="product_detail_id" />
|
<result property="productDetailId" column="product_detail_id" />
|
||||||
|
<result property="printDate" column="print_date" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectViewProductAndStockVo">
|
<sql id="selectViewProductAndStockVo">
|
||||||
@@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
bs.in_class_name,
|
bs.in_class_name,
|
||||||
bs.classgroup_number,
|
bs.classgroup_number,
|
||||||
bs.product_detail_id,
|
bs.product_detail_id,
|
||||||
|
bs.print_date,
|
||||||
SUM ( quantity ) AS quantity
|
SUM ( quantity ) AS quantity
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
@@ -41,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
b.quantity,
|
b.quantity,
|
||||||
b.classgroup_number,
|
b.classgroup_number,
|
||||||
b.product_detail_id,
|
b.product_detail_id,
|
||||||
|
b.print_date,
|
||||||
b.class_now_date_time ------销售订单号
|
b.class_now_date_time ------销售订单号
|
||||||
FROM
|
FROM
|
||||||
bas_stock b
|
bas_stock b
|
||||||
@@ -69,17 +70,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
bs.lot_no,
|
bs.lot_no,
|
||||||
bs.in_class_name,
|
bs.in_class_name,
|
||||||
bs.product_detail_id,
|
bs.product_detail_id,
|
||||||
bs.classgroup_number
|
bs.classgroup_number,
|
||||||
|
bs.print_date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectViewProductAndStockByOnlyIdentity" parameterType="Integer" resultMap="ViewProductAndStockResult">
|
<select id="selectViewProductAndStockByOnlyIdentity" parameterType="Integer" resultMap="ViewProductAndStockResult">
|
||||||
<include refid="selectViewProductAndStockVo"/>
|
<include refid="selectViewProductAndStockVo"/>
|
||||||
where only_identity = #{onlyIdentity}
|
where only_identity = #{onlyIdentity}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertViewProductAndStock" parameterType="ViewProductAndStock">
|
<insert id="insertViewProductAndStock" parameterType="ViewProductAndStock">
|
||||||
insert into view_product_and_stock
|
insert into view_product_and_stock
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -120,10 +122,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteViewProductAndStockByOnlyIdentitys" parameterType="String">
|
<delete id="deleteViewProductAndStockByOnlyIdentitys" parameterType="String">
|
||||||
delete from view_product_and_stock where only_identity in
|
delete from view_product_and_stock where only_identity in
|
||||||
<foreach item="onlyIdentity" collection="array" open="(" separator="," close=")">
|
<foreach item="onlyIdentity" collection="array" open="(" separator="," close=")">
|
||||||
#{onlyIdentity}
|
#{onlyIdentity}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.project.search.viewoutall.mapper.ViewOutJobAllMapper">
|
<mapper namespace="com.ruoyi.project.search.viewoutall.mapper.ViewOutJobAllMapper">
|
||||||
|
|
||||||
<resultMap type="ViewOutJobAll" id="ViewOutJobAllResult">
|
<resultMap type="ViewOutJobAll" id="ViewOutJobAllResult">
|
||||||
<result property="orderType" column="order_type" />
|
<result property="orderType" column="order_type" />
|
||||||
<result property="dictLabel" column="dict_label" />
|
<result property="dictLabel" column="dict_label" />
|
||||||
@@ -18,15 +18,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="weigth" column="weigth" />
|
<result property="weigth" column="weigth" />
|
||||||
<result property="inDate" column="in_date" />
|
<result property="inDate" column="in_date" />
|
||||||
<result property="printDate" column="print_date" />
|
<result property="printDate" column="print_date" />
|
||||||
|
<result property="customerName" column="customer_name" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectViewOutJobAllVo">
|
<sql id="selectViewOutJobAllVo">
|
||||||
select order_type, dict_label, length, product_name, product_id, lot_no, quantity, product_unit, tray_count, simple_name, weigth, in_date,print_date from view_out_job_all
|
select order_type, dict_label, length, product_name, product_id, lot_no, quantity, product_unit, tray_count, simple_name, weigth, in_date,print_date,customer_name from view_out_job_all
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectViewOutJobAllList" parameterType="ViewOutJobAll" resultMap="ViewOutJobAllResult">
|
<select id="selectViewOutJobAllList" parameterType="ViewOutJobAll" resultMap="ViewOutJobAllResult">
|
||||||
<include refid="selectViewOutJobAllVo"/>
|
<include refid="selectViewOutJobAllVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
|
<if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
|
||||||
<if test="dictLabel != null and dictLabel != ''"> and dict_label = #{dictLabel}</if>
|
<if test="dictLabel != null and dictLabel != ''"> and dict_label = #{dictLabel}</if>
|
||||||
<if test="length != null and length != ''"> and length = #{length}</if>
|
<if test="length != null and length != ''"> and length = #{length}</if>
|
||||||
@@ -40,14 +41,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="weigth != null and weigth != ''"> and weigth = #{weigth}</if>
|
<if test="weigth != null and weigth != ''"> and weigth = #{weigth}</if>
|
||||||
<if test="inDate != null and inDate != ''"> and in_date >= #{inDate}</if>
|
<if test="inDate != null and inDate != ''"> and in_date >= #{inDate}</if>
|
||||||
<if test="inFDate != null and inFDate != ''"> and in_date <= #{inFDate}</if>
|
<if test="inFDate != null and inFDate != ''"> and in_date <= #{inFDate}</if>
|
||||||
|
<if test="customerName != null and customerName != ''"> and customer_name like concat('%',#{customerName},'%')</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectViewOutJobAllByOrderType" parameterType="String" resultMap="ViewOutJobAllResult">
|
<select id="selectViewOutJobAllByOrderType" parameterType="String" resultMap="ViewOutJobAllResult">
|
||||||
<include refid="selectViewOutJobAllVo"/>
|
<include refid="selectViewOutJobAllVo"/>
|
||||||
where order_type = #{orderType}
|
where order_type = #{orderType}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertViewOutJobAll" parameterType="ViewOutJobAll">
|
<insert id="insertViewOutJobAll" parameterType="ViewOutJobAll">
|
||||||
insert into view_out_job_all
|
insert into view_out_job_all
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -103,10 +105,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteViewOutJobAllByOrderTypes" parameterType="String">
|
<delete id="deleteViewOutJobAllByOrderTypes" parameterType="String">
|
||||||
delete from view_out_job_all where order_type in
|
delete from view_out_job_all where order_type in
|
||||||
<foreach item="orderType" collection="array" open="(" separator="," close=")">
|
<foreach item="orderType" collection="array" open="(" separator="," close=")">
|
||||||
#{orderType}
|
#{orderType}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
7
ruoyi-admin/src/main/resources/static/js/jsencrypt.min.js
vendored
Normal file
7
ruoyi-admin/src/main/resources/static/js/jsencrypt.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -13,7 +13,14 @@ $.validator.setDefaults({
|
|||||||
login();
|
login();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' +
|
||||||
|
'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
|
||||||
|
// 加密
|
||||||
|
function encrypt(txt) {
|
||||||
|
const encryptor = new JSEncrypt()
|
||||||
|
encryptor.setPublicKey(publicKey) // 设置公钥
|
||||||
|
return encryptor.encrypt(txt) // 对数据进行加密
|
||||||
|
}
|
||||||
function login() {
|
function login() {
|
||||||
$.modal.loading($("#btnSubmit").data("loading"));
|
$.modal.loading($("#btnSubmit").data("loading"));
|
||||||
var username = $.common.trim($("input[name='username']").val());
|
var username = $.common.trim($("input[name='username']").val());
|
||||||
@@ -25,7 +32,7 @@ function login() {
|
|||||||
url: ctx + "login",
|
url: ctx + "login",
|
||||||
data: {
|
data: {
|
||||||
"username": username,
|
"username": username,
|
||||||
"password": password,
|
"password": encrypt(password),
|
||||||
"validateCode": validateCode,
|
"validateCode": validateCode,
|
||||||
"rememberMe": rememberMe
|
"rememberMe": rememberMe
|
||||||
},
|
},
|
||||||
@@ -92,4 +99,4 @@ function getParam(paramName) {
|
|||||||
var r = window.location.search.substr(1).match(reg);
|
var r = window.location.search.substr(1).match(reg);
|
||||||
if (r != null) return decodeURI(r[2]);
|
if (r != null) return decodeURI(r[2]);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
<script th:inline="javascript"> var ctx = [[@{/}]]; var captchaType = [[${captchaType}]]; </script>
|
<script th:inline="javascript"> var ctx = [[@{/}]]; var captchaType = [[${captchaType}]]; </script>
|
||||||
<!--[if lte IE 8]><script>window.location.href=ctx+'html/ie.html';</script><![endif]-->
|
<!--[if lte IE 8]><script>window.location.href=ctx+'html/ie.html';</script><![endif]-->
|
||||||
<!-- 全局js -->
|
<!-- 全局js -->
|
||||||
|
<script src="../static/js/jsencrypt.min.js" th:src="@{/js/jsencrypt.min.js}"></script>
|
||||||
<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
|
<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
|
||||||
<script src="../static/ajax/libs/validate/jquery.validate.min.js" th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
|
<script src="../static/ajax/libs/validate/jquery.validate.min.js" th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
|
||||||
<script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
|
<script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
|
||||||
|
|||||||
@@ -144,6 +144,11 @@
|
|||||||
title: '库存数量',
|
title: '库存数量',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'printDate',
|
||||||
|
title: '生产日期',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'planInQuantity',
|
field: 'planInQuantity',
|
||||||
title: '出库数量',
|
title: '出库数量',
|
||||||
@@ -301,6 +306,7 @@
|
|||||||
obj.productBatch = Members[i].lotNo;
|
obj.productBatch = Members[i].lotNo;
|
||||||
obj.materialCode = Members[i].classgroupNumber;
|
obj.materialCode = Members[i].classgroupNumber;
|
||||||
obj.shape = Members[i].productDetailId;
|
obj.shape = Members[i].productDetailId;
|
||||||
|
obj.printDate = Members[i].printDate;
|
||||||
|
|
||||||
// var outType=$("#outType").val()
|
// var outType=$("#outType").val()
|
||||||
//
|
//
|
||||||
@@ -495,4 +501,4 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -140,6 +140,12 @@
|
|||||||
halign: 'center',
|
halign: 'center',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'printDate',
|
||||||
|
title: '生产日期',
|
||||||
|
halign: 'center',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'quantity',
|
field: 'quantity',
|
||||||
@@ -164,4 +170,4 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -736,6 +736,11 @@
|
|||||||
title: '出库层数',
|
title: '出库层数',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'printDate',
|
||||||
|
title: '生产日期',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'numOfTimes',
|
field: 'numOfTimes',
|
||||||
title: '打印个数',
|
title: '打印个数',
|
||||||
|
|||||||
@@ -1274,4 +1274,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<label>批次:</label>
|
<label>批次:</label>
|
||||||
<input type="text" name="lotNo"/>
|
<input type="text" name="lotNo"/>
|
||||||
|
</li><li>
|
||||||
|
<label>客户:</label>
|
||||||
|
<input type="text" name="customerName"/>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
@@ -211,6 +214,14 @@
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
visible: true
|
visible: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'customerName',
|
||||||
|
title: '客户',
|
||||||
|
halign: 'center',
|
||||||
|
align:'center',
|
||||||
|
sortable: true,
|
||||||
|
visible: true
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// title: '操作',
|
// title: '操作',
|
||||||
// halign: 'center',
|
// halign: 'center',
|
||||||
@@ -228,4 +239,4 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,153 @@
|
|||||||
|
package com.ruoyi.common.utils.security;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import java.security.*;
|
||||||
|
import java.security.interfaces.RSAPrivateKey;
|
||||||
|
import java.security.interfaces.RSAPublicKey;
|
||||||
|
import java.security.spec.PKCS8EncodedKeySpec;
|
||||||
|
import java.security.spec.X509EncodedKeySpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RSA加密解密
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
**/
|
||||||
|
public class RsaUtils
|
||||||
|
{
|
||||||
|
// Rsa 私钥
|
||||||
|
public static String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY"
|
||||||
|
+ "7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN"
|
||||||
|
+ "PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA"
|
||||||
|
+ "kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow"
|
||||||
|
+ "cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv"
|
||||||
|
+ "DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh"
|
||||||
|
+ "YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3" + "UP8iWi1Qw0Y=";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私钥解密
|
||||||
|
*
|
||||||
|
* @param privateKeyString 私钥
|
||||||
|
* @param text 待解密的文本
|
||||||
|
* @return 解密后的文本
|
||||||
|
*/
|
||||||
|
public static String decryptByPrivateKey(String text) throws Exception
|
||||||
|
{
|
||||||
|
return decryptByPrivateKey(privateKey, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公钥解密
|
||||||
|
*
|
||||||
|
* @param publicKeyString 公钥
|
||||||
|
* @param text 待解密的信息
|
||||||
|
* @return 解密后的文本
|
||||||
|
*/
|
||||||
|
public static String decryptByPublicKey(String publicKeyString, String text) throws Exception
|
||||||
|
{
|
||||||
|
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
|
||||||
|
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||||
|
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
|
||||||
|
Cipher cipher = Cipher.getInstance("RSA");
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||||
|
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
|
||||||
|
return new String(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私钥加密
|
||||||
|
*
|
||||||
|
* @param privateKeyString 私钥
|
||||||
|
* @param text 待加密的信息
|
||||||
|
* @return 加密后的文本
|
||||||
|
*/
|
||||||
|
public static String encryptByPrivateKey(String privateKeyString, String text) throws Exception
|
||||||
|
{
|
||||||
|
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
|
||||||
|
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||||
|
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
|
||||||
|
Cipher cipher = Cipher.getInstance("RSA");
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||||
|
byte[] result = cipher.doFinal(text.getBytes());
|
||||||
|
return Base64.encodeBase64String(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私钥解密
|
||||||
|
*
|
||||||
|
* @param privateKeyString 私钥
|
||||||
|
* @param text 待解密的文本
|
||||||
|
* @return 解密后的文本
|
||||||
|
*/
|
||||||
|
public static String decryptByPrivateKey(String privateKeyString, String text) throws Exception
|
||||||
|
{
|
||||||
|
PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
|
||||||
|
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||||
|
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5);
|
||||||
|
Cipher cipher = Cipher.getInstance("RSA");
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||||
|
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
|
||||||
|
return new String(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公钥加密
|
||||||
|
*
|
||||||
|
* @param publicKeyString 公钥
|
||||||
|
* @param text 待加密的文本
|
||||||
|
* @return 加密后的文本
|
||||||
|
*/
|
||||||
|
public static String encryptByPublicKey(String publicKeyString, String text) throws Exception
|
||||||
|
{
|
||||||
|
X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
|
||||||
|
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||||
|
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2);
|
||||||
|
Cipher cipher = Cipher.getInstance("RSA");
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||||
|
byte[] result = cipher.doFinal(text.getBytes());
|
||||||
|
return Base64.encodeBase64String(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建RSA密钥对
|
||||||
|
*
|
||||||
|
* @return 生成后的公私钥信息
|
||||||
|
*/
|
||||||
|
public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException
|
||||||
|
{
|
||||||
|
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
|
||||||
|
keyPairGenerator.initialize(1024);
|
||||||
|
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
||||||
|
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
|
||||||
|
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||||
|
String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded());
|
||||||
|
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
|
||||||
|
return new RsaKeyPair(publicKeyString, privateKeyString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RSA密钥对对象
|
||||||
|
*/
|
||||||
|
public static class RsaKeyPair
|
||||||
|
{
|
||||||
|
private final String publicKey;
|
||||||
|
private final String privateKey;
|
||||||
|
|
||||||
|
public RsaKeyPair(String publicKey, String privateKey)
|
||||||
|
{
|
||||||
|
this.publicKey = publicKey;
|
||||||
|
this.privateKey = privateKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicKey()
|
||||||
|
{
|
||||||
|
return publicKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrivateKey()
|
||||||
|
{
|
||||||
|
return privateKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user