Commit 5c930573 authored by xiongjunyi's avatar xiongjunyi

add:物流模板测试自动化用例

modify:1.解析excel单元格时,支持"aaa":["1","2"]类型的传参
       2.解析返回的json内容时,遇到纯数组对象类似"aaa":[17],可以正常解析存放变量到res_map中
       3.去掉运算符支持,改用前置语句中sql变量实现
parent 98acce22
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="manning" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
......@@ -19,7 +19,7 @@
<aspectj.version>1.8.10</aspectj.version>
</properties>
<distributionManagement>
<!--<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus ReleaseRepository</name>
......@@ -30,7 +30,7 @@
<name>Nexus SnapshotsRepository</name>
<url>http://10.8.0.128:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</distributionManagement>-->
<dependencies>
<dependency>
......
package com.miya.manning.enums;
public enum Symbol {
Type_plus("+","加法"),
Type_minus("-","减法"),
Type_multi("*","乘法"),
Type_divide("/","除法");
private String symbol;
private String desc;
Symbol(String symbol, String desc) {
this.symbol = symbol;
this.desc = desc;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.miya.manning.exception;
public class NotEqualsIfConditionException extends RuntimeException{
public NotEqualsIfConditionException(){super();};
public NotEqualsIfConditionException(String message) {
super(message);
}
}
package com.miya.manning.framework.response;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.framework.response
* @ClassName: SaasResponse
* @Description: java类作用描述
* @Author: 梁振振
* @CreateDate: 2020/8/21 下午4:56
* @UpdateUser:
* @UpdateDate:
*/
public class SaasResponse {
private String code;
private String msg;
private Object data;
public SaasResponse() {}
public JsonObject getJsonObjData() {
try {
Gson gs = new Gson();
JsonObject responseData = new JsonParser().parse(gs.toJson(this.data)).getAsJsonObject();
return responseData;
}catch (Exception e) {
return null;
}
}
public JsonArray getJsonArrData() {
try {
Gson gs = new Gson();
JsonArray responseData = new JsonParser().parse(gs.toJson(this.data)).getAsJsonArray();
return responseData;
}catch (Exception e) {
return null;
}
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
package com.miya.manning.framework.saas;
import com.miya.interfacetest.huihua.framework.util.GPSUtil;
import com.miya.interfacetest.huihua.framework.util.PropertiesHandle;
import com.miya.interfacetest.huihua.framework.util.StringUtil;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: Store
* @Description: 门店类
* @Author: 梁振振
* @CreateDate: 2020/8/11 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class Store {
private int id;
private int merchantId;
private String latitude;
private String longitude;
private String name;
private String provinceId;
private String cityId;
private String regionId;
private String address;
private double saasDistance;
public Store(int id) {
this.id = id;
this.setStoreInfoWithStoreId(id);
}
public void setStoreInfoWithStoreId(int id) {
MysqlUtil sqlUtil = new MysqlUtil();
ResultSet storeQuery = sqlUtil.ExecuteSelectSQL("select * from store where id = " + id);
try {
storeQuery.next();
this.merchantId = storeQuery.getInt("merchant_id");
this.latitude = storeQuery.getString("lat");
this.longitude = storeQuery.getString("lng");
this.name = storeQuery.getString("name");
this.provinceId = storeQuery.getString("province_id");
this.cityId = storeQuery.getString("city_id");
this.regionId = storeQuery.getString("region_id");
this.address = storeQuery.getString("address");
this.saasDistance = this.getSaasDistance();
} catch (SQLException e) {
e.printStackTrace();
}
}
public double getSaasDistance () {
String currentLng = PropertiesHandle.readValue(StringUtil.SAAS_PARAM_FILE_PATH, "current_hangzhou_longitude");
String currentLat = PropertiesHandle.readValue(StringUtil.SAAS_PARAM_FILE_PATH, "current_hangzhou_latitude");
return GPSUtil.GetSaasDistance(currentLng, currentLat, this.longitude, this.latitude);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProvinceId() {
return provinceId;
}
public void setProvinceId(String provinceId) {
this.provinceId = provinceId;
}
public String getCityId() {
return cityId;
}
public void setCityId(String cityId) {
this.cityId = cityId;
}
public String getRegionId() {
return regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public void setSaasDistance(double saasDistance) {
this.saasDistance = saasDistance;
}
}
package com.miya.manning.framework.saas.coupon;
import com.miya.interfacetest.huihua.framework.saas.User;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: Coupon
* @Description: 优惠券类
* @Author: 梁振振
* @CreateDate: 2020/8/11 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class Coupon {
private String couponId;
private int userId;
private int status;
private Date writeOffTime;
private Date createTime;
private int couponBatchId;
public Coupon(String couponId) throws SQLException {
this.couponId = couponId;
this.setCouponInfoWithCouponId(couponId);
}
public void setCouponInfoWithCouponId(String couponId) throws SQLException {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet couponQuery = mysqlUtil.ExecuteSelectSQL("select * from card_search where coupon_id = \"" + couponId + "\"");
couponQuery.next();
this.status = couponQuery.getInt("status");
this.writeOffTime = couponQuery.getTimestamp("write_off_time");
this.createTime = couponQuery.getTimestamp("create_time");
this.userId = couponQuery.getInt("userid");
this.couponBatchId = couponQuery.getInt("card_id");
}
public User getUser() throws SQLException {
return new User(String.valueOf(this.userId));
}
public CouponBatch getCouponBatch () throws SQLException {
return new CouponBatch(this.couponBatchId);
}
/* public CouponHongbaoActivity getFirstHongbaoActivity () throws SQLException {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet hongbaoQuery = mysqlUtil.ExecuteSelectSQL("select a.id from card_activity a left join card_red_packet_record r on a.id = r.activity_id " +
" where a.rule_coupon_id in (select card_id from card_search where coupon_id = \"" + this.getCouponId() + "\")" +
" order by r.gmt_create desc");
hongbaoQuery.next();
return new CouponHongbaoActivity(hongbaoQuery.getInt("id"));
}*/
public CouponHongbao getFirstHongbao () throws SQLException {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet hongbaoQuery = mysqlUtil.ExecuteSelectSQL("select r.id from card_activity a left join card_red_packet_record r on a.id = r.activity_id " +
" where a.rule_coupon_id in (select card_id from card_search where coupon_id = \"" + this.getCouponId() + "\")" +
" order by r.gmt_create desc");
hongbaoQuery.next();
return new CouponHongbao(hongbaoQuery.getInt("id"));
}
public String getCouponId() {
return couponId;
}
public void setCouponId(String couponId) {
this.couponId = couponId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getWriteOffTime() {
return writeOffTime;
}
public void setWriteOffTime(Date writeOffTime) {
this.writeOffTime = writeOffTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getCouponBatchId() {
return couponBatchId;
}
public void setCouponBatchId(int couponBatchId) {
this.couponBatchId = couponBatchId;
}
}
package com.miya.manning.framework.saas.coupon;
import com.miya.interfacetest.huihua.framework.saas.Store;
import com.miya.interfacetest.huihua.framework.util.ComparatorUtil;
import com.miya.interfacetest.huihua.framework.util.PropertiesHandle;
import com.miya.interfacetest.huihua.framework.util.StringUtil;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: CouponBatch
* @Description: 优惠券批次类
* @Author: 梁振振
* @CreateDate: 2020/8/11 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class CouponBatch {
private int id;
private int merchantId;
private String title;
private String type;
private String description;
private Date beginTime;
private Date endTime;
private String userRules;
private int giftable;
private String btnStatus;
private int num;
public CouponBatch(int id) {
this.id = id;
this.setCouponInfoWithCouponId(id);
this.setBtnStatus();
}
public void setCouponInfoWithCouponId(int id){
MysqlUtil sqlUtil = new MysqlUtil();
ResultSet couponQuery = sqlUtil.ExecuteSelectSQL("select * from card_ticket where id = " + id);
try {
couponQuery.next();
this.merchantId = couponQuery.getInt("merchant_id");
this.title = couponQuery.getString("card_title");
this.type = couponQuery.getString("card_type");
this.description = couponQuery.getString("description");
this.beginTime = couponQuery.getTimestamp("begin_timestamp");
this.endTime = couponQuery.getTimestamp("end_timestamp");
this.userRules = couponQuery.getString("use_rules");
this.giftable = couponQuery.getInt("is_support_given");
} catch (SQLException e) {
e.printStackTrace();
}
}
public List<Store> getStoreList() {
List<Store> storeList = new ArrayList<>();
MysqlUtil sqlUtil = new MysqlUtil();
ResultSet storeQuery = sqlUtil.ExecuteSelectSQL("select * from card_ticket_store_map where card_id = " + this.id);
try {
while (storeQuery.next()){
storeList.add(new Store(storeQuery.getInt("store_id")));
}
Collections.sort(storeList, ComparatorUtil.storeSaasDistanceComparator);
return storeList;
} catch (SQLException e) {
e.printStackTrace();
return storeList;
}
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getBeginTime() {
return beginTime;
}
public void setBeginTime(Date beginTime) {
this.beginTime = beginTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getUserRules() {
return userRules;
}
public void setUserRules(String userRules) {
this.userRules = userRules;
}
public int getGiftable() {
return giftable;
}
public void setGiftable(int giftable) {
this.giftable = giftable;
}
public String getBtnStatus() {
return btnStatus;
}
private void setBtnStatus() {
this.btnStatus = PropertiesHandle.readSpecialValue(StringUtil.COUPON_PARAM_FILE_PATH, String.valueOf(this.id));
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
}
package com.miya.manning.framework.saas.coupon;
import com.miya.interfacetest.huihua.framework.saas.User;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: CouponHongbao
* @Description: 红包类
* @Author: 梁振振
* @CreateDate:
* @UpdateUser:
* @UpdateDate:
*/
public class CouponHongbao {
private int id;
private int merchantId;
private int activityId;
private int userId;
private String userPhone;
private String activityTitle;
private String hongbaoGroupId;
private Date shareExpiryTime;
private Date receiveExpiryTime;
private int hongbaoCouponNum;
public CouponHongbao(int id) throws SQLException {
this.id = id;
this.setCouponHongbaoWithId(id);
}
public void setCouponHongbaoWithId(int id) throws SQLException {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet couponHongbaoQuery = mysqlUtil.ExecuteSelectSQL("select * from card_red_packet_record where id = " + id);
couponHongbaoQuery.next();
this.merchantId = couponHongbaoQuery.getInt("merchant_id");
this.activityId = couponHongbaoQuery.getInt("activity_id");
this.userId = couponHongbaoQuery.getInt("user_id");
this.userPhone = couponHongbaoQuery.getString("phone");
this.activityTitle = couponHongbaoQuery.getString("activity_title");
this.hongbaoGroupId = couponHongbaoQuery.getString("red_packet_group_id");
this.shareExpiryTime = couponHongbaoQuery.getTimestamp("share_end_date");
this.receiveExpiryTime = couponHongbaoQuery.getTimestamp("receive_end_time");
this.hongbaoCouponNum = couponHongbaoQuery.getInt("coupon_total_count");
}
public CouponHongbaoActivity getHongbaoActivity() throws SQLException {
return new CouponHongbaoActivity(this.activityId);
}
public Coupon getReceivedCoupon(User user) throws SQLException {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet couponQuery = mysqlUtil.ExecuteSelectSQL("select * from card_red_packet_search_map " +
"where red_packet_id = " + this.id + " and share_user_id = " + this.userId + " and receive_user_id = " + user.getUserId());
couponQuery.next();
return new Coupon(couponQuery.getString("coupon_id"));
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public int getActivityId() {
return activityId;
}
public void setActivityId(int activityId) {
this.activityId = activityId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getActivityTitle() {
return activityTitle;
}
public void setActivityTitle(String activityTitle) {
this.activityTitle = activityTitle;
}
public String getHongbaoGroupId() {
return hongbaoGroupId;
}
public void setHongbaoGroupId(String hongbaoGroupId) {
this.hongbaoGroupId = hongbaoGroupId;
}
public Date getShareExpiryTime() {
return shareExpiryTime;
}
public void setShareExpiryTime(Date shareExpiryTime) {
this.shareExpiryTime = shareExpiryTime;
}
public Date getReceiveExpiryTime() {
return receiveExpiryTime;
}
public void setReceiveExpiryTime(Date receiveExpiryTime) {
this.receiveExpiryTime = receiveExpiryTime;
}
public int getHongbaoCouponNum() {
return hongbaoCouponNum;
}
public void setHongbaoCouponNum(int hongbaoCouponNum) {
this.hongbaoCouponNum = hongbaoCouponNum;
}
}
package com.miya.manning.framework.saas.coupon;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: CouponHongbaoActivity
* @Description: 分享红包活动类
* @Author: 梁振振
* @CreateDate:
* @UpdateUser:
* @UpdateDate:
*/
public class CouponHongbaoActivity {
private int id;
private int merchantId;
private String activityTitle;
private String hongbaoGroupId;
private int shareExpiryHours;
private int receiveExpiryHours;
private String verifiedCouponTitle;
private int verifiedCouponId;
private int couponType;
private String shareTitle;
private String activityRules;
private int status;
public CouponHongbaoActivity(int id) throws SQLException {
this.id = id;
this.setCouponHongbaoActivityWithId(id);
}
public void setCouponHongbaoActivityWithId(int id) throws SQLException {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet couponHongbaoQuery = mysqlUtil.ExecuteSelectSQL("select * from card_activity where id = " + id);
couponHongbaoQuery.next();
this.merchantId = couponHongbaoQuery.getInt("merchant_id");
this.activityTitle = couponHongbaoQuery.getString("activity_title");
this.hongbaoGroupId = couponHongbaoQuery.getString("red_packet_group_id");
this.shareExpiryHours = couponHongbaoQuery.getInt("share_failure_hours");
this.receiveExpiryHours = couponHongbaoQuery.getInt("receive_failure_hours");
this.couponType = couponHongbaoQuery.getInt("card_type");
this.status = couponHongbaoQuery.getInt("status");
this.verifiedCouponTitle = couponHongbaoQuery.getString("rule_coupon_name");
this.verifiedCouponId = couponHongbaoQuery.getInt("rule_coupon_id");
this.shareTitle = couponHongbaoQuery.getString("share_title");
this.activityRules = couponHongbaoQuery.getString("activity_rule");
}
public List<CouponBatch> getHongbaoCouponList() throws SQLException {
List<CouponBatch> hongbaoCouponList = new ArrayList<>();
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet hongbaoCouponListQuery = mysqlUtil.ExecuteSelectSQL("select * from card_red_packet where group_id = \"" + this.hongbaoGroupId + "\"");
while (hongbaoCouponListQuery.next()){
hongbaoCouponList.add(new CouponBatch(hongbaoCouponListQuery.getInt("coupon_id")));
}
return hongbaoCouponList;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public String getActivityTitle() {
return activityTitle;
}
public void setActivityTitle(String activityTitle) {
this.activityTitle = activityTitle;
}
public String getHongbaoGroupId() {
return hongbaoGroupId;
}
public void setHongbaoGroupId(String hongbaoGroupId) {
this.hongbaoGroupId = hongbaoGroupId;
}
public int getShareExpiryHours() {
return shareExpiryHours;
}
public void setShareExpiryHours(int shareExpiryHours) {
this.shareExpiryHours = shareExpiryHours;
}
public int getReceiveExpiryHours() {
return receiveExpiryHours;
}
public void setReceiveExpiryHours(int receiveExpiryHours) {
this.receiveExpiryHours = receiveExpiryHours;
}
public String getVerifiedCouponTitle() {
return verifiedCouponTitle;
}
public void setVerifiedCouponTitle(String verifiedCouponTitle) {
this.verifiedCouponTitle = verifiedCouponTitle;
}
public int getVerifiedCouponId() {
return verifiedCouponId;
}
public void setVerifiedCouponId(int verifiedCouponId) {
this.verifiedCouponId = verifiedCouponId;
}
public int getCouponType() {
return couponType;
}
public void setCouponType(int couponType) {
this.couponType = couponType;
}
public String getShareTitle() {
return shareTitle;
}
public void setShareTitle(String shareTitle) {
this.shareTitle = shareTitle;
}
public String getActivityRules() {
return activityRules;
}
public void setActivityRules(String activityRules) {
this.activityRules = activityRules;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
package com.miya.manning.framework.saas.coupon;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: CouponMarket
* @Description: 券商城类
* @Author: 梁振振
* @CreateDate: 2020/8/11 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class CouponMarket {
private int merchantId;
private List<CouponPacket> couponPacketList;
public CouponMarket(int merchantId) {
this.merchantId = merchantId;
this.setCouponMarketInfoWithMerchantId();
}
public void setCouponMarketInfoWithMerchantId() {
this.couponPacketList = new ArrayList<>();
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet couponMarketQuery = mysqlUtil.ExecuteSelectSQL("select * from card_packet where merchant_id = " + this.merchantId + " and status = 1 order by sort is NULL, sort, create_time desc");
try {
while (couponMarketQuery.next()){
couponPacketList.add(new CouponPacket(couponMarketQuery.getInt("id")));
}
}catch (SQLException e) {
e.printStackTrace();
}
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public List<CouponPacket> getCouponPacketList() {
return couponPacketList;
}
public void setCouponPacketList(List<CouponPacket> couponPacketList) {
this.couponPacketList = couponPacketList;
}
}
package com.miya.manning.framework.saas.coupon;
import com.miya.interfacetest.huihua.framework.util.PropertiesHandle;
import com.miya.interfacetest.huihua.framework.util.StringUtil;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: CouponPacket
* @Description: 券包类
* @Author: 梁振振
* @CreateDate: 2020/8/11 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class CouponPacket {
private int id;
private int merchantId;
private String couponPacketName;
private double price;
private double linePirce;
private Date startTime;
private Date endTime;
private int status;
private String userDesc;
private int type;
private int stock;
private int dayLimit;
private int personLimit;
private int soldNum;
private String buyBtnStatus;
private int couponNum;
public CouponPacket(int id) throws SQLException {
this.id = id;
this.setCouponPacketInfoWithId(id);
this.setBuyBtnStatus();
this.setCouponNum();
}
public void setCouponPacketInfoWithId (int id) throws SQLException {
MysqlUtil sqlUtil = new MysqlUtil();
ResultSet couponPacketQuery = sqlUtil.ExecuteSelectSQL("select * from card_packet where id = " + id);
couponPacketQuery.next();
this.merchantId = couponPacketQuery.getInt("merchant_id");
this.couponPacketName = couponPacketQuery.getString("card_packet_name");
this.price = (double)couponPacketQuery.getInt("card_packet_price")/100;
this.linePirce = (double)couponPacketQuery.getInt("marking_price")/100;
this.startTime = couponPacketQuery.getTimestamp("start_time");
this.endTime = couponPacketQuery.getTimestamp("end_time");
this.status = couponPacketQuery.getInt("status");
this.userDesc = couponPacketQuery.getString("use_desc");
this.type = couponPacketQuery.getInt("card_packet_type");
this.stock = couponPacketQuery.getInt("stock");
this.dayLimit = couponPacketQuery.getInt("day_purchase_limit");
this.personLimit = couponPacketQuery.getInt("person_purchase_limit");
this.soldNum = couponPacketQuery.getInt("sale_stock");
}
private void setBuyBtnStatus() {
this.buyBtnStatus = PropertiesHandle.readSpecialValue(StringUtil.COUPON_PACKET_PARAM_FILE_PATH, String.valueOf(this.id));
}
public List<CouponBatch> getCouponBatchList() throws SQLException {
List<CouponBatch> queryedCouponBatchList = new ArrayList<CouponBatch>();
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet couponMapQuery = mysqlUtil.ExecuteSelectSQL("select card_id, num from card_packet_map where card_packet_id = " + this.id + " order by card_id desc");
while (couponMapQuery.next()){
CouponBatch couponBatch = new CouponBatch(couponMapQuery.getInt("card_id"));
couponBatch.setNum(couponMapQuery.getInt("num"));
queryedCouponBatchList.add(couponBatch);
}
return queryedCouponBatchList;
}
private void setCouponNum() throws SQLException {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet couponMapQuery = mysqlUtil.ExecuteSelectSQL("select sum(num) as total_num from card_packet_map where card_packet_id = " + this.id);
couponMapQuery.next();
this.couponNum = couponMapQuery.getInt("total_num");
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public String getCouponPacketName() {
return couponPacketName;
}
public void setCouponPacketName(String couponPacketName) {
this.couponPacketName = couponPacketName;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getLinePirce() {
return linePirce;
}
public void setLinePirce(double linePirce) {
this.linePirce = linePirce;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getUserDesc() {
return userDesc;
}
public void setUserDesc(String userDesc) {
this.userDesc = userDesc;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
public int getDayLimit() {
return dayLimit;
}
public void setDayLimit(int dayLimit) {
this.dayLimit = dayLimit;
}
public int getPersonLimit() {
return personLimit;
}
public void setPersonLimit(int personLimit) {
this.personLimit = personLimit;
}
public int getSoldNum() {
return soldNum;
}
public void setSoldNum(int soldNum) {
this.soldNum = soldNum;
}
public String getBuyBtnStatus() {
return buyBtnStatus;
}
public void setBuyBtnStatus(String buyBtnStatus) {
this.buyBtnStatus = buyBtnStatus;
}
public int getCouponNum() {
return couponNum;
}
public void setCouponNum(int couponNum) {
this.couponNum = couponNum;
}
}
package com.miya.manning.framework.saas.giftcard;
import com.miya.interfacetest.huihua.framework.saas.User;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: GiftCard
* @Description: 礼品卡类
* @Author: 梁振振
* @CreateDate: 2020/9/7 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class GiftCard {
private int id;
private int merchantId;
private int userId;
private int cardId;
private String cardNo;
private int balance;
private int sourceType;
private int status;
private Date writeOffTime;
private String fromUserName;
private int givingBalance;
private Date receiveTime;
public GiftCard(int id) {
this.id = id;
this.setGiftCardInfo();
}
public GiftCard(String cardNo) {
this.cardNo = cardNo;
this.setGiftCardInfo();
}
public void setGiftCardInfo () {
MysqlUtil mysqlUtil = new MysqlUtil();
String sql = "";
if (this.id > 0) {
sql = "select * from hh_giftcard_user where id = " + this.id;
} else if (!this.cardNo.isEmpty()) {
sql = "select * from hh_giftcard_user where card_no = \"" + this.cardNo + "\"";
}
ResultSet giftCardQuery = mysqlUtil.ExecuteSelectSQL(sql);
try {
giftCardQuery.next();
this.id = giftCardQuery.getInt("id");
this.merchantId = giftCardQuery.getInt("merchant_id");
this.userId = giftCardQuery.getInt("user_id");
this.cardId = giftCardQuery.getInt("card_id");
this.cardNo = giftCardQuery.getString("card_no");
this.balance = giftCardQuery.getInt("balance");
this.sourceType = giftCardQuery.getInt("source_type");
this.status = giftCardQuery.getInt("status");
this.writeOffTime = giftCardQuery.getTimestamp("write_off_time");
ResultSet givingInfoQuery = mysqlUtil.ExecuteSelectSQL("select * from (SELECT * FROM `hh_giftcard_giving_info` where card_no = \"" +
this.cardNo +"\" order by receive_time desc) a group by card_no ");
if (givingInfoQuery.next()){
this.fromUserName = new User(givingInfoQuery.getInt("from_user_id")).getUserPhone();
this.givingBalance = givingInfoQuery.getInt("balance");
this.receiveTime = givingInfoQuery.getTimestamp("receive_time");
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public GiftCardBatch getGiftCardBatch () {
return new GiftCardBatch(this.cardId);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj != null && obj instanceof GiftCard) {
GiftCard giftCard = (GiftCard) obj;
return this.cardNo.equals(giftCard.cardNo);
} else {
return false;
}
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getCardId() {
return cardId;
}
public void setCardId(int cardId) {
this.cardId = cardId;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
public int getSourceType() {
return sourceType;
}
public void setSourceType(int sourceType) {
this.sourceType = sourceType;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getWriteOffTime() {
return writeOffTime;
}
public void setWriteOffTime(Date writeOffTime) {
this.writeOffTime = writeOffTime;
}
public String getFromUserName() {
return fromUserName;
}
public void setFromUserName(String fromUserName) {
this.fromUserName = fromUserName;
}
public int getGivingBalance() {
return givingBalance;
}
public void setGivingBalance(int givingBalance) {
this.givingBalance = givingBalance;
}
public Date getReceiveTime() {
return receiveTime;
}
public void setReceiveTime(Date receiveTime) {
this.receiveTime = receiveTime;
}
}
package com.miya.manning.framework.saas.giftcard;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: GiftCardBatch
* @Description: 礼品卡批次类
* @Author: 梁振振
* @CreateDate: 2020/9/7 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class GiftCardBatch {
private int id;
private int merchantId;
private String stockId;
private String title;
private String description;
private int price;
private int value;
private Date startTime;
private Date endTime;
private int stock;
private String userRules;
private int status;
public GiftCardBatch(int id) {
this.id = id;
this.setGiftCardInfo();
}
public GiftCardBatch(String stockId) {
this.stockId = stockId;
this.setGiftCardInfo();
}
public void setGiftCardInfo () {
MysqlUtil mysqlUtil = new MysqlUtil();
String sql = "";
if (this.id > 0) {
sql = "select * from hh_giftcard_info where id = " + this.id;
} else if (!this.stockId.isEmpty()) {
sql = "select * from hh_giftcard_info where card_stock_id = \"" + this.stockId + "\"";
}
ResultSet giftCardQuery = mysqlUtil.ExecuteSelectSQL(sql);
try {
giftCardQuery.next();
this.id = giftCardQuery.getInt("id");
this.merchantId = giftCardQuery.getInt("merchant_id");
this.stockId = giftCardQuery.getString("card_stock_id");
this.title = giftCardQuery.getString("card_title");
this.description = giftCardQuery.getString("card_description");
this.price = giftCardQuery.getInt("card_price");
this.value = giftCardQuery.getInt("card_denomination");
this.startTime = giftCardQuery.getTimestamp("card_starttime");
this.endTime = giftCardQuery.getTimestamp("card_endtime");
this.stock = giftCardQuery.getInt("card_stock");
this.userRules = giftCardQuery.getString("card_use_desc");
this.status = giftCardQuery.getInt("status");
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public String getStockId() {
return stockId;
}
public void setStockId(String stockId) {
this.stockId = stockId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
public String getUserRules() {
return userRules;
}
public void setUserRules(String userRules) {
this.userRules = userRules;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
package com.miya.manning.framework.saas.giftcard;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: GiftCardCategory
* @Description: 礼品卡类别类
* @Author: 梁振振
* @CreateDate: 2020/9/7 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class GiftCardCategory {
private int id;
private int merchantId;
private String title;
private List<GiftCardBatch> giftCardBatchList;
public GiftCardCategory(int merchantId) {
this.merchantId = merchantId;
this.setNoCategoryCategory();
}
public GiftCardCategory(int id, int merchantId) {
this.id = id;
this.merchantId = merchantId;
this.setGiftCardCategoryWithId();
}
public void setGiftCardCategoryWithId () {
this.giftCardBatchList = new ArrayList<>();
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet categoryQuery = mysqlUtil.ExecuteSelectSQL("select * from hh_giftcard_category where id = " + this.id);
ResultSet giftCardListQuery = mysqlUtil.ExecuteSelectSQL("select m.* from hh_category_info_map m left join hh_giftcard_info g on g.id = m.card_id " +
" where g.status = 1 and m.category_id = " + this.id + " order by g.sort is NULL, g.sort, g.create_time desc");
try {
categoryQuery.next();
this.title = categoryQuery.getString("name");
while (giftCardListQuery.next()){
this.giftCardBatchList.add(new GiftCardBatch(giftCardListQuery.getInt("card_id")));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public void setNoCategoryCategory () {
this.giftCardBatchList = new ArrayList<>();
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet giftCardListQuery = mysqlUtil.ExecuteSelectSQL("select * from hh_giftcard_info where id not in " +
"(select card_id from hh_category_info_map where category_id in " +
"(select id from hh_giftcard_category where show_status = 1 )) and merchant_id = "+
this.merchantId + " and status = 1 order by sort is NULL, sort, create_time desc");
try {
while (giftCardListQuery.next()){
this.giftCardBatchList.add(new GiftCardBatch(giftCardListQuery.getInt("id")));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<GiftCardBatch> getGiftCardBatchList() {
return giftCardBatchList;
}
public void setGiftCardBatchList(List<GiftCardBatch> giftCardBatchList) {
this.giftCardBatchList = giftCardBatchList;
}
}
package com.miya.manning.framework.saas.giftcard;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: GiftCardMarket
* @Description: 礼品卡商城类
* @Author: 梁振振
* @CreateDate: 2020/9/7 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class GiftCardMarket {
private int merchantId;
private GiftCardCategory noCategoryCategory;
private List<GiftCardCategory> categoryList;
public GiftCardMarket(int merchantId) {
this.merchantId = merchantId;
this.setGiftCardMarketWithMerchant();
}
public void setGiftCardMarketWithMerchant () {
this.noCategoryCategory = new GiftCardCategory(this.merchantId);
this.categoryList = new ArrayList<>();
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet categoryListQuery = mysqlUtil.ExecuteSelectSQL("select * from hh_giftcard_category where show_status = 1 and merchant_id = " + this.merchantId +
" and id not in (select c.category_id from (select sum(status) as valid, m.category_id " +
"from hh_giftcard_info g left join hh_category_info_map m on g.id = m.card_id GROUP BY m.category_id) c where c.valid = 0) order by sort IS NULL,sort, create_time desc");
try {
while (categoryListQuery.next()) {
this.categoryList.add(new GiftCardCategory(categoryListQuery.getInt("id"), this.merchantId));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public GiftCardCategory getNoCategoryCategory() {
return noCategoryCategory;
}
public void setNoCategoryCategory(GiftCardCategory noCategoryCategory) {
this.noCategoryCategory = noCategoryCategory;
}
public List<GiftCardCategory> getCategoryList() {
return categoryList;
}
public void setCategoryList(List<GiftCardCategory> categoryList) {
this.categoryList = categoryList;
}
}
package com.miya.manning.framework.saas.order;
import java.sql.SQLException;
public class CouponMarketOrder extends Order {
//quan
private int sendCouponStatus;
private int couponRefundable;
public CouponMarketOrder(int id) throws SQLException {
super(id);
}
public CouponMarketOrder(String orderNo) throws SQLException {
super(orderNo);
}
}
package com.miya.manning.framework.saas.order;
import java.sql.SQLException;
public class DaojiaOrder extends Order {
//daojia
private int storeId;
private double packPrice;
private double totalWeght;
private String consigneePhone;
private int deliveryType;
private String notes;
private int businessSource;
private int activityId;
private String sellerNotes;
private int refundGoodsCount;
public DaojiaOrder(int id) throws SQLException {
super(id);
}
}
package com.miya.manning.framework.saas.order;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
public class GiftCardOrder extends Order{
private String cardNo;
public GiftCardOrder(String orderNo) {
super(orderNo);
this.setGiftCardOrderInfo();
}
public void setGiftCardOrderInfo () {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet orderQuery = mysqlUtil.ExecuteSelectSQL("select * from hh_order_gifcard_map where order_id = " + this.getId());
try {
orderQuery.next();
this.cardNo = orderQuery.getString("card_no");
} catch (SQLException e) {
e.printStackTrace();
}
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
}
package com.miya.manning.framework.saas.order;
import com.miya.interfacetest.huihua.framework.saas.User;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.huihua.framework.saas
* @ClassName: Order
* @Description: 订单类
* @Author: 梁振振
* @CreateDate: 2020/9/1 下午18:02
* @UpdateUser:
* @UpdateDate:
*/
public class Order {
//common
private int id;
private String orderNo;
private int totalOrderPirce;
private int totalPayPrice;
private int platformDiscount;
private int merchantDiscount;
private int businessType;
private int goodsNum;
private User user;
private int orderStatus;
private int paymentStatus;
private int refundStatus;
private int paymentType;
private Date cancelTime;
private int cancelType;
private String cancelReason;
private int refundableAmount;
private Date createTime;
public Order(int id){
this.id = id;
this.setOrderInfoWithId(id);
}
public Order(String orderNo){
this.orderNo = orderNo;
this.setOrderInfoWithOrderNo(orderNo);
}
public void setOrderInfoWithId(int id){
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet orderQuery = mysqlUtil.ExecuteSelectSQL("select * from center_order where id = " + id);
try{
orderQuery.next();
this.orderNo = orderQuery.getString("order_no");
this.totalOrderPirce = orderQuery.getInt("total_order_price");
this.totalPayPrice = orderQuery.getInt("total_pay_price");
this.platformDiscount = orderQuery.getInt("platform_discount_amount");
this.merchantDiscount = orderQuery.getInt("merchant_discount_amount");
this.businessType = orderQuery.getInt("business_type");
this.goodsNum = orderQuery.getInt("goods_num");
this.user = new User(orderQuery.getString("order_user_id"));
this.orderStatus = orderQuery.getInt("order_status");
this.paymentStatus = orderQuery.getInt("payment_status");
this.refundStatus = orderQuery.getInt("refund_status");
this.paymentType = orderQuery.getInt("payment_type");
this.cancelTime = orderQuery.getTimestamp("cancel_time");
this.cancelType = orderQuery.getInt("cancel_type");
this.cancelReason = orderQuery.getString("cancel_reason");
this.refundableAmount = orderQuery.getInt("refundable_amount");
this.createTime = orderQuery.getTimestamp("create_time");
}catch (SQLException e) {
e.printStackTrace();
}
}
public void setOrderInfoWithOrderNo(String orderNo){
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet orderQuery = mysqlUtil.ExecuteSelectSQL("select * from center_order where order_no = \"" + orderNo + "\"");
try {
orderQuery.next();
this.id = orderQuery.getInt("id");
this.totalOrderPirce = orderQuery.getInt("total_order_price");
this.totalPayPrice = orderQuery.getInt("total_pay_price");
this.platformDiscount = orderQuery.getInt("platform_discount_amount");
this.merchantDiscount = orderQuery.getInt("merchant_discount_amount");
this.businessType = orderQuery.getInt("business_type");
this.goodsNum = orderQuery.getInt("goods_num");
this.user = new User(orderQuery.getString("order_user_id"));
this.orderStatus = orderQuery.getInt("order_status");
this.paymentStatus = orderQuery.getInt("payment_status");
this.refundStatus = orderQuery.getInt("refund_status");
this.paymentType = orderQuery.getInt("payment_type");
this.cancelTime = orderQuery.getTimestamp("cancel_time");
this.cancelType = orderQuery.getInt("cancel_type");
this.cancelReason = orderQuery.getString("cancel_reason");
this.refundableAmount = orderQuery.getInt("refundable_amount");
this.createTime = orderQuery.getTimestamp("create_time");
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public int getTotalOrderPirce() {
return totalOrderPirce;
}
public void setTotalOrderPirce(int totalOrderPirce) {
this.totalOrderPirce = totalOrderPirce;
}
public int getTotalPayPrice() {
return totalPayPrice;
}
public void setTotalPayPrice(int totalPayPrice) {
this.totalPayPrice = totalPayPrice;
}
public int getPlatformDiscount() {
return platformDiscount;
}
public void setPlatformDiscount(int platformDiscount) {
this.platformDiscount = platformDiscount;
}
public int getMerchantDiscount() {
return merchantDiscount;
}
public void setMerchantDiscount(int merchantDiscount) {
this.merchantDiscount = merchantDiscount;
}
public int getBusinessType() {
return businessType;
}
public void setBusinessType(int businessType) {
this.businessType = businessType;
}
public int getGoodsNum() {
return goodsNum;
}
public void setGoodsNum(int goodsNum) {
this.goodsNum = goodsNum;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public int getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(int orderStatus) {
this.orderStatus = orderStatus;
}
public int getPaymentStatus() {
return paymentStatus;
}
public void setPaymentStatus(int paymentStatus) {
this.paymentStatus = paymentStatus;
}
public int getRefundStatus() {
return refundStatus;
}
public void setRefundStatus(int refundStatus) {
this.refundStatus = refundStatus;
}
public int getPaymentType() {
return paymentType;
}
public void setPaymentType(int paymentType) {
this.paymentType = paymentType;
}
public Date getCancelTime() {
return cancelTime;
}
public void setCancelTime(Date cancelTime) {
this.cancelTime = cancelTime;
}
public int getCancelType() {
return cancelType;
}
public void setCancelType(int cancelType) {
this.cancelType = cancelType;
}
public String getCancelReason() {
return cancelReason;
}
public void setCancelReason(String cancelReason) {
this.cancelReason = cancelReason;
}
public int getRefundableAmount() {
return refundableAmount;
}
public void setRefundableAmount(int refundableAmount) {
this.refundableAmount = refundableAmount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.miya.manning.framework.saas.order;
import java.sql.SQLException;
public class PointsMarketOrder extends Order {
private int totalPoints;
public PointsMarketOrder(int id) throws SQLException {
super(id);
}
}
package com.miya.manning.framework.saas.requestmessage;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.miya.interfacetest.huihua.framework.util.DateUtil;
import com.miya.interfacetest.huihua.framework.util.dbutil.MysqlUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class CouponVerificationMsg {
private String cashierNo;
private String couponDeductionNo;
private List<JsonObject> goodsItems;
private String merchantNo;
private String merchantOrderId;
private int orderAmount;
private String posDeviceNo;
private String posTradeNo;
private String storeNo;
public CouponVerificationMsg(String couponDeductionNo) {
this.couponDeductionNo = couponDeductionNo;
this.cashierNo = "17012";
this.merchantNo = "1305561201";
this.merchantOrderId = "999001"+DateUtil.format(new Date(), "yyyyMMddHHmmssSSS");
this.posDeviceNo = "0009";
this.posTradeNo = this.merchantOrderId;
//this.storeNo = "3003";
this.setStoreNo();
this.setGoodsItemsAndAmount();
}
public void setStoreNo() {
MysqlUtil mysqlUtil = new MysqlUtil();
ResultSet storeQuery = mysqlUtil.ExecuteSelectSQL("select * from card_ticket_store_map where card_id = " +
"(select card_id from card_search where coupon_id = \""+ this.couponDeductionNo.substring(1) +"\")");
try {
storeQuery.next();
this.storeNo = storeQuery.getString("store_id");
} catch (SQLException e) {
this.storeNo = "3003";
e.printStackTrace();
}
}
public void setGoodsItemsAndAmount() {
try{
Gson gs = new Gson();
goodsItems = new ArrayList<>();
GoodsItem goodsItem1 = new GoodsItem("商品1", "6954767425645", 2000, 1);
GoodsItem goodsItem2 = new GoodsItem("商品2", "11006028", 800, 1);
GoodsItem goodsItem3 = new GoodsItem("商品3", "1234", 100, 2);
this.goodsItems.add(new JsonParser().parse(gs.toJson(goodsItem1, GoodsItem.class)).getAsJsonObject());
this.goodsItems.add(new JsonParser().parse(gs.toJson(goodsItem2, GoodsItem.class)).getAsJsonObject());
this.goodsItems.add(new JsonParser().parse(gs.toJson(goodsItem3, GoodsItem.class)).getAsJsonObject());
this.orderAmount = goodsItem1.getPrice()*goodsItem1.getQuantity()
+ goodsItem2.getPrice()*goodsItem2.getQuantity()
+ goodsItem3.getPrice()*goodsItem3.getQuantity();
}catch (Exception e) {
e.printStackTrace();
}
}
public JsonObject getCouponVerificationMsg() {
//CouponVerificationMsg couponVerificationMsg = new CouponVerificationMsg(this.couponDeductionNo);
Gson gs = new Gson();
return new JsonParser().parse(gs.toJson(this, CouponVerificationMsg.class)).getAsJsonObject();
}
public String getCashierNo() {
return cashierNo;
}
public void setCashierNo(String cashierNo) {
this.cashierNo = cashierNo;
}
public String getCouponDeductionNo() {
return couponDeductionNo;
}
public void setCouponDeductionNo(String couponDeductionNo) {
this.couponDeductionNo = couponDeductionNo;
}
public List<JsonObject> getGoodsItems() {
return goodsItems;
}
public void setGoodsItems(List<JsonObject> goodsItems) {
this.goodsItems = goodsItems;
}
public String getMerchantNo() {
return merchantNo;
}
public void setMerchantNo(String merchantNo) {
this.merchantNo = merchantNo;
}
public String getMerchantOrderId() {
return merchantOrderId;
}
public void setMerchantOrderId(String merchantOrderId) {
this.merchantOrderId = merchantOrderId;
}
public int getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(int orderAmount) {
this.orderAmount = orderAmount;
}
public String getPosDeviceNo() {
return posDeviceNo;
}
public void setPosDeviceNo(String posDeviceNo) {
this.posDeviceNo = posDeviceNo;
}
public String getPosTradeNo() {
return posTradeNo;
}
public void setPosTradeNo(String posTradeNo) {
this.posTradeNo = posTradeNo;
}
public String getStoreNo() {
return storeNo;
}
public void setStoreNo(String storeNo) {
this.storeNo = storeNo;
}
}
class GoodsItem {
private String goodsName;
private String goodsNo;
private int price;
private int quantity;
public GoodsItem(String goodsName, String goodsNo, int price, int quantity) {
this.goodsName = goodsName;
this.goodsNo = goodsNo;
this.price = price;
this.quantity = quantity;
}
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public String getGoodsNo() {
return goodsNo;
}
public void setGoodsNo(String goodsNo) {
this.goodsNo = goodsNo;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
}
package com.miya.manning.framework.saas.requestmessage;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.miya.interfacetest.huihua.framework.saas.User;
import com.miya.interfacetest.huihua.framework.util.PropertiesHandle;
import com.miya.interfacetest.huihua.framework.util.StringUtil;
public class LoginMsg {
private String jsCode;
private String openIdOrUserId;
private String from;
private String clientId;
private int appPublishType;
public LoginMsg(User user) {
this.jsCode = PropertiesHandle.readValue(StringUtil.SAAS_PARAM_FILE_PATH, "js_code");
this.openIdOrUserId = user.getUserOpenId();
this.from = PropertiesHandle.readValue(StringUtil.SAAS_PARAM_FILE_PATH, "merchant");
this.clientId = PropertiesHandle.readValue(StringUtil.SAAS_PARAM_FILE_PATH, "clientid_wechat");
this.appPublishType = 0;
}
public JsonObject getJsonMsg() {
Gson gs = new Gson();
return new JsonParser().parse(gs.toJson(this, LoginMsg.class)).getAsJsonObject();
}
public String getJsCode() {
return jsCode;
}
public void setJsCode(String jsCode) {
this.jsCode = jsCode;
}
public String getOpenIdOrUserId() {
return openIdOrUserId;
}
public void setOpenIdOrUserId(String openIdOrUserId) {
this.openIdOrUserId = openIdOrUserId;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public int getAppPublishType() {
return appPublishType;
}
public void setAppPublishType(int appPublishType) {
this.appPublishType = appPublishType;
}
}
package com.miya.manning.framework.saas.requestmessage;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.miya.interfacetest.huihua.framework.saas.giftcard.GiftCardBatch;
import com.miya.interfacetest.huihua.framework.util.PropertiesHandle;
import com.miya.interfacetest.huihua.framework.util.StringUtil;
public class OrderSubmitMsg {
private String businessType;
private JsonObject data;
public OrderSubmitMsg(String businessType) {
this.businessType = businessType;
}
public JsonObject getCouponMarketOrderMsg(String cardPacketId) {
Gson gs = new Gson();
CouponMarketData couponMarketData = new CouponMarketData(cardPacketId);
this.data = new JsonParser().parse(gs.toJson(couponMarketData, CouponMarketData.class)).getAsJsonObject();
return new JsonParser().parse(gs.toJson(this, OrderSubmitMsg.class)).getAsJsonObject();
}
public JsonObject getGiftCardOrderMsg(String cardStockId) {
Gson gs = new Gson();
GiftCardMarketData giftCardMarketData = new GiftCardMarketData(cardStockId);
this.data = new JsonParser().parse(gs.toJson(giftCardMarketData, GiftCardMarketData.class)).getAsJsonObject();
return new JsonParser().parse(gs.toJson(this, OrderSubmitMsg.class)).getAsJsonObject();
}
public String getBusinessType() {
return businessType;
}
public void setBusinessType(String businessType) {
this.businessType = businessType;
}
public JsonObject getData() {
return data;
}
public void setData(JsonObject data) {
this.data = data;
}
}
class CouponMarketData {
private String cardPacketId;
public CouponMarketData(String cardPacketId) {
this.cardPacketId = cardPacketId;
}
public String getCardPacketId() {
return cardPacketId;
}
public void setCardPacketId(String cardPacketId) {
this.cardPacketId = cardPacketId;
}
}
class GiftCardMarketData {
private String cardStockId;
private String merchant;
private int price;
private int quantity;
public GiftCardMarketData (String cardStockId) {
GiftCardBatch giftCardBatch = new GiftCardBatch(cardStockId);
this.price = giftCardBatch.getPrice();
this.cardStockId = cardStockId;
this.merchant = PropertiesHandle.readValue(StringUtil.SAAS_PARAM_FILE_PATH, "merchant");
this.quantity = 1;
}
public String getCardStockId() {
return cardStockId;
}
public void setCardStockId(String cardStockId) {
this.cardStockId = cardStockId;
}
public String getMerchant() {
return merchant;
}
public void setMerchant(String merchant) {
this.merchant = merchant;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
}
\ No newline at end of file
package com.miya.manning.framework.saas.requestmessage;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.miya.interfacetest.huihua.framework.saas.order.Order;
import com.miya.interfacetest.huihua.framework.util.PropertiesHandle;
import com.miya.interfacetest.huihua.framework.util.StringUtil;
import java.util.Date;
public class PaySuccessMsg {
private int merchantDiscountAmount;
private String openId;
private String orderNo;
private long paymentTime;
private int platformDiscountAmount;
private String pmtChannel;
private String totalFee;
private String tradeNo;
private int userPayPrice;
public PaySuccessMsg() { }
public JsonObject getJsonMsg(String orderNo) {
Order order = new Order(orderNo);
this.orderNo = orderNo;
this.tradeNo = orderNo;
this.merchantDiscountAmount = 0;
this.openId = PropertiesHandle.readValue(StringUtil.SAAS_PARAM_FILE_PATH, "order_open_id");
this.paymentTime = new Date().getTime();
this.platformDiscountAmount = 0;
this.pmtChannel = "0";
this.totalFee = String.valueOf(order.getTotalOrderPirce());
this.userPayPrice = order.getTotalPayPrice();
Gson gs = new Gson();
return new JsonParser().parse(gs.toJson(this, PaySuccessMsg.class)).getAsJsonObject();
}
public int getMerchantDiscountAmount() {
return merchantDiscountAmount;
}
public void setMerchantDiscountAmount(int merchantDiscountAmount) {
this.merchantDiscountAmount = merchantDiscountAmount;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public long getPaymentTime() {
return paymentTime;
}
public void setPaymentTime(long paymentTime) {
this.paymentTime = paymentTime;
}
public int getPlatformDiscountAmount() {
return platformDiscountAmount;
}
public void setPlatformDiscountAmount(int platformDiscountAmount) {
this.platformDiscountAmount = platformDiscountAmount;
}
public String getPmtChannel() {
return pmtChannel;
}
public void setPmtChannel(String pmtChannel) {
this.pmtChannel = pmtChannel;
}
public String getTotalFee() {
return totalFee;
}
public void setTotalFee(String totalFee) {
this.totalFee = totalFee;
}
public String getTradeNo() {
return tradeNo;
}
public void setTradeNo(String tradeNo) {
this.tradeNo = tradeNo;
}
public int getUserPayPrice() {
return userPayPrice;
}
public void setUserPayPrice(int userPayPrice) {
this.userPayPrice = userPayPrice;
}
}
package com.miya.manning.framework.util;
import com.miya.interfacetest.huihua.framework.saas.Store;
import java.util.Comparator;
public class ComparatorUtil {
public static Comparator<Store> storeSaasDistanceComparator = new Comparator<Store>() {
@Override
public int compare(Store s1, Store s2) {
if (s1.getSaasDistance() != s2.getSaasDistance()) {
return new Double(s1.getSaasDistance()).intValue()-new Double(s2.getSaasDistance()).intValue();
} else {
if (s1.getId() != s2.getId()) {
return s1.getId() - s2.getId();
}else {
return 0;
}
}
}
};
}
......@@ -183,7 +183,7 @@ public class ExcelUtil {
buffer.append(reference_data);
}
}
else if(header.contains("(Integer)") || header.contains("(bool)") || header.contains("(ArrayList)")){
else if(header.contains("(Integer)") || header.contains("(bool)") || header.contains("(ArrayList)") || header.contains("(Array)")){
//Integer字段不加引用数据组数,所以不能放上面的if分支里,单独拉出来
//考虑到该字段可能采用变量方式填入值,不采取直接转int的方式,而是不拼接""处理
//如果是纯数组类型的传参 例如 "excludeCalculateActivityTypes":["FULL-PACKAGE_PRICE"] 则直接拼接内容
......
......@@ -64,7 +64,7 @@ public class HttpHeaderBuilt {
}
public static Map<String,String> httpHeadBuiltManningsC(Map<String,String> string_var_map){
public static Map<String,String> httpHeadBuiltManningsC(Map<String,String> string_var_map ,Map<String,Integer> int_var_map){
Map<String,String> httpheadermap = new HashMap<>();
httpheadermap.put("hh-app","wxc836213220ab21fb");
httpheadermap.put("hh-from","149");
......@@ -77,9 +77,9 @@ public class HttpHeaderBuilt {
httpheadermap.put("shareUid", "");
httpheadermap.put("sence","");
httpheadermap.put("userId","");
httpheadermap.put("c-user-id",string_var_map.containsKey("varg_user_id")? string_var_map.get("varg_user_id") : "");
httpheadermap.put("c-member-id",string_var_map.containsKey("varg_member_id")? string_var_map.get("varg_member_id") : "");
httpheadermap.put("c-bind-store-id",string_var_map.containsKey("varg_bind_store_id")? string_var_map.get("varg_bind_store_id") : "");
httpheadermap.put("c-user-id",int_var_map.containsKey("varg_user_id")? int_var_map.get("varg_user_id").toString() : "");
httpheadermap.put("c-member-id",int_var_map.containsKey("varg_member_id")? int_var_map.get("varg_member_id").toString() : "");
httpheadermap.put("c-bind-store-id",int_var_map.containsKey("varg_bind_store_id")? int_var_map.get("varg_bind_store_id").toString() : "");
return httpheadermap;
}
......
package com.miya.manning.framework.util;
import com.miya.manning.enums.Symbol;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
......@@ -42,7 +39,7 @@ public class ParamsBuilt {
public static String params_replace(String params, Map<String, Integer> int_var_map, Map<String, String> string_var_map ) {
if(params != null){
if (int_var_map.size() != 0) {
for (Map.Entry<String, Integer> entry : int_var_map.entrySet()) {
/*for (Map.Entry<String, Integer> entry : int_var_map.entrySet()) {
params = params.replaceAll(entry.getKey(), String.valueOf(entry.getValue()));
if(params.contains(Symbol.Type_plus.getSymbol())){
BigDecimal sum = BigDecimal.valueOf(0);
......@@ -80,7 +77,7 @@ public class ParamsBuilt {
}
params = String.valueOf(sum);
}
}
}*/
}
if (string_var_map.size() != 0) {
for (Map.Entry<String, String> entry : string_var_map.entrySet()) {
......@@ -105,6 +102,42 @@ public class ParamsBuilt {
if (int_var_map.size() != 0) {
for (Map.Entry<String, Integer> entry : int_var_map.entrySet()) {
params = params.replaceAll(entry.getKey(), String.valueOf(entry.getValue()));
/*if(params.contains(Symbol.Type_plus.getSymbol())){
BigDecimal sum = BigDecimal.valueOf(0);
String[] every = params.split(Symbol.Type_plus.getSymbol());//根据加号拆分每项
for(String addend : every){
sum = sum.add(BigDecimal.valueOf(Integer.parseInt(addend)));
sum.setScale(2,BigDecimal.ROUND_HALF_UP);//按照四舍五入取两位小数处理
}
params = String.valueOf(sum);
}
if(params.contains(Symbol.Type_minus.getSymbol())){
BigDecimal sum = BigDecimal.valueOf(0);
String[] every = params.split(Symbol.Type_minus.getSymbol());//根据减号拆分每项
for(String minuend :every){
sum = sum.subtract(BigDecimal.valueOf(Integer.parseInt(minuend)));
sum.setScale(2,BigDecimal.ROUND_HALF_UP);//按照四舍五入取两位小数处理
}
params = String.valueOf(sum);
}
if(params.contains(Symbol.Type_multi.getSymbol())){
BigDecimal sum = BigDecimal.valueOf(1);
String[] every = params.split("\\*");//根据乘号拆分每项
for(String multiplicand :every){
sum = sum.multiply(BigDecimal.valueOf(Integer.parseInt(multiplicand)));
sum.setScale(2,BigDecimal.ROUND_HALF_UP);//按照四舍五入取两位小数处理
}
params = String.valueOf(sum);
}
if(params.contains(Symbol.Type_divide.getSymbol())){
String[] every = params.split(Symbol.Type_divide.getSymbol());//根据除号拆分每项
BigDecimal sum = BigDecimal.valueOf(Integer.parseInt(every[0]));
for(int i = 1 ; i< every.length; i ++){
sum = sum.divide(BigDecimal.valueOf(Integer.parseInt(every[i])));
sum.setScale(2,BigDecimal.ROUND_HALF_UP);
}
params = String.valueOf(sum);
}*/
}
}
if (string_var_map.size() != 0) {
......@@ -112,6 +145,7 @@ public class ParamsBuilt {
params = params.replaceAll(entry.getKey(), entry.getValue());
}
}
//这里分割可能会存在bug
if(res_map.size() != 0){
//get请求参数
if(params.contains("=")){
......@@ -145,11 +179,15 @@ public class ParamsBuilt {
}
}
}
//对于参数中的值包含运算符的,进行运算后再返回
return params;
}
public static String sql_replace(String sql, Map<String, Integer> int_var_map, Map<String, String> string_var_map ,Map<String,String> res_map ) {
if(sql != null){
if (int_var_map.size() != 0) {
......@@ -182,6 +220,8 @@ public class ParamsBuilt {
public static void main(String[] args) {
System.out.println(params_built());
String a = "\"goodsId\":varg_data_0_records_0_goodsId";
a = a.replaceAll("varg_data_0_records_0_goodsId","8964");
System.out.println(a);
}
}
package com.miya.manning.framework.util;
import java.util.ArrayList;
import java.util.List;
/**
* @ProjectName: MY_INTERFACE_TEST
* @Package: com.miya.interfacetest.framework.util
......@@ -21,5 +24,26 @@ public class StringUtil {
public static final String COUPON_PARAM_FILE_PATH="CommonParameters/CouponParameters.properties";
public static final String COUPON_PACKET_PARAM_FILE_PATH="CommonParameters/CouponPacketParameters.properties";
public static final String TEMP_PARAM_FILE_PATH="CommonParameters/TempParameters.properties";
public static List<Integer> getStrCunt(String mainStr, String subStr) {
// 声明一个要返回的变量
List<Integer> index_list = new ArrayList<>();
// 声明一个初始的下标,从初始位置开始查找
int index = 0;
// 获取主数据的长度
int mainStrLength = mainStr.length();
// 获取要查找的数据长度
int subStrLength = subStr.length();
// 如果要查找的数据长度大于主数据的长度则返回0
if (subStrLength > mainStrLength) return index_list;
// 循环使用indexOf查找出现的下标,如果出现一次则count++
while ((index = mainStr.indexOf(subStr, index)) != -1) {
index_list.add(index);
// 从找到的位置下标加上要查找的字符串长度,让指针往后移动继续查找
index += subStrLength;
}
return index_list;
}
}
......@@ -237,7 +237,7 @@ public class TestCaseUtil {
* @param res_map 应答结果变量集
* @return 返回比对结果 一致返回true 不一致返回false
*/
public static boolean do_check_sql(String check_sql , Map<String,String> string_var_map , Map<String, Integer> int_var_map, Map<String,String> res_map,String databasename){
public static boolean do_check_sql(String check_sql , Map<String,String> string_var_map , Map<String, Integer> int_var_map, Map<String,String> res_map,String databasename) throws Exception {
if(!"".equals(check_sql)){
String[] subs = check_sql.split(";");
for(String each: subs){
......@@ -248,13 +248,15 @@ public class TestCaseUtil {
String exec_sql = sub[1];
logger.info("替换前的sql语句为:" + exec_sql);
String new_exec_sql = ParamsBuilt.sql_replace(exec_sql, int_var_map, string_var_map, res_map);
logger.info("替换的sql语句为:" + new_exec_sql);
logger.info("替换的sql语句为:" + new_exec_sql);
List<Map<String,Object>> query_data = MysqlUtil.ExecSelectSQL(new_exec_sql,databasename);
if(query_data.isEmpty()){
logger.info("检查语句未查询到任何数据!请检查sql");
logger.error("检查语句未查询到任何数据!请检查sql");
throw new Exception("检查语句未查询到任何数据!请检查sql");
}
else if(query_data.size()>1){
logger.info("检查语句查到多条数据!请检查sql");
logger.error("检查语句查到多条数据!请检查sql");
throw new Exception("检查语句未查询到任何数据!请检查sql");
//此时不替换变量
}
else{
......
package com.miya.manning.test.flow.order;
import com.miya.manning.framework.util.*;
import com.miya.manning.vo.Script;
import com.miya.manning.vo.TestCase;
import org.apache.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.*;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/**
* @ProjectName: manning_test
* @Package: com.miya.manning.test.flow.order.Delivery
* @ClassName: Mainprocess
* @Description: 万宁物流模块测试
* @Author: 熊军奕
* @CreateDate: 2022/5/23 下午22:38
* @UpdateUser: 熊军奕
* @UpdateDate: 2022/5/23 下午22:38
*/
public class Express {
static Logger logger = Logger.getLogger(Express.class);
/*private String baseUrl = PropertiesHandle.readValue(StringUtil.brandurl);
private String apiprefixUrl = StringUtil.brand_apiprefix;*/
//private String testUrl = "web-front/coupon/get-page";
//private String url_start = baseUrl + apiprefixUrl ;
private String url_start = "https://cs2-uat.mannings.com.cn/";
private String script_path = System.getProperty("user.dir") + File.separator + "target" + File.separator + "classes"
+ File.separator + "testcase" + File.separator + "Scripts" + File.separator + "Script.xls";
private String path = System.getProperty("user.dir") + File.separator + "target" + File.separator + "classes" + File.separator + "testcase" + File.separator + "Delivery.xls";
//private String path = "D:\\autotest\\test_liucheng\\test_liucheng\\huihua_saas1.xls";
private Map<String,String> res_map = new TreeMap<>();
private static Map<String,Integer> int_var_map = new HashMap<>();
private static Map<String,String> string_var_map = new HashMap<>();
public static List<Script> Scripts = null;
@DataProvider(name = "ex")
public Object[][] Parameter() throws RuntimeException {
/*return new Object[][]{
{1,10, "200", "null", null},//查询券列表
{2,10, "200", "null", null},//查询券列表第二页
//{ "200", "null", null},//
};*/
try {
Scripts = TestCaseUtil.GetScripts(script_path);
TestCaseUtil.setLogger(logger);
} catch (RuntimeException e) {
logger.error(e.getMessage());
}
return TestCaseUtil.GetMain(path);
}
@BeforeClass
public void setUp() {
logger.info("分页查询券接口测试开始1!");
}
@AfterClass
public void tearDown() {
logger.info("分页查询券接口测试结束!");
}
@BeforeMethod
public void before(){
}
@Test(dataProvider = "ex")
public void Express( TestCase testCase) throws Exception {
String script_name = testCase.getScript_name();
if(!script_name.isEmpty()){
ScriptUtil.ExcuteScript(Scripts,testCase);
}
String pre_sql = testCase.getPre_sql();
String databasename = testCase.getDatabasename();
//1.处理前置语句,赋值给变量或者直接执行
TestCaseUtil.deal_pre_sql(pre_sql, string_var_map, int_var_map, res_map , databasename);
//用例执行部分
//2.设置请求头
Map<String, String> httpheadermap = new HashMap<>();
if("C".equals(testCase.getPlatform())){
httpheadermap = HttpHeaderBuilt.httpHeadBuiltManningsC(string_var_map,int_var_map);
}
if("B".equals(testCase.getPlatform())){
httpheadermap = HttpHeaderBuilt.httpHeadBuiltManningsB(res_map);
}
logger.info("以下是请求头信息:");
for(Map.Entry<String,String> entry: httpheadermap.entrySet()){
logger.info(entry.getKey() + ":" + entry.getValue());
}
//4.调用前替换params中可能存在的变量
String params = testCase.getParams();
logger.info("替换前的参数为:" + params);
String new_params = ParamsBuilt.params_replace(params, int_var_map, string_var_map ,res_map);
logger.info("替换后的参数为:" + new_params);
//5.拼接url,调用并获取接口返回
StringBuffer url = new StringBuffer(url_start);
StringBuilder builder = new StringBuilder();
url.append(testCase.getInterface_name());//先拼接一部分
String new_url = ParamsBuilt.params_replace(url.toString(), int_var_map, string_var_map, res_map);//替换url中可能存在的变量
StringBuffer new_url_bf = new StringBuffer(new_url);
RequestUtil.doRequest(testCase, new_params, new_url_bf, httpheadermap, logger, builder);
//6.收集响应信息,并按规则添加至map中
JsonTransfer.AnalysisJson(builder.toString(),res_map);
//7.执行检查语句,和期望值相同
String check_sql = testCase.getCheck_sql();
Assert.assertEquals(TestCaseUtil.do_check_sql(check_sql,string_var_map,int_var_map,res_map,databasename), true);
//8.校验期望值
String expect = testCase.getExpect();
Assert.assertEquals(TestCaseUtil.check(expect, int_var_map,string_var_map,res_map), true);
/*if (code == "200") {
Response response = new Response(final_res.getString("code"), final_res.getString("msg"), final_res.getJSONObject("data"));
JSONObject final_res_data = (JSONObject) response.getData();
Assert.assertEquals(response.getCode(), code);
Assert.assertEquals(response.getMsg(), msg);
String manufacturer_id =PropertiesHandle.readValue(StringUtil.httpHeader, "manufacturerId");
List<CouponConfigPO> couponGetPagelist = CouponSql.couponGetPage(manufacturer_id,pageNum,pageSize);
for (int i = 0; i< couponGetPagelist.size(); i++) {
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("manufacturerId"),couponGetPagelist.get(i).getManufacturerId());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("picUrl"),couponGetPagelist.get(i).getPicUrl());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponScene"),couponGetPagelist.get(i).getCouponScene());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponName"),couponGetPagelist.get(i).getCouponName());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponRights"),couponGetPagelist.get(i).getCouponRights());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponType"),couponGetPagelist.get(i).getCouponType());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("couponBatch"),couponGetPagelist.get(i).getCouponBatch());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("instructions"),couponGetPagelist.get(i).getInstructions());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getString("state"),couponGetPagelist.get(i).getState());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getInt("costScore"),couponGetPagelist.get(i).getCostScore());
Assert.assertEquals(final_res_data.getJSONArray("list").getJSONObject(i).getInt("userDailyGetLimit"),couponGetPagelist.get(i).getUserDailyGetLimit());
}
} else {
Response response = new Response(final_res.getString("code"), final_res.getString("msg"), final_res.getString("data"));
Assert.assertEquals(response.getCode(), code);
Assert.assertEquals(response.getMsg(), msg);
Assert.assertEquals(response.getData(), data);
}*/
}
}
......@@ -88,7 +88,7 @@ public class Mainprocess {
//2.设置请求头
Map<String, String> httpheadermap = new HashMap<>();
if("C".equals(testCase.getPlatform())){
httpheadermap = HttpHeaderBuilt.httpHeadBuiltManningsC(string_var_map);
httpheadermap = HttpHeaderBuilt.httpHeadBuiltManningsC(string_var_map,int_var_map);
}
if("B".equals(testCase.getPlatform())){
httpheadermap = HttpHeaderBuilt.httpHeadBuiltManningsB(res_map);
......@@ -96,7 +96,7 @@ public class Mainprocess {
logger.info("以下是请求头信息:");
for(Map.Entry<String,String> entry: httpheadermap.entrySet()){
logger.info(entry.getKey() + ";" + entry.getValue());
logger.info(entry.getKey() + ":" + entry.getValue());
}
//4.调用前替换params中可能存在的变量
String params = testCase.getParams();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment