421个文件已删除
35个文件已修改
16个文件已添加
| | |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>DayBuy</artifactId> |
| | | <groupId>com.ks</groupId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </parent> |
| | | <!--<parent>--> |
| | | <!--<artifactId>DayBuy</artifactId>--> |
| | | <!--<groupId>com.ks</groupId>--> |
| | | <!--<version>0.0.1-SNAPSHOT</version>--> |
| | | <!--</parent>--> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-goldcorn</artifactId> |
| | | |
| | | <packaging>jar</packaging> |
| | |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>lib-common</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | |
| | | <target>1.8</target> |
| | | </configuration> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-jar-plugin</artifactId> |
| | | <configuration> |
| | | <includes> |
| | | <include>com/ks/**</include> |
| | | <include>com/ks/lib/common/**</include> |
| | | </includes> |
| | | |
| | | </configuration> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>lib-common</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </plugin> |
| | | |
| | | <!--<plugin>--> |
| | | <!--<groupId>org.apache.maven.plugins</groupId>--> |
| | | <!--<artifactId>maven-install-plugin</artifactId>--> |
| | | <!--<version>2.5.2</version>--> |
| | | <!--<executions>--> |
| | | <!--<execution>--> |
| | | <!--<id>install-lib-common</id>--> |
| | | <!--<phase>clean</phase>--> |
| | | <!--<configuration>--> |
| | | <!--<repositoryLayout>default</repositoryLayout>--> |
| | | <!--<groupId>com.ks</groupId>--> |
| | | <!--<artifactId>lib-common</artifactId>--> |
| | | <!--<version>0.0.1-SNAPSHOT</version>--> |
| | | <!--<packaging>jar</packaging>--> |
| | | <!--<generatePom>true</generatePom>--> |
| | | <!--</configuration>--> |
| | | <!--<goals>--> |
| | | <!--<goal>install-file</goal>--> |
| | | <!--</goals>--> |
| | | <!--</execution>--> |
| | | |
| | | <!--</executions>--> |
| | | <!--</plugin>--> |
| | | |
| | | </plugins> |
| | | |
| | | </build> |
| | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class GoldTradeException extends BaseException { |
| | | public final static int CODE_ADD_RECORD_FAIL = 20001;//添加记录失败 |
| | | public final static int CODE_BALANCE_NOT_ENOUGH = 20002;//余额不足 |
| | | //次数超限 |
| | | public final static int CODE_COUNT_LIMIT = 10011; |
| | | //频率超限 |
| | | public final static int CODE_FREQUENCY_LIMIT = 10012; |
| | | //添加记录失败 |
| | | public final static int CODE_ADD_RECORD_FAIL = 20001; |
| | | //余额不足 |
| | | public final static int CODE_BALANCE_NOT_ENOUGH = 20002; |
| | | |
| | | public GoldTradeException(int code, String msg) { |
| | | super(code, msg); |
| | |
| | | package com.ks.goldcorn.pojo.DO; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | public class GoldCornAppInfo { |
| | | public class GoldCornAppInfo implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | private String appCode; |
| | |
| | | package com.ks.goldcorn.pojo.DO; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class GoldCornBalance { |
| | | public class GoldCornBalance implements Serializable { |
| | | private Long id; |
| | | |
| | | private Long appId; |
| | |
| | | import com.google.gson.Gson; |
| | | import org.springframework.data.annotation.Transient; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class GoldCornConsumeSource { |
| | | public class GoldCornConsumeSource implements Serializable { |
| | | private Long id; |
| | | |
| | | private Long appId; |
| | |
| | | private String sourceName; |
| | | |
| | | private String sourceCode; |
| | | |
| | | private String icon; |
| | | |
| | | private String sourceDesc; |
| | | |
| | |
| | | private GoldCornAppInfo app; |
| | | |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public GoldCornAppInfo getApp() { |
| | | return app; |
| | | } |
| | |
| | | package com.ks.goldcorn.pojo.DO; |
| | | |
| | | import com.google.gson.Gson; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class GoldCornGetSource { |
| | | public class GoldCornGetSource implements Serializable { |
| | | |
| | | //展示 |
| | | public final static int STATE_NORMAL = 1; |
| | | //不展示 |
| | | public final static int STATE_NOT_SHOW = 2; |
| | | //禁用 |
| | | public final static int STATE_FORBIDDEN = 3; |
| | | |
| | | |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "app_id") |
| | | private Long appId; |
| | | |
| | | @Column(name = "source_name") |
| | | private String sourceName; |
| | | |
| | | @Column(name = "source_code") |
| | | private String sourceCode; |
| | | |
| | | private String icon; |
| | | |
| | | @Column(name = "source_desc") |
| | | private String sourceDesc; |
| | | |
| | | @Column(name = "gold_corn") |
| | | private Integer goldCorn; |
| | | |
| | | /** |
| | | * 每日最大次数 |
| | | */ |
| | | @Column(name = "max_day_count") |
| | | private Integer maxDayCount; |
| | | |
| | | /** |
| | | * 最小间隔时间(单位:秒) |
| | | */ |
| | | @Column(name = "min_time_span") |
| | | private Integer minTimeSpan; |
| | | |
| | | /** |
| | | * 权重 |
| | | */ |
| | | private Integer weight; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | private String remarks; |
| | | |
| | | @Column(name = "create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "update_time") |
| | | private Date updateTime; |
| | | |
| | | @Transient |
| | | private GoldCornAppInfo app; |
| | | |
| | | |
| | | public Integer getMaxDayCount() { |
| | | return maxDayCount; |
| | | } |
| | | |
| | | public void setMaxDayCount(Integer maxDayCount) { |
| | | this.maxDayCount = maxDayCount; |
| | | } |
| | | |
| | | |
| | | public Integer getMinTimeSpan() { |
| | | return minTimeSpan; |
| | | } |
| | | |
| | | public void setMinTimeSpan(Integer minTimeSpan) { |
| | | this.minTimeSpan = minTimeSpan; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public GoldCornAppInfo getApp() { |
| | | return app; |
| | |
| | | public String toString() { |
| | | return new Gson().toJson(this); |
| | | } |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | } |
| | |
| | | package com.ks.goldcorn.pojo.DO; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class GoldCornRecord { |
| | | public class GoldCornRecord implements Serializable { |
| | | |
| | | public final static int TYPE_GET = 1; |
| | | public final static int TYPE_CONSUME = 2; |
| | |
| | | private Long appId; |
| | | private String uid; |
| | | private Integer type; |
| | | private Long sourceId; |
| | | private String sourceCode; |
| | | private Integer goldCorn; |
| | | private String remarks; |
| | | private Date createTime; |
| | |
| | | this.type = type; |
| | | } |
| | | |
| | | public Long getSourceId() { |
| | | return sourceId; |
| | | public String getSourceCode() { |
| | | return sourceCode; |
| | | } |
| | | |
| | | public void setSourceId(Long sourceId) { |
| | | this.sourceId = sourceId; |
| | | public void setSourceCode(String sourceCode) { |
| | | this.sourceCode = sourceCode; |
| | | } |
| | | |
| | | public Integer getGoldCorn() { |
New file |
| | |
| | | package com.ks.goldcorn.pojo.DO; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class GoldCornRecordCountMap implements Serializable { |
| | | |
| | | private String sourceCode; |
| | | private int count; |
| | | |
| | | public String getSourceCode() { |
| | | return sourceCode; |
| | | } |
| | | |
| | | public void setSourceCode(String sourceCode) { |
| | | this.sourceCode = sourceCode; |
| | | } |
| | | |
| | | public int getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(int count) { |
| | | this.count = count; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.goldcorn.pojo.Query; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class GoldCornRecordQuery implements Serializable { |
| | | |
| | | private String appCode; |
| | | private String uid; |
| | | private Integer type; |
| | | private List<String> sourceCodes; |
| | | private int page; |
| | | private int pageSize; |
| | | |
| | | private Date minCreateTime; |
| | | private Date maxCreateTime; |
| | | |
| | | public Date getMinCreateTime() { |
| | | return minCreateTime; |
| | | } |
| | | |
| | | public void setMinCreateTime(Date minCreateTime) { |
| | | this.minCreateTime = minCreateTime; |
| | | } |
| | | |
| | | public Date getMaxCreateTime() { |
| | | return maxCreateTime; |
| | | } |
| | | |
| | | public void setMaxCreateTime(Date maxCreateTime) { |
| | | this.maxCreateTime = maxCreateTime; |
| | | } |
| | | |
| | | public String getAppCode() { |
| | | return appCode; |
| | | } |
| | | |
| | | public void setAppCode(String appCode) { |
| | | this.appCode = appCode; |
| | | } |
| | | |
| | | public String getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(String uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public List<String> getSourceCodes() { |
| | | return sourceCodes; |
| | | } |
| | | |
| | | public void setSourceCodes(List<String> sourceCodes) { |
| | | this.sourceCodes = sourceCodes; |
| | | } |
| | | |
| | | public int getPage() { |
| | | return page; |
| | | } |
| | | |
| | | public void setPage(int page) { |
| | | this.page = page; |
| | | } |
| | | |
| | | public int getPageSize() { |
| | | return pageSize; |
| | | } |
| | | |
| | | public void setPageSize(int pageSize) { |
| | | this.pageSize = pageSize; |
| | | } |
| | | } |
| | |
| | | package com.ks.goldcorn.service.remote; |
| | | |
| | | import com.ks.goldcorn.exception.GoldAppException; |
| | | import com.ks.goldcorn.exception.GoldSourceException; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornGetSource; |
| | | |
| | |
| | | public void updateSource(GoldCornGetSource source) throws GoldSourceException; |
| | | |
| | | |
| | | /** |
| | | * 获取能够显示的列表 |
| | | * |
| | | * @param appCode |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<GoldCornGetSource> listShow(String appCode, int page, int pageSize) throws GoldAppException; |
| | | |
| | | |
| | | /** |
| | | * 获取能够显示的数量 |
| | | * |
| | | * @param appCode |
| | | * @return |
| | | * @throws GoldAppException |
| | | */ |
| | | public long countShow(String appCode) throws GoldAppException; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ks.goldcorn.service.remote; |
| | | |
| | | import com.ks.goldcorn.pojo.DO.GoldCornRecord; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornRecordCountMap; |
| | | import com.ks.goldcorn.pojo.Query.GoldCornRecordQuery; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | /** |
| | | * 用户记录列表 |
| | | * |
| | | * @param appCode |
| | | * @param uid |
| | | * @param type 1-获得 2-消耗 |
| | | * @param page |
| | | * @param pageSize |
| | | * @param query |
| | | * @return |
| | | */ |
| | | public List<GoldCornRecord> listUserRecord(String appCode, String uid, Integer type, int page, int pageSize); |
| | | public List<GoldCornRecord> listUserRecord(GoldCornRecordQuery query); |
| | | |
| | | |
| | | /** |
| | | * 用户记录数量 |
| | | * |
| | | * @param appCode |
| | | * @param uid |
| | | * @param type 1-获得 2-消耗 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | public long countUserRecord(String appCode, String uid, Integer type); |
| | | public long countUserRecord(GoldCornRecordQuery query); |
| | | |
| | | |
| | | /** |
| | | * 用户记录数量(source分组) |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | public List<GoldCornRecordCountMap> countUserRecordBySource(GoldCornRecordQuery query); |
| | | |
| | | } |
| | |
| | | public interface GoldCornTradeService { |
| | | |
| | | |
| | | /** |
| | | * 获取下次可以做任务的时间(返回时间戳) |
| | | * @param appCode |
| | | * @param uid |
| | | * @param sourceCode |
| | | * @return |
| | | */ |
| | | public long getNextDoTaskTime(String appCode, String uid, String sourceCode); |
| | | |
| | | |
| | | /** |
| | | * 添加金币 |
| | | * |
| | | * @param appCode |
| | | * @param uid |
| | | * @param sourceCode id不能为空 |
| | | * @param title 如果为null则填充source里面的title |
| | | * @param desc 如果为null则填充source里面的desc |
| | | * @param goldCornCount 金币数量 |
| | | * @param title 如果为null则填充source里面的title |
| | | * @param desc 如果为null则填充source里面的desc |
| | | * @throws GoldAppException |
| | | * @throws GoldUserException |
| | | * @throws GoldTradeException |
| | | */ |
| | | public void addGoldCorn(String appCode, String uid, String sourceCode,String title,String desc) throws GoldAppException, GoldUserException,GoldTradeException; |
| | | public void addGoldCorn(String appCode, String uid, String sourceCode, Integer goldCornCount, String title, String desc) throws GoldAppException, GoldUserException, GoldTradeException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 消耗金币 |
| | | * |
| | | * @param appCode |
| | | * @param uid |
| | | * @param source |
| | | * @throws GoldTradeException |
| | | */ |
| | | /** |
| | | * |
| | | * @param appCode |
| | | * @param uid |
| | | * @param sourceCode |
| | | * @param title 如果为null则填充source里面的title |
| | | * @param desc 如果为null则填充source里面的desc |
| | | * @param goldCornCount 金币数量 |
| | | * @param title 如果为null则填充source里面的title |
| | | * @param desc 如果为null则填充source里面的desc |
| | | * @throws GoldAppException |
| | | * @throws GoldUserException |
| | | * @throws GoldTradeException |
| | | */ |
| | | public void consumeGoldCorn(String appCode, String uid,String sourceCode,String title,String desc) throws GoldAppException,GoldUserException,GoldTradeException; |
| | | public void consumeGoldCorn(String appCode, String uid, String sourceCode, Integer goldCornCount, String title, String desc) throws GoldAppException, GoldUserException, GoldTradeException; |
| | | } |
New file |
| | |
| | | package com.ks.lib.common.util; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class MongoDBQueryUtil { |
| | | |
| | | |
| | | /** |
| | | * 转换sql语句的排序 |
| | | * |
| | | * @param sortList |
| | | * @return |
| | | */ |
| | | public static Sort.Order[] convertSQLSort(List<String> sortList) { |
| | | List<Sort.Order> sList = new ArrayList<>(); |
| | | |
| | | for (String sort : sortList) { |
| | | String key = ""; |
| | | if (sort.trim().contains(" ")) { |
| | | key = sort.trim().split(" ")[0]; |
| | | } else { |
| | | key = sort.trim(); |
| | | } |
| | | |
| | | if (sort.toLowerCase().endsWith(" desc")) { |
| | | sList.add(Sort.Order.desc(key)); |
| | | } else { |
| | | sList.add(Sort.Order.asc(key)); |
| | | } |
| | | } |
| | | |
| | | Sort.Order[] sorts = new Sort.Order[sortList.size()]; |
| | | sList.toArray(sorts); |
| | | return sorts; |
| | | } |
| | | |
| | | } |
| | |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <modules> |
| | | <module>facade-app</module> |
| | | <module>lib-common</module> |
| | | |
| | | <module>facade-goldcorn</module> |
| | | <module>facade-jd-goods-order</module> |
| | | <module>facade-jd-giftcoupon</module> |
| | | <module>facade-daybuy</module> |
| | | <module>facade-lucky</module> |
| | | |
| | | |
| | | <module>service-goldcorn</module> |
| | | <module>service-jd-goods-order</module> |
| | | <module>service-jd-giftcoupon</module> |
| | | <module>service-daybuy</module> |
| | | <module>service-lucky</module> |
| | | <module>service-app</module> |
| | | |
| | | |
| | | |
| | | <module>consumer-daybuy</module> |
| | | |
| | | <module>lib-common</module> |
| | | |
| | | </modules> |
| | | <parent> |
| | | <groupId>org.springframework.boot</groupId> |
| | |
| | | <properties> |
| | | <java.version>1.8</java.version> |
| | | <dubbo.version>2.7.5</dubbo.version> |
| | | <curator.version>2.8.0</curator.version> |
| | | <curator.version>4.0.1</curator.version> |
| | | <zookeeper.version>3.4.6</zookeeper.version> |
| | | <mongo.driver.version>3.12.0</mongo.driver.version> |
| | | </properties> |
| | |
| | | mongodb: |
| | | username: yeshi |
| | | password: 'Yeshi2016@' |
| | | host: 193.112.35.168 |
| | | port: 27016 |
| | | database: flq |
| | | #193.112.35.168 |
| | | host: 172.16.16.44 |
| | | port: 27017 |
| | | database: goldcorn |
| | | authentication-database: admin |
| | | redis: |
| | | host: 192.168.3.253 |
| | |
| | | database: 3 |
| | | |
| | | datasource: |
| | | url: jdbc:mysql://192.168.3.253:3306/test?serverTimezone=UTC |
| | | url: jdbc:mysql://192.168.3.253:3306/test?serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | |
| | | <java.version>1.8</java.version> |
| | | <druid.version>1.1.10</druid.version> |
| | | <mybatis.version>2.0.1</mybatis.version> |
| | | <seata.version>1.4.1</seata.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.seata</groupId> |
| | | <artifactId>seata-spring-boot-starter</artifactId> |
| | | <version>${seata.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | |
| | | |
| | | |
| | | <!--全局排除log4j --> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>*</groupId> |
| | | <artifactId>*</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!--devtools热部署--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | |
| | | <optional>true</optional> |
| | | <scope>true</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>net.sf.json-lib</groupId> |
| | | <artifactId>json-lib</artifactId> |
| | | <version>2.4</version> |
| | | <classifier>jdk15</classifier> |
| | | </dependency> |
| | | |
| | | <!--<dependency>--> |
| | | <!--<groupId>io.seata</groupId>--> |
| | | <!--<artifactId>seata-all</artifactId>--> |
| | | <!--<version>${seata.version}</version>--> |
| | | <!--</dependency>--> |
| | | |
| | | <!--<dependency>--> |
| | | <!--<groupId>log4j</groupId>--> |
| | |
| | | <!--</exclusion>--> |
| | | <!--</exclusions>--> |
| | | <!--</dependency>--> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/org.dom4j/dom4j --> |
| | | <dependency> |
| | | <groupId>org.dom4j</groupId> |
| | | <artifactId>dom4j</artifactId> |
| | | <version>2.1.1</version> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | |
| | | </plugin> |
| | | <!-- MyBatis插件 --> |
| | | <!--<plugin>--> |
| | | <!--<groupId>org.mybatis.generator</groupId>--> |
| | | <!--<artifactId>mybatis-generator-maven-plugin</artifactId>--> |
| | | <!--<version>1.3.2</version>--> |
| | | <!--<configuration>--> |
| | | <!--<!–配置文件的位置–>--> |
| | | <!--<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>--> |
| | | <!--<verbose>true</verbose>--> |
| | | <!--<overwrite>true</overwrite>--> |
| | | <!--</configuration>--> |
| | | <!--<executions>--> |
| | | <!--<execution>--> |
| | | <!--<id>Generate MyBatis Artifacts</id>--> |
| | | <!--<goals>--> |
| | | <!--<goal>generate</goal>--> |
| | | <!--</goals>--> |
| | | <!--</execution>--> |
| | | <!--</executions>--> |
| | | <!--<dependencies>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.mybatis.generator</groupId>--> |
| | | <!--<artifactId>mybatis-generator-core</artifactId>--> |
| | | <!--<version>1.3.2</version>--> |
| | | <!--</dependency>--> |
| | | <!--</dependencies>--> |
| | | <!--<groupId>org.mybatis.generator</groupId>--> |
| | | <!--<artifactId>mybatis-generator-maven-plugin</artifactId>--> |
| | | <!--<version>1.3.2</version>--> |
| | | <!--<configuration>--> |
| | | <!--<!–配置文件的位置–>--> |
| | | <!--<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>--> |
| | | <!--<verbose>true</verbose>--> |
| | | <!--<overwrite>true</overwrite>--> |
| | | <!--</configuration>--> |
| | | <!--<executions>--> |
| | | <!--<execution>--> |
| | | <!--<id>Generate MyBatis Artifacts</id>--> |
| | | <!--<goals>--> |
| | | <!--<goal>generate</goal>--> |
| | | <!--</goals>--> |
| | | <!--</execution>--> |
| | | <!--</executions>--> |
| | | <!--<dependencies>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.mybatis.generator</groupId>--> |
| | | <!--<artifactId>mybatis-generator-core</artifactId>--> |
| | | <!--<version>1.3.2</version>--> |
| | | <!--</dependency>--> |
| | | <!--</dependencies>--> |
| | | <!--</plugin>--> |
| | | </plugins> |
| | | </build> |
| | |
| | | @EnableDubbo(scanBasePackages = "com.ks.goldcorn.service.remote") |
| | | public class GoldCornApplication extends SpringBootServletInitializer { |
| | | private final static Logger logger = LoggerFactory.getLogger(GoldCornApplication.class); |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(GoldCornApplication.class, args); |
| | | logger.info("应用启动成功"); |
| | |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | return builder.sources(GoldCornApplication.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.goldcorn.config; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.PropertyAccessor; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.cache.annotation.CachingConfigurerSupport; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | | |
| | | @Configuration |
| | | public class RedisConfig extends CachingConfigurerSupport { |
| | | |
| | | @Bean |
| | | public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { |
| | | RedisTemplate<String, Object> template = new RedisTemplate<>(); |
| | | template.setConnectionFactory(factory); |
| | | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); |
| | | ObjectMapper om = new ObjectMapper(); |
| | | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
| | | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); |
| | | jackson2JsonRedisSerializer.setObjectMapper(om); |
| | | StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); |
| | | // key采用String的序列化方式 |
| | | template.setKeySerializer(stringRedisSerializer); |
| | | // hash的key也采用String的序列化方式 |
| | | template.setHashKeySerializer(stringRedisSerializer); |
| | | // value序列化方式采用jackson |
| | | template.setValueSerializer(jackson2JsonRedisSerializer); |
| | | // hash的value序列化方式采用jackson |
| | | template.setHashValueSerializer(jackson2JsonRedisSerializer); |
| | | template.afterPropertiesSet(); |
| | | return template; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ks.goldcorn.config; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import io.seata.rm.datasource.DataSourceProxy; |
| | | import io.seata.spring.annotation.GlobalTransactionScanner; |
| | | import org.apache.ibatis.session.SqlSessionFactory; |
| | | import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; |
| | | import org.mybatis.spring.SqlSessionFactoryBean; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
| | | |
| | | /** |
| | | * @Author: heshouyou |
| | | * @Description seata global configuration |
| | | * @Date Created in 2019/1/24 10:28 |
| | | */ |
| | | @Configuration |
| | | public class SeataAutoConfig { |
| | | |
| | | /** |
| | | * autowired datasource config |
| | | */ |
| | | @Autowired |
| | | private DataSourceProperties dataSourceProperties; |
| | | |
| | | /** |
| | | * init durid datasource |
| | | * |
| | | * @Return: druidDataSource datasource instance |
| | | */ |
| | | @Bean |
| | | @Primary |
| | | public DruidDataSource druidDataSource() { |
| | | DruidDataSource druidDataSource = new DruidDataSource(); |
| | | druidDataSource.setUrl(dataSourceProperties.getUrl()); |
| | | druidDataSource.setUsername(dataSourceProperties.getUsername()); |
| | | druidDataSource.setPassword(dataSourceProperties.getPassword()); |
| | | druidDataSource.setDriverClassName(dataSourceProperties.getDriverClassName()); |
| | | druidDataSource.setInitialSize(0); |
| | | druidDataSource.setMaxActive(180); |
| | | druidDataSource.setMaxWait(60000); |
| | | druidDataSource.setMinIdle(0); |
| | | druidDataSource.setValidationQuery("Select 1 from DUAL"); |
| | | druidDataSource.setTestOnBorrow(false); |
| | | druidDataSource.setTestOnReturn(false); |
| | | druidDataSource.setTestWhileIdle(true); |
| | | druidDataSource.setTimeBetweenEvictionRunsMillis(60000); |
| | | druidDataSource.setMinEvictableIdleTimeMillis(25200000); |
| | | druidDataSource.setRemoveAbandoned(true); |
| | | druidDataSource.setRemoveAbandonedTimeout(1800); |
| | | druidDataSource.setLogAbandoned(true); |
| | | return druidDataSource; |
| | | } |
| | | |
| | | /** |
| | | * init datasource proxy |
| | | * |
| | | * @Param: druidDataSource datasource bean instance |
| | | * @Return: DataSourceProxy datasource proxy |
| | | */ |
| | | @Bean |
| | | public DataSourceProxy dataSourceProxy(DruidDataSource druidDataSource) { |
| | | return new DataSourceProxy(druidDataSource); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * init global transaction scanner |
| | | * |
| | | * @Return: GlobalTransactionScanner |
| | | */ |
| | | @Bean |
| | | public GlobalTransactionScanner globalTransactionScanner() { |
| | | return new GlobalTransactionScanner("goldcorn", "goldcorn-seata-service-group"); |
| | | } |
| | | } |
| | |
| | | import com.google.code.kaptcha.util.Config; |
| | | import com.ks.goldcorn.entity.AdminUser; |
| | | import com.ks.goldcorn.service.AdminUserManager; |
| | | import io.seata.rm.datasource.DataSourceProxy; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.authentication.dao.DaoAuthenticationProvider; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.sql.DataSource; |
| | | import java.io.IOException; |
| | | import java.util.Properties; |
| | | |
| | | @EnableWebSecurity |
| | | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| | | |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); |
| | | |
| | | @Resource |
| | | private AdminUserManager adminUserManager; |
| | | |
| | | private final String LOGIN_PROCESSING_URL="/admin/api/login"; |
| | | private final String LOGIN_PROCESSING_URL = "/admin/api/login"; |
| | | |
| | | //图形验证码配置 |
| | | @Bean |
| | |
| | | http.headers().frameOptions().disable(); |
| | | http.authorizeRequests() |
| | | .antMatchers("/admin/api/captcha.jpg*").permitAll() |
| | | .antMatchers("/admin/api/**","/index.html").authenticated() |
| | | .antMatchers("/admin/api/**", "/index.html").authenticated() |
| | | .and() |
| | | .formLogin() |
| | | //自定义登录界面 |
New file |
| | |
| | | package com.ks.goldcorn.controller.admin; |
| | | |
| | | import com.google.code.kaptcha.Producer; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api") |
| | | public class AdminController { |
| | | Logger logger = LoggerFactory.getLogger(AdminController.class); |
| | | |
| | | @Resource |
| | | private Producer captchaProducer; |
| | | |
| | | @GetMapping("captcha.jpg") |
| | | public void getCaptcha(HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | response.setContentType("image/jpeg"); |
| | | String capText = captchaProducer.createText(); |
| | | request.getSession().setAttribute("captcha", capText); |
| | | BufferedImage bi = captchaProducer.createImage(capText); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | ImageIO.write(bi, "jpg", out); |
| | | try { |
| | | out.flush(); |
| | | } finally { |
| | | out.close(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.goldcorn.controller.admin; |
| | | |
| | | import com.google.gson.*; |
| | | import com.ks.goldcorn.exception.GoldAppException; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornAppInfo; |
| | | import com.ks.goldcorn.service.GoldCornAppManager; |
| | | import com.ks.goldcorn.vo.CommonSearchQuery; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.Type; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/app") |
| | | public class AppController { |
| | | Logger logger = LoggerFactory.getLogger(AppController.class); |
| | | |
| | | @Resource |
| | | private GoldCornAppManager goldCornAppManager; |
| | | |
| | | @RequestMapping("list") |
| | | @ResponseBody |
| | | public String list(CommonSearchQuery query, HttpServletResponse response) { |
| | | response.setContentType("application/json;charset=UTF-8"); |
| | | List<GoldCornAppInfo> list = goldCornAppManager.searchByName(query.getKey(), query.getPage(), query.getLimit()); |
| | | long total = goldCornAppManager.countSearchByName(query.getKey()); |
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | @Override |
| | | public JsonElement serialize(Date arg0, Type arg1, JsonSerializationContext arg2) { |
| | | if (arg0 != null) { |
| | | return new JsonPrimitive(TimeUtil.getGernalTime(arg0.getTime(), "yyyy-MM-dd HH:mm")); |
| | | } else { |
| | | return new JsonPrimitive(""); |
| | | } |
| | | } |
| | | } |
| | | |
| | | ).create(); |
| | | |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", total); |
| | | data.put("data", gson.toJson(list)); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | @RequestMapping("update") |
| | | @ResponseBody |
| | | public String update(GoldCornAppInfo app) { |
| | | if (app == null || app.getId() == null) { |
| | | return JsonUtil.loadFalseResult("id不能为空"); |
| | | } |
| | | goldCornAppManager.updateApp(app); |
| | | return JsonUtil.loadTrueResult("更新成功"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("add") |
| | | @ResponseBody |
| | | public String add(GoldCornAppInfo app) { |
| | | if (app == null) { |
| | | return JsonUtil.loadTrueResult("数据不能为空"); |
| | | } |
| | | try { |
| | | goldCornAppManager.addApp(app); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (GoldAppException e) { |
| | | return JsonUtil.loadFalseResult(e.getCode(), e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping("delete") |
| | | @ResponseBody |
| | | public String delete(String ids) { |
| | | JSONArray array = null; |
| | | try { |
| | | array = JSONArray.fromObject(ids); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | |
| | | if (array == null || array.size() == 0) { |
| | | return JsonUtil.loadFalseResult("id为空"); |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < array.size(); i++) { |
| | | try { |
| | | goldCornAppManager.deleteApp(array.optLong(i)); |
| | | } catch (GoldAppException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.goldcorn.controller.admin; |
| | | |
| | | import com.google.gson.*; |
| | | import com.ks.goldcorn.exception.GoldSourceException; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornAppInfo; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornConsumeSource; |
| | | import com.ks.goldcorn.service.GoldCornAppManager; |
| | | import com.ks.goldcorn.service.remote.GoldCornConsumeSourceService; |
| | | import com.ks.goldcorn.vo.CommonSearchQuery; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Type; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/source/consume") |
| | | public class ConsumeSourceController { |
| | | Logger logger = LoggerFactory.getLogger(ConsumeSourceController.class); |
| | | |
| | | @Resource |
| | | private GoldCornConsumeSourceService goldCornConsumeSourceService; |
| | | |
| | | @Resource |
| | | private GoldCornAppManager goldCornAppManager; |
| | | |
| | | /** |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @RequestMapping("list") |
| | | @ResponseBody |
| | | public String list(CommonSearchQuery query, String appCode) { |
| | | JSONObject data = new JSONObject(); |
| | | GoldCornAppInfo app = goldCornAppManager.selectByAppCode(appCode); |
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | @Override |
| | | public JsonElement serialize(Date arg0, Type arg1, JsonSerializationContext arg2) { |
| | | if (arg0 != null) { |
| | | return new JsonPrimitive(TimeUtil.getGernalTime(arg0.getTime(), "yyyy-MM-dd HH:mm")); |
| | | } else { |
| | | return new JsonPrimitive(""); |
| | | } |
| | | } |
| | | } |
| | | ).create(); |
| | | |
| | | List<GoldCornConsumeSource> list = goldCornConsumeSourceService.searchByName(appCode, query.getKey(), query.getPage(), query.getLimit()); |
| | | if (list != null) { |
| | | for (GoldCornConsumeSource source : list) { |
| | | source.setApp(app); |
| | | } |
| | | } |
| | | long count = goldCornConsumeSourceService.countByName(appCode, query.getKey()); |
| | | data.put("count", count); |
| | | data.put("data", gson.toJson(list)); |
| | | |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | @RequestMapping("update") |
| | | @ResponseBody |
| | | public String update(GoldCornConsumeSource source) { |
| | | if (source == null || source.getId() == null) { |
| | | return JsonUtil.loadFalseResult("id不能为空"); |
| | | } |
| | | |
| | | try { |
| | | goldCornConsumeSourceService.updateSource(source); |
| | | } catch (GoldSourceException e) { |
| | | return JsonUtil.loadFalseResult(e.getCode(), e.getMessage()); |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult("更新成功"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("add") |
| | | @ResponseBody |
| | | public String add(GoldCornConsumeSource source, String appCode) { |
| | | if (source == null) { |
| | | return JsonUtil.loadTrueResult("数据不能为空"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(appCode)) { |
| | | return JsonUtil.loadTrueResult("请选择应用"); |
| | | } |
| | | |
| | | GoldCornAppInfo app = goldCornAppManager.selectByAppCode(appCode); |
| | | if (app == null) { |
| | | return JsonUtil.loadTrueResult("应用不存在"); |
| | | } |
| | | source.setAppId(app.getId()); |
| | | |
| | | try { |
| | | goldCornConsumeSourceService.addSource(source); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (GoldSourceException e) { |
| | | return JsonUtil.loadFalseResult(e.getCode(), e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping("delete") |
| | | @ResponseBody |
| | | public String delete(String ids) { |
| | | JSONArray array = null; |
| | | try { |
| | | array = JSONArray.fromObject(ids); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | if (array == null || array.size() == 0) { |
| | | return JsonUtil.loadFalseResult("id为空"); |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < array.size(); i++) { |
| | | goldCornConsumeSourceService.deleteSource(array.optLong(i)); |
| | | } |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ks.goldcorn.controller.admin; |
| | | |
| | | import com.google.gson.*; |
| | | import com.ks.goldcorn.exception.GoldSourceException; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornAppInfo; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornGetSource; |
| | | import com.ks.goldcorn.service.GoldCornAppManager; |
| | | import com.ks.goldcorn.service.remote.GoldCornGetSourceService; |
| | | import com.ks.goldcorn.vo.CommonSearchQuery; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Type; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/source/get") |
| | | public class GetSourceController { |
| | | Logger logger = LoggerFactory.getLogger(GetSourceController.class); |
| | | |
| | | @Resource |
| | | private GoldCornGetSourceService goldCornGetSourceService; |
| | | |
| | | @Resource |
| | | private GoldCornAppManager goldCornAppManager; |
| | | |
| | | /** |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @RequestMapping("list") |
| | | @ResponseBody |
| | | public String list(CommonSearchQuery query, String appCode) { |
| | | JSONObject data = new JSONObject(); |
| | | |
| | | GoldCornAppInfo app = goldCornAppManager.selectByAppCode(appCode); |
| | | |
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | @Override |
| | | public JsonElement serialize(Date arg0, Type arg1, JsonSerializationContext arg2) { |
| | | if (arg0 != null) { |
| | | return new JsonPrimitive(TimeUtil.getGernalTime(arg0.getTime(), "yyyy-MM-dd HH:mm")); |
| | | } else { |
| | | return new JsonPrimitive(""); |
| | | } |
| | | } |
| | | } |
| | | ).create(); |
| | | |
| | | List<GoldCornGetSource> list = goldCornGetSourceService.searchByName(appCode, query.getKey(), query.getPage(), query.getLimit()); |
| | | if (list != null) { |
| | | for (GoldCornGetSource source : list) { |
| | | source.setApp(app); |
| | | } |
| | | } |
| | | |
| | | long count = goldCornGetSourceService.countByName(appCode, query.getKey()); |
| | | data.put("count", count); |
| | | data.put("data", gson.toJson(list)); |
| | | |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | @RequestMapping("update") |
| | | @ResponseBody |
| | | public String update(GoldCornGetSource source) { |
| | | if (source == null || source.getId() == null) { |
| | | return JsonUtil.loadFalseResult("id不能为空"); |
| | | } |
| | | |
| | | try { |
| | | goldCornGetSourceService.updateSource(source); |
| | | } catch (GoldSourceException e) { |
| | | return JsonUtil.loadFalseResult(e.getCode(), e.getMessage()); |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult("更新成功"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("add") |
| | | @ResponseBody |
| | | public String add(GoldCornGetSource source, String appCode) { |
| | | if (source == null) { |
| | | return JsonUtil.loadTrueResult("数据不能为空"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(appCode)) { |
| | | return JsonUtil.loadTrueResult("请选择应用"); |
| | | } |
| | | |
| | | GoldCornAppInfo app = goldCornAppManager.selectByAppCode(appCode); |
| | | if (app == null) { |
| | | return JsonUtil.loadTrueResult("应用不存在"); |
| | | } |
| | | source.setAppId(app.getId()); |
| | | try { |
| | | goldCornGetSourceService.addSource(source); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (GoldSourceException e) { |
| | | return JsonUtil.loadFalseResult(e.getCode(), e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping("delete") |
| | | @ResponseBody |
| | | public String delete(String ids) { |
| | | JSONArray array = null; |
| | | try { |
| | | array = JSONArray.fromObject(ids); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | if (array == null || array.size() == 0) { |
| | | return JsonUtil.loadFalseResult("id为空"); |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < array.size(); i++) { |
| | | goldCornGetSourceService.deleteSource(array.optLong(i)); |
| | | } |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.ks.lib.common.util.RedisUtil; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Component |
| | | public class RedisManager { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public void get() { |
| | | redisUtil.get(""); |
| | | private String getGetGoldCornCountKey(String appCode, String uid, String sourceCode) { |
| | | String key = String.format("getcorncount-%s-%s-%s", appCode, uid, sourceCode); |
| | | return key; |
| | | } |
| | | |
| | | private String getGetGoldCornTimeKey(String appCode, String uid, String sourceCode) { |
| | | String key = String.format("getcorntime-%s-%s-%s", appCode, uid, sourceCode); |
| | | return key; |
| | | } |
| | | |
| | | /** |
| | | * 获取金币增加的次数 |
| | | * |
| | | * @param appCode |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public int getGoldCornAddRecordCount(String appCode, String uid, String sourceCode) { |
| | | String key = getGetGoldCornCountKey(appCode, uid, sourceCode); |
| | | Object value = redisTemplate.opsForValue().get(key); |
| | | if (value == null) { |
| | | return 0; |
| | | } |
| | | return Integer.parseInt(value + ""); |
| | | } |
| | | |
| | | |
| | | public void addCornSuccess(String appCode, String uid, String sourceCode, int nextTimeSpan) { |
| | | long now = System.currentTimeMillis(); |
| | | Date expireTime = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd")); |
| | | String countKey = getGetGoldCornCountKey(appCode, uid, sourceCode); |
| | | increCount(countKey, expireTime); |
| | | String timeKey = getGetGoldCornTimeKey(appCode, uid, sourceCode); |
| | | redisTemplate.opsForValue().set(timeKey, 1, nextTimeSpan == 0 ? 1 : nextTimeSpan, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | public boolean canAddCornWithTime(String appCode, String uid, String sourceCode) { |
| | | String timeKey = getGetGoldCornTimeKey(appCode, uid, sourceCode); |
| | | return !redisTemplate.hasKey(timeKey); |
| | | } |
| | | |
| | | public long getCanAddCornExpireTime(String appCode, String uid, String sourceCode) { |
| | | String timeKey = getGetGoldCornTimeKey(appCode, uid, sourceCode); |
| | | return redisTemplate.getExpire(timeKey); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 增加次数 |
| | | * |
| | | * @param key |
| | | * @param expireTime |
| | | */ |
| | | private void increCount(String key, Date expireTime) { |
| | | redisTemplate.opsForValue().increment(key, 1); |
| | | redisTemplate.expireAt(key, expireTime); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ks.goldcorn.mapper; |
| | | |
| | | import com.ks.goldcorn.pojo.DO.GoldCornRecord; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornRecordCountMap; |
| | | import com.ks.goldcorn.query.RecordQuery; |
| | | import com.ks.lib.common.dao.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | |
| | | public long count(@Param("query") RecordQuery query); |
| | | |
| | | public List<GoldCornRecordCountMap> countList(@Param("query") RecordQuery query); |
| | | |
| | | |
| | | } |
| | |
| | | private String uid; |
| | | private Long appId; |
| | | private Integer type; |
| | | private List<String> sourceCodes; |
| | | private Date minCreateTime; |
| | | private Date maxCreateTime; |
| | | private List<String> sortList; |
| | | private long start; |
| | | private int count; |
| | | |
| | | |
| | | public List<String> getSourceCodes() { |
| | | return sourceCodes; |
| | | } |
| | | |
| | | public void setSourceCodes(List<String> sourceCodes) { |
| | | this.sourceCodes = sourceCodes; |
| | | } |
| | | |
| | | public int getCount() { |
| | | return count; |
| | | } |
| | |
| | | |
| | | private Long appId; |
| | | private String nameKey; |
| | | private Integer state; |
| | | private long start; |
| | | private int count; |
| | | |
| | |
| | | public void setCount(int count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | } |
| | |
| | | |
| | | @Transactional |
| | | public void addRecord(GoldCornRecord record) throws GoldRecordException { |
| | | if (record == null || record.getAppId() == null || record.getGoldCorn() == null || record.getSourceId() == null || record.getType() == null) { |
| | | if (record == null || record.getAppId() == null || record.getGoldCorn() == null || record.getSourceCode() == null || record.getType() == null) { |
| | | throw new GoldRecordException(GoldRecordException.CODE_PARAMS_NOT_ENOUGH, "参数不完整"); |
| | | } |
| | | if (record.getCreateTime() == null) { |
| | |
| | | public long count(RecordQuery query) { |
| | | return goldCornRecordMapper.count(query); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service(version = "1.0") |
| | | @Service(version = "1.0" ) |
| | | public class GoldCornAppServiceImpl implements GoldCornAppService { |
| | | |
| | | @Resource |
| | |
| | | package com.ks.goldcorn.service.remote; |
| | | |
| | | import com.ks.goldcorn.exception.GoldAppException; |
| | | import com.ks.goldcorn.exception.GoldSourceException; |
| | | import com.ks.goldcorn.mapper.GoldCornGetSourceMapper; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornGetSource; |
| | | import com.ks.goldcorn.query.SourceQuery; |
| | | import com.ks.goldcorn.service.GoldCornAppManager; |
| | | import io.seata.core.context.RootContext; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void addSource(GoldCornGetSource source) throws GoldSourceException { |
| | | System.out.println("开始全局事务,XID = " + RootContext.getXID()); |
| | | if (source == null || source.getAppId() == null || source.getGoldCorn() == null || StringUtil.isNullOrEmpty(source.getSourceCode()) || StringUtil.isNullOrEmpty(source.getSourceName())) { |
| | | throw new GoldSourceException(GoldSourceException.CODE_PARAMS_NOT_ENOUGH, "参数不完整"); |
| | | } |
| | |
| | | source.setUpdateTime(new Date()); |
| | | goldCornGetSourceMapper.updateByPrimaryKeySelective(source); |
| | | } |
| | | |
| | | @Override |
| | | public List<GoldCornGetSource> listShow(String appCode, int page, int pageSize) throws GoldAppException { |
| | | Long appId = goldCornAppManager.getAppId(appCode); |
| | | SourceQuery query = new SourceQuery(); |
| | | query.setAppId(appId); |
| | | query.setStart((page - 1) * pageSize); |
| | | query.setCount(pageSize); |
| | | query.setState(GoldCornGetSource.STATE_NORMAL); |
| | | return goldCornGetSourceMapper.list(query); |
| | | } |
| | | |
| | | @Override |
| | | public long countShow(String appCode) throws GoldAppException { |
| | | Long appId = goldCornAppManager.getAppId(appCode); |
| | | SourceQuery query = new SourceQuery(); |
| | | query.setAppId(appId); |
| | | query.setState(GoldCornGetSource.STATE_NORMAL); |
| | | return goldCornGetSourceMapper.count(query); |
| | | } |
| | | } |
| | |
| | | package com.ks.goldcorn.service.remote; |
| | | |
| | | import com.ks.goldcorn.mapper.GoldCornRecordMapper; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornRecord; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornRecordCountMap; |
| | | import com.ks.goldcorn.pojo.Query.GoldCornRecordQuery; |
| | | import com.ks.goldcorn.query.RecordQuery; |
| | | import com.ks.goldcorn.service.GoldCornAppManager; |
| | | import com.ks.goldcorn.service.GoldCornRecordManager; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0") |
| | |
| | | private GoldCornRecordManager goldCornRecordManager; |
| | | |
| | | @Resource |
| | | private GoldCornRecordMapper goldCornRecordMapper; |
| | | |
| | | @Resource |
| | | private GoldCornAppManager goldCornAppManager; |
| | | |
| | | @Override |
| | | public List<GoldCornRecord> listUserRecord(String appCode, String uid, Integer type, int page, int pageSize) { |
| | | Long appId = goldCornAppManager.selectAppIdByAppCode(appCode); |
| | | public List<GoldCornRecord> listUserRecord(GoldCornRecordQuery q) { |
| | | Long appId = goldCornAppManager.selectAppIdByAppCode(q.getAppCode()); |
| | | if (appId == null) { |
| | | return null; |
| | | } |
| | | RecordQuery query = new RecordQuery(); |
| | | query.setAppId(appId); |
| | | query.setStart((page - 1) * pageSize); |
| | | query.setCount(pageSize); |
| | | query.setType(type); |
| | | query.setUid(uid); |
| | | query.setStart((q.getPage() - 1) * q.getPageSize()); |
| | | query.setCount(q.getPageSize()); |
| | | query.setType(q.getType()); |
| | | query.setUid(q.getUid()); |
| | | query.setSourceCodes(q.getSourceCodes()); |
| | | query.setSortList(Arrays.asList(new String[]{"create_time desc"})); |
| | | return goldCornRecordManager.list(query); |
| | | } |
| | | |
| | | @Override |
| | | public long countUserRecord(String appCode, String uid, Integer type) { |
| | | Long appId = goldCornAppManager.selectAppIdByAppCode(appCode); |
| | | public long countUserRecord(GoldCornRecordQuery q) { |
| | | Long appId = goldCornAppManager.selectAppIdByAppCode(q.getAppCode()); |
| | | if (appId == null) { |
| | | return 0; |
| | | } |
| | | |
| | | RecordQuery query = new RecordQuery(); |
| | | query.setAppId(appId); |
| | | query.setType(type); |
| | | query.setUid(uid); |
| | | query.setType(q.getType()); |
| | | query.setUid(q.getUid()); |
| | | query.setSourceCodes(q.getSourceCodes()); |
| | | query.setMinCreateTime(q.getMinCreateTime()); |
| | | query.setMaxCreateTime(q.getMaxCreateTime()); |
| | | |
| | | return goldCornRecordManager.count(query); |
| | | } |
| | | |
| | | @Override |
| | | public List<GoldCornRecordCountMap> countUserRecordBySource(GoldCornRecordQuery q) { |
| | | Long appId = goldCornAppManager.selectAppIdByAppCode(q.getAppCode()); |
| | | if (appId == null) { |
| | | return null; |
| | | } |
| | | |
| | | RecordQuery query = new RecordQuery(); |
| | | query.setAppId(appId); |
| | | query.setType(q.getType()); |
| | | query.setUid(q.getUid()); |
| | | query.setSourceCodes(q.getSourceCodes()); |
| | | query.setMinCreateTime(q.getMinCreateTime()); |
| | | query.setMaxCreateTime(q.getMaxCreateTime()); |
| | | return goldCornRecordMapper.countList(query); |
| | | } |
| | | } |
| | |
| | | import com.ks.goldcorn.exception.GoldRecordException; |
| | | import com.ks.goldcorn.exception.GoldTradeException; |
| | | import com.ks.goldcorn.exception.GoldUserException; |
| | | import com.ks.goldcorn.manager.RedisManager; |
| | | import com.ks.goldcorn.mapper.GoldCornAppInfoMapper; |
| | | import com.ks.goldcorn.mapper.GoldCornBalanceMapper; |
| | | import com.ks.goldcorn.mapper.GoldCornConsumeSourceMapper; |
| | |
| | | import com.ks.goldcorn.service.GoldCornBalanceManager; |
| | | import com.ks.goldcorn.service.GoldCornRecordManager; |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Service(version = "1.0") |
| | | public class GoldCornTradeServiceImpl implements GoldCornTradeService { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(GoldCornTradeService.class); |
| | | |
| | | @Resource |
| | | private GoldCornAppInfoMapper goldCornAppInfoMapper; |
| | |
| | | |
| | | @Resource |
| | | private GoldCornRecordManager goldCornRecordManager; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | /** |
| | | * 验证系统与用户 |
| | |
| | | return appInfo.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public long getNextDoTaskTime(String appCode, String uid, String sourceCode) { |
| | | long time = redisManager.getCanAddCornExpireTime(appCode, uid, sourceCode); |
| | | if (time <= 0) { |
| | | return -1; |
| | | } |
| | | |
| | | return System.currentTimeMillis() + 1000 * time; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void addGoldCorn(String appCode, String uid, String sourceCode, String title, String desc) throws GoldAppException, GoldUserException, GoldTradeException { |
| | | public void addGoldCorn(String appCode, String uid, String sourceCode, Integer goldCornCount, String title, String desc) throws GoldAppException, GoldUserException, GoldTradeException { |
| | | Long appId = validateAppAndUser(appCode, uid); |
| | | GoldCornGetSource source = goldCornGetSourceMapper.selectByAppIdAndSourceCode(appId, sourceCode); |
| | | if (source == null) { |
| | | throw new GoldUserException(GoldTradeException.CODE_NOT_EXIST, "source is not exist"); |
| | | } |
| | | |
| | | //加记录 |
| | | GoldCornRecord record = new GoldCornRecord(); |
| | | record.setAppId(appId); |
| | | record.setGoldCorn(source.getGoldCorn()); |
| | | record.setSourceId(source.getId()); |
| | | record.setType(GoldCornRecord.TYPE_GET); |
| | | record.setUid(uid); |
| | | if (title != null) { |
| | | record.setTitle(title); |
| | | } else { |
| | | record.setTitle(source.getSourceName()); |
| | | } |
| | | if (desc != null) { |
| | | record.setDesc(desc); |
| | | } else { |
| | | record.setDesc(source.getSourceDesc()); |
| | | |
| | | String key = appCode + "-" + uid + "-" + sourceCode; |
| | | if (!redisTemplate.opsForValue().setIfAbsent(key, 1, 60 * 2, TimeUnit.SECONDS)) { |
| | | throw new GoldTradeException(GoldTradeException.CODE_FREQUENCY_LIMIT, "请求频率过高,请稍后再试"); |
| | | } |
| | | try { |
| | | goldCornRecordManager.addRecord(record); |
| | | } catch (GoldRecordException e) { |
| | | throw new GoldTradeException(GoldTradeException.CODE_ADD_RECORD_FAIL, "添加记录失败"); |
| | | int count = redisManager.getGoldCornAddRecordCount(appCode, uid, sourceCode); |
| | | if (count >= source.getMaxDayCount()) { |
| | | throw new GoldTradeException(GoldTradeException.CODE_COUNT_LIMIT, "添加次数超限,请明日再试"); |
| | | } |
| | | |
| | | if (!redisManager.canAddCornWithTime(appCode, uid, sourceCode)) { |
| | | throw new GoldTradeException(GoldTradeException.CODE_FREQUENCY_LIMIT, "添加时间间隔过小"); |
| | | } |
| | | //加记录 |
| | | GoldCornRecord record = new GoldCornRecord(); |
| | | record.setAppId(appId); |
| | | record.setGoldCorn(goldCornCount == null ? source.getGoldCorn() : goldCornCount); |
| | | record.setSourceCode(source.getSourceCode()); |
| | | record.setType(GoldCornRecord.TYPE_GET); |
| | | record.setUid(uid); |
| | | if (title != null) { |
| | | record.setTitle(title); |
| | | } else { |
| | | record.setTitle(source.getSourceName()); |
| | | } |
| | | if (desc != null) { |
| | | record.setDesc(desc); |
| | | } else { |
| | | record.setDesc(source.getSourceDesc()); |
| | | } |
| | | try { |
| | | goldCornRecordManager.addRecord(record); |
| | | } catch (GoldRecordException e) { |
| | | throw new GoldTradeException(GoldTradeException.CODE_ADD_RECORD_FAIL, "添加记录失败"); |
| | | } |
| | | //加余额 |
| | | goldCornBalanceManager.addMoney(appId, uid, record.getGoldCorn()); |
| | | |
| | | redisManager.addCornSuccess(appCode, uid, sourceCode, source.getMinTimeSpan()); |
| | | } catch (GoldUserException e) { |
| | | throw e; |
| | | } catch (GoldTradeException e) { |
| | | throw e; |
| | | } catch (Exception e) { |
| | | logger.error("添加金币未知异常:{}", e); |
| | | } finally { |
| | | redisTemplate.delete(key); |
| | | } |
| | | //加余额 |
| | | goldCornBalanceManager.addMoney(appId, uid, source.getGoldCorn()); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void consumeGoldCorn(String appCode, String uid, String sourceCode, String title, String desc) throws GoldAppException, GoldUserException, GoldTradeException { |
| | | public void consumeGoldCorn(String appCode, String uid, String sourceCode, Integer goldCornCount, String title, String desc) throws GoldAppException, GoldUserException, GoldTradeException { |
| | | Long appId = validateAppAndUser(appCode, uid); |
| | | GoldCornConsumeSource source = goldCornConsumeSourceMapper.selectByAppIdAndSourceCode(appId, sourceCode); |
| | | if (source == null) { |
| | | throw new GoldUserException(GoldTradeException.CODE_NOT_EXIST, "source is not exist"); |
| | | } |
| | | |
| | | int goldCorn = goldCornCount == null ? source.getGoldCorn() : goldCornCount; |
| | | |
| | | //减余额 |
| | | goldCornBalanceManager.subMoney(appId, uid, source.getGoldCorn()); |
| | | goldCornBalanceManager.subMoney(appId, uid, goldCorn); |
| | | |
| | | //加记录 |
| | | GoldCornRecord record = new GoldCornRecord(); |
| | | record.setAppId(appId); |
| | | record.setGoldCorn(source.getGoldCorn()); |
| | | record.setSourceId(source.getId()); |
| | | record.setGoldCorn(goldCorn); |
| | | record.setSourceCode(source.getSourceCode()); |
| | | record.setType(GoldCornRecord.TYPE_CONSUME); |
| | | record.setUid(uid); |
| | | if (title != null) { |
| | |
| | | } catch (GoldRecordException e) { |
| | | throw new GoldTradeException(GoldTradeException.CODE_ADD_RECORD_FAIL, "添加记录失败"); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8082 |
| | | tomcat: |
| | | uri-encoding: UTF-8 |
| | | |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | http: |
| | | encoding: |
| | | force: true |
| | | charset: UTF-8 |
| | | enabled: true |
| | | data: |
| | | mongodb: |
| | | username: yeshi |
| | | password: 'Yeshi2016@' |
| | | host: 193.112.35.168 |
| | | port: 27016 |
| | | database: flq |
| | | authentication-database: admin |
| | | redis: |
| | | host: 193.112.35.168 #193.112.34.40 |
| | | port: 6379 |
| | | #Yeshi2016@ |
| | | password: 'crs-43yhgz0i:Yeshi2016@' |
| | | timeout: 5000ms |
| | | jedis: |
| | | pool: |
| | | max-wait: 10000ms |
| | | max-idle: 200 |
| | | max-active: 1024 |
| | | database: 5 |
| | | |
| | | datasource: |
| | | #jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_goldcorn?serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_goldcorn?serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: Yeshi2016@ |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | druid: |
| | | initial-size: 8 |
| | | min-idle: 1 |
| | | max-active: 20 |
| | | max-wait: 60000 |
| | | time-between-eviction-runsMillis: 60000 |
| | | min-evictable-idle-timeMillis: 300000 |
| | | validation-query: select 'x' FROM DUAL |
| | | test-while-idle: true |
| | | test-on-borrow: false |
| | | test-on-return: false |
| | | pool-prepared-statements: true |
| | | max-open-prepared-statements: 20 |
| | | max-pool-prepared-statement-per-connection-size: 20 |
| | | filters: stat |
| | | connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
| | | use-global-data-source-stat: true |
| | | mybatis: |
| | | mapper-locations: classpath:mapper/*.xml |
| | | type-aliases-package: com.ks.goldcorn.pojo.DO |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | |
| | | dubbo: |
| | | application: |
| | | name: goldcorn-service |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://134.175.68.214:2181 # 134.175.68.214 134.175.68.214:2181 |
| | | client: curator |
| | | protocol: |
| | | name: dubbo |
| | | port: 20882 |
| | | host: 192.168.3.122 |
| | | scan: |
| | | base-packages: com.ks.goldcorn.service.remote |
| | | provider: |
| | | timeout: 10000 |
New file |
| | |
| | | server: |
| | | port: 8080 |
| | | tomcat: |
| | | uri-encoding: UTF-8 |
| | | |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | http: |
| | | encoding: |
| | | force: true |
| | | charset: UTF-8 |
| | | enabled: true |
| | | data: |
| | | mongodb: |
| | | username: yeshi |
| | | password: 'Yeshi2016@' |
| | | host: 193.112.35.168 |
| | | port: 27016 |
| | | database: flq |
| | | authentication-database: admin |
| | | redis: |
| | | host: 172.16.16.15 #193.112.34.40 |
| | | port: 6379 |
| | | #Yeshi2016@ |
| | | password: 'crs-43yhgz0i:Yeshi2016@' |
| | | timeout: 5000ms |
| | | database: 5 |
| | | lettuce: |
| | | pool: |
| | | max-active: 1024 |
| | | max-wait: 10000ms |
| | | max-idle: 200 |
| | | time-between-eviction-runs: 60000ms |
| | | min-idle: 8 |
| | | jedis: |
| | | pool: |
| | | max-active: 1024 |
| | | max-wait: 10000ms |
| | | max-idle: 200 |
| | | time-between-eviction-runs: 60000ms |
| | | min-idle: 8 |
| | | |
| | | |
| | | datasource: |
| | | #jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_goldcorn?serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://172.16.16.17:3306/ks_goldcorn?serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: Yeshi2016@ |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | druid: |
| | | initial-size: 8 |
| | | min-idle: 1 |
| | | max-active: 20 |
| | | max-wait: 60000 |
| | | time-between-eviction-runsMillis: 60000 |
| | | min-evictable-idle-timeMillis: 300000 |
| | | validation-query: select 'x' FROM DUAL |
| | | test-while-idle: true |
| | | test-on-borrow: false |
| | | test-on-return: false |
| | | pool-prepared-statements: true |
| | | max-open-prepared-statements: 20 |
| | | max-pool-prepared-statement-per-connection-size: 20 |
| | | filters: stat |
| | | connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
| | | use-global-data-source-stat: true |
| | | mybatis: |
| | | mapper-locations: classpath:mapper/*.xml |
| | | type-aliases-package: com.ks.goldcorn.pojo.DO |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | |
| | | dubbo: |
| | | application: |
| | | name: goldcorn-service |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://172.16.16.29:2181 # 134.175.68.214 134.175.68.214:2181 |
| | | client: curator |
| | | protocol: |
| | | name: dubbo |
| | | port: 20882 |
| | | # host: 192.168.3.122 |
| | | scan: |
| | | base-packages: com.ks.goldcorn.service.remote |
| | | provider: |
| | | timeout: 10000 |
| | |
| | | server: |
| | | port: 8082 |
| | | tomcat: |
| | | uri-encoding: UTF-8 |
| | | |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | http: |
| | | encoding: |
| | | force: true |
| | | charset: UTF-8 |
| | | enabled: true |
| | | data: |
| | | mongodb: |
| | | username: yeshi |
| | | password: 'Yeshi2016@' |
| | | host: 193.112.35.168 |
| | | port: 27016 |
| | | database: flq |
| | | authentication-database: admin |
| | | redis: |
| | | host: 192.168.3.253 |
| | | port: 6379 |
| | | password: '123456' |
| | | timeout: 5000 |
| | | jedis: |
| | | pool: |
| | | max-wait: 10000 |
| | | max-idle: 200 |
| | | max-active: 1024 |
| | | database: 3 |
| | | |
| | | datasource: |
| | | url: jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ks_goldcorn |
| | | username: root |
| | | password: Yeshi2016@ |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | druid: |
| | | initial-size: 8 |
| | | min-idle: 1 |
| | | max-active: 20 |
| | | max-wait: 60000 |
| | | time-between-eviction-runsMillis: 60000 |
| | | min-evictable-idle-timeMillis: 300000 |
| | | validation-query: select 'x' FROM DUAL |
| | | test-while-idle: true |
| | | test-on-borrow: false |
| | | test-on-return: false |
| | | pool-prepared-statements: true |
| | | max-open-prepared-statements: 20 |
| | | max-pool-prepared-statement-per-connection-size: 20 |
| | | filters: stat |
| | | connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
| | | use-global-data-source-stat: true |
| | | mybatis: |
| | | mapper-locations : classpath:mapper/*.xml |
| | | type-aliases-package: com.ks.goldcorn.pojo.DO |
| | | |
| | | dubbo: |
| | | application: |
| | | name: goldcorn-service |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://134.175.68.214:2181 # 134.175.68.214 134.175.68.214:2181 |
| | | client: curator |
| | | protocol: |
| | | name: dubbo |
| | | port: 20882 |
| | | scan: |
| | | base-packages: com.ks.goldcorn.service.remote |
| | | provider: |
| | | timeout: 10000 |
| | | profiles: |
| | | active: pro |
New file |
| | |
| | | transport { |
| | | # tcp udt unix-domain-socket |
| | | type = "TCP" |
| | | #NIO NATIVE |
| | | server = "NIO" |
| | | #enable heartbeat |
| | | heartbeat = true |
| | | # the client batch send request enable |
| | | enableClientBatchSendRequest = true |
| | | #thread factory for netty |
| | | threadFactory { |
| | | bossThreadPrefix = "NettyBoss" |
| | | workerThreadPrefix = "NettyServerNIOWorker" |
| | | serverExecutorThread-prefix = "NettyServerBizHandler" |
| | | shareBossWorker = false |
| | | clientSelectorThreadPrefix = "NettyClientSelector" |
| | | clientSelectorThreadSize = 1 |
| | | clientWorkerThreadPrefix = "NettyClientWorkerThread" |
| | | # netty boss thread size,will not be used for UDT |
| | | bossThreadSize = 1 |
| | | #auto default pin or 8 |
| | | workerThreadSize = "default" |
| | | } |
| | | shutdown { |
| | | # when destroy server, wait seconds |
| | | wait = 3 |
| | | } |
| | | serialization = "seata" |
| | | compressor = "none" |
| | | } |
| | | service { |
| | | #transaction service group mapping |
| | | vgroupMapping.goldcorn-seata-service-group = "default" |
| | | #only support when registry.type=file, please don't set multiple addresses |
| | | default.grouplist = "134.175.68.214:8191" |
| | | #degrade, current not support |
| | | enableDegrade = false |
| | | #disable seata |
| | | disableGlobalTransaction = false |
| | | } |
| | | |
| | | client { |
| | | rm { |
| | | asyncCommitBufferLimit = 10000 |
| | | lock { |
| | | retryInterval = 10 |
| | | retryTimes = 30 |
| | | retryPolicyBranchRollbackOnConflict = true |
| | | } |
| | | reportRetryCount = 5 |
| | | tableMetaCheckEnable = false |
| | | reportSuccessEnable = false |
| | | } |
| | | tm { |
| | | commitRetryCount = 5 |
| | | rollbackRetryCount = 5 |
| | | } |
| | | undo { |
| | | dataValidation = true |
| | | logSerialization = "jackson" |
| | | logTable = "undo_log" |
| | | } |
| | | log { |
| | | exceptionRate = 100 |
| | | } |
| | | } |
| | |
| | | <property name="log.maxHistory" value="30"/> |
| | | <!--日志存储的根路径 ${catalina.base}指向每个Tomcat目录私有信息的位置, |
| | | 就是conf、logs、temp、webapps和work的父目录--> |
| | | <property name="log.filePath" value="E:/logback"/> |
| | | <property name="log.filePath" value="/usr/local/tomcat/logs"/> |
| | | <!--日志展示的格式--> |
| | | <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"/> |
| | | |
| | |
| | | info日志会输出到infoAppender指定的文件中 |
| | | error日志会输出到errorAppender指定的文件中--> |
| | | |
| | | <logger name="io.seata" level="ERROR"></logger> |
| | | <logger name="System.out" level="INFO"></logger> |
| | | |
| | | |
| | | <!-- 一切logger都会继承自root,root默认的层级level为debug --> |
| | | <root level="INFO"> |
| | | <!--在控制台中输出所在层级对应level(以及大于level)的日志信息,因为这里并没有设置LevelFilter--> |
| | |
| | | <result column="app_id" property="appId" jdbcType="BIGINT"/> |
| | | <result column="source_name" property="sourceName" jdbcType="VARCHAR"/> |
| | | <result column="source_code" property="sourceCode" jdbcType="VARCHAR"/> |
| | | <result column="icon" property="icon" jdbcType="VARCHAR"/> |
| | | <result column="source_desc" property="sourceDesc" jdbcType="VARCHAR"/> |
| | | <result column="gold_corn" property="goldCorn" jdbcType="INTEGER"/> |
| | | <result column="remarks" property="remarks" jdbcType="VARCHAR"/> |
| | |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, app_id, source_name, source_code, source_desc, gold_corn, remarks, create_time, |
| | | id, app_id, source_name, source_code,icon, source_desc, gold_corn, remarks, create_time, |
| | | update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.goldcorn.pojo.DO.GoldCornConsumeSource"> |
| | | insert into ks_score_consume_source (id, app_id, source_name, |
| | | source_code, source_desc, gold_corn, |
| | | source_code, source_desc, gold_corn, icon, |
| | | remarks, create_time, update_time |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{sourceName,jdbcType=VARCHAR}, |
| | | #{sourceCode,jdbcType=VARCHAR}, #{sourceDesc,jdbcType=VARCHAR}, #{goldCorn,jdbcType=INTEGER}, |
| | | #{sourceCode,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{sourceDesc,jdbcType=VARCHAR}, #{goldCorn,jdbcType=INTEGER}, |
| | | #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | |
| | | </if> |
| | | <if test="sourceCode != null"> |
| | | source_code, |
| | | </if> |
| | | <if test="icon != null"> |
| | | icon, |
| | | </if> |
| | | <if test="sourceDesc != null"> |
| | | source_desc, |
| | |
| | | <if test="sourceCode != null"> |
| | | #{sourceCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="icon != null"> |
| | | #{icon,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sourceDesc != null"> |
| | | #{sourceDesc,jdbcType=VARCHAR}, |
| | | </if> |
| | |
| | | <if test="sourceCode != null"> |
| | | source_code = #{sourceCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="icon != null"> |
| | | icon = #{icon,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sourceDesc != null"> |
| | | source_desc = #{sourceDesc,jdbcType=VARCHAR}, |
| | | </if> |
| | |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | source_name = #{sourceName,jdbcType=VARCHAR}, |
| | | source_code = #{sourceCode,jdbcType=VARCHAR}, |
| | | icon = #{icon,jdbcType=VARCHAR}, |
| | | source_desc = #{sourceDesc,jdbcType=VARCHAR}, |
| | | gold_corn = #{goldCorn,jdbcType=INTEGER}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.ks.goldcorn.mapper.GoldCornGetSourceMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.goldcorn.pojo.DO.GoldCornGetSource"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="app_id" property="appId" jdbcType="BIGINT"/> |
| | | <result column="source_name" property="sourceName" jdbcType="VARCHAR"/> |
| | | <result column="source_code" property="sourceCode" jdbcType="VARCHAR"/> |
| | | <result column="icon" property="icon" jdbcType="VARCHAR"/> |
| | | <result column="source_desc" property="sourceDesc" jdbcType="VARCHAR"/> |
| | | <result column="gold_corn" property="goldCorn" jdbcType="INTEGER"/> |
| | | <result column="max_day_count" property="maxDayCount" jdbcType="INTEGER"/> |
| | | <result column="remarks" property="remarks" jdbcType="VARCHAR"/> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="min_time_span" property="minTimeSpan" jdbcType="INTEGER"/> |
| | | <result column="weight" property="weight" jdbcType="INTEGER"/> |
| | | <result column="state" property="state" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, app_id, source_name, source_code, source_desc, gold_corn, remarks, create_time, |
| | | update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select |
| | | <sql id="Base_Column_List">id, app_id, source_name, source_code,icon, source_desc, gold_corn, remarks, create_time, update_time,max_day_count,min_time_span,weight,state</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/> |
| | | from ks_score_get_source |
| | | where id = #{id,jdbcType=BIGINT} |
| | | from ks_score_get_source where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <sql id="query"> |
| | | |
| | | <select id="list" resultMap="BaseResultMap"> |
| | | select |
| | | <if test="query.appId!=null">AND app_id=#{query.appId}</if> |
| | | <if test="query.nameKey!=null">AND source_name like '${query.nameKey}%'</if> |
| | | <if test="query.state!=null">AND state = #{query.state}</if> |
| | | |
| | | </sql> |
| | | |
| | | <select id="list" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> |
| | | from ks_score_get_source |
| | | where 1=1 |
| | | <if test="query.appId!=null"> |
| | | AND app_id=#{query.appId} |
| | | </if> |
| | | from ks_score_get_source where 1=1 |
| | | <include refid="query"></include> |
| | | |
| | | <if test="query.nameKey!=null"> |
| | | AND source_name like '${query.nameKey}%' |
| | | </if> |
| | | order by weight desc ,create_time asc |
| | | |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | <select id="count" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from ks_score_get_source |
| | | where 1=1 |
| | | <if test="query.appId!=null"> |
| | | AND app_id=#{query.appId} |
| | | </if> |
| | | |
| | | <if test="query.nameKey!=null"> |
| | | AND source_name like '${query.nameKey}%' |
| | | </if> |
| | | <select id="count" resultType="java.lang.Long">select count(*) from ks_score_get_source where 1=1 |
| | | <include refid="query"></include> |
| | | </select> |
| | | |
| | | <select id="selectByAppIdAndSourceCode" resultMap="BaseResultMap"> |
| | | select |
| | | <select id="selectByAppIdAndSourceCode" resultMap="BaseResultMap">select |
| | | <include refid="Base_Column_List"/> |
| | | from ks_score_get_source |
| | | where app_id=#{appId} and source_code=#{sourceCode} |
| | | from ks_score_get_source where app_id=#{appId} and source_code=#{sourceCode} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | delete from ks_score_get_source |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.goldcorn.pojo.DO.GoldCornGetSource"> |
| | | insert into ks_score_get_source (id, app_id, source_name, |
| | | source_code, source_desc, gold_corn, |
| | | remarks, create_time, update_time |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{sourceName,jdbcType=VARCHAR}, |
| | | #{sourceCode,jdbcType=VARCHAR}, #{sourceDesc,jdbcType=VARCHAR}, #{goldCorn,jdbcType=INTEGER}, |
| | | #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornGetSource"> |
| | | insert into ks_score_get_source |
| | | <delete id="deleteByPrimaryKey" |
| | | parameterType="java.lang.Long">delete from ks_score_get_source where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" |
| | | parameterType="com.ks.goldcorn.pojo.DO.GoldCornGetSource">insert into ks_score_get_source (id, app_id, source_name, source_code,icon, source_desc, gold_corn, remarks, create_time, update_time ,id,max_day_count,min_time_span,weight,state) values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{sourceName,jdbcType=VARCHAR}, #{sourceCode,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{sourceDesc,jdbcType=VARCHAR}, #{goldCorn,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} ,#{id,jdbcType=BIGINT},#{maxDayCount,jdbcType=INTEGER},#{minTimeSpan,jdbcType=INTEGER},#{weight,jdbcType=INTEGER},#{state,jdbcType=INTEGER})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornGetSource">insert into |
| | | ks_score_get_source |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="appId != null"> |
| | | app_id, |
| | | </if> |
| | | <if test="sourceName != null"> |
| | | source_name, |
| | | </if> |
| | | <if test="sourceCode != null"> |
| | | source_code, |
| | | </if> |
| | | <if test="sourceDesc != null"> |
| | | source_desc, |
| | | </if> |
| | | <if test="goldCorn != null"> |
| | | gold_corn, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time, |
| | | </if> |
| | | <if test="id != null">id,</if> |
| | | <if test="appId != null">app_id,</if> |
| | | <if test="sourceName != null">source_name,</if> |
| | | <if test="sourceCode != null">source_code,</if> |
| | | <if test="icon != null">icon,</if> |
| | | <if test="sourceDesc != null">source_desc,</if> |
| | | <if test="goldCorn != null">gold_corn,</if> |
| | | <if test="remarks != null">remarks,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="maxDayCount != null">max_day_count,</if> |
| | | <if test="minTimeSpan != null">min_time_span,</if> |
| | | <if test="weight != null">weight,</if> |
| | | <if test="state != null">state,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="appId != null"> |
| | | #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="sourceName != null"> |
| | | #{sourceName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sourceCode != null"> |
| | | #{sourceCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sourceDesc != null"> |
| | | #{sourceDesc,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="goldCorn != null"> |
| | | #{goldCorn,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="appId != null">#{appId,jdbcType=BIGINT},</if> |
| | | <if test="sourceName != null">#{sourceName,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="sourceCode != null">#{sourceCode,jdbcType=VARCHAR},</if> |
| | | <if test="sourceDesc != null">#{sourceDesc,jdbcType=VARCHAR},</if> |
| | | <if test="goldCorn != null">#{goldCorn,jdbcType=INTEGER},</if> |
| | | <if test="remarks != null">#{remarks,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="maxDayCount != null">#{maxDayCount,jdbcType=INTEGER},</if> |
| | | <if test="minTimeSpan != null">#{minTimeSpan,jdbcType=INTEGER},</if> |
| | | <if test="weight != null">#{weight,jdbcType=INTEGER}</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornGetSource"> |
| | | update ks_score_get_source |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornGetSource">update |
| | | ks_score_get_source |
| | | <set> |
| | | <if test="appId != null"> |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="sourceName != null"> |
| | | source_name = #{sourceName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sourceCode != null"> |
| | | source_code = #{sourceCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sourceDesc != null"> |
| | | source_desc = #{sourceDesc,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="goldCorn != null"> |
| | | gold_corn = #{goldCorn,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="appId != null">app_id = #{appId,jdbcType=BIGINT},</if> |
| | | <if test="sourceName != null">source_name = #{sourceName,jdbcType=VARCHAR},</if> |
| | | <if test="sourceCode != null">source_code = #{sourceCode,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">icon = #{icon,jdbcType=VARCHAR},</if> |
| | | <if test="sourceDesc != null">source_desc = #{sourceDesc,jdbcType=VARCHAR},</if> |
| | | <if test="goldCorn != null">gold_corn = #{goldCorn,jdbcType=INTEGER},</if> |
| | | <if test="remarks != null">remarks = #{remarks,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="maxDayCount !=null">max_day_count =#{maxDayCount,jdbcType=INTEGER},</if> |
| | | <if test="minTimeSpan !=null">min_time_span =#{minTimeSpan,jdbcType=INTEGER},</if> |
| | | <if test="weight !=null">weight =#{weight,jdbcType=INTEGER},</if> |
| | | <if test="state !=null">state =#{state,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.goldcorn.pojo.DO.GoldCornGetSource"> |
| | | update ks_score_get_source |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | source_name = #{sourceName,jdbcType=VARCHAR}, |
| | | source_code = #{sourceCode,jdbcType=VARCHAR}, |
| | | source_desc = #{sourceDesc,jdbcType=VARCHAR}, |
| | | gold_corn = #{goldCorn,jdbcType=INTEGER}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.ks.goldcorn.pojo.DO.GoldCornGetSource">update ks_score_get_source set app_id = #{appId,jdbcType=BIGINT}, source_name = #{sourceName,jdbcType=VARCHAR}, source_code = #{sourceCode,jdbcType=VARCHAR}, icon = #{icon,jdbcType=VARCHAR}, source_desc = #{sourceDesc,jdbcType=VARCHAR}, gold_corn = #{goldCorn,jdbcType=INTEGER}, remarks = #{remarks,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} ,max_day_count =#{maxDayCount,jdbcType=INTEGER} ,min_time_span =#{minTimeSpan,jdbcType=INTEGER} ,weight =#{weight,jdbcType=INTEGER} ,state =#{state,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT}</update> |
| | | </mapper> |
| | |
| | | <result column="app_id" property="appId" jdbcType="BIGINT"/> |
| | | <result column="uid" property="uid" jdbcType="VARCHAR"/> |
| | | <result column="type" property="type" jdbcType="INTEGER"/> |
| | | <result column="title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="desc" property="desc" jdbcType="VARCHAR" /> |
| | | <result column="source_id" property="sourceId" jdbcType="BIGINT"/> |
| | | <result column="title" property="title" jdbcType="VARCHAR"/> |
| | | <result column="desc" property="desc" jdbcType="VARCHAR"/> |
| | | <result column="source_code" property="sourceCode" jdbcType="VARCHAR"/> |
| | | <result column="gold_corn" property="goldCorn" jdbcType="INTEGER"/> |
| | | <result column="remarks" property="remarks" jdbcType="VARCHAR"/> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="CountMap" type="com.ks.goldcorn.pojo.DO.GoldCornRecordCountMap"> |
| | | <result column="source_code" property="sourceCode" jdbcType="VARCHAR"/> |
| | | <result column="c" property="count" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, app_id, uid, `type`, `title`, `desc`, source_id, gold_corn, remarks, create_time |
| | | id, app_id, uid, `type`, `title`, `desc`, source_code, gold_corn, remarks, create_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select |
| | |
| | | </select> |
| | | |
| | | |
| | | <sql id="listWherre"> |
| | | <sql id="listWhere"> |
| | | |
| | | <if test="query.uid!=null"> |
| | | and uid=#{query.uid} |
| | |
| | | |
| | | <if test="query.type!=null"> |
| | | and `type`=#{query.type} |
| | | </if> |
| | | |
| | | <if test="query.sourceCodes!=null"> |
| | | and |
| | | <foreach collection="query.sourceCodes" item="code" separator=" or " open="(" close=")"> |
| | | `source_code`=#{code} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="query.minCreateTime!=null"> |
| | |
| | | from ks_score_record |
| | | where 1=1 |
| | | |
| | | <include refid="listWherre"></include> |
| | | <include refid="listWhere"></include> |
| | | |
| | | <if test="query.sortList!=null"> |
| | | <foreach collection="query.sortList" item="sortItem" open=" order by " separator=" , "> |
| | | #{sortItem} |
| | | ${sortItem} |
| | | </foreach> |
| | | </if> |
| | | |
| | |
| | | count(*) |
| | | from ks_score_record |
| | | where 1=1 |
| | | <include refid="listWherre"></include> |
| | | <include refid="listWhere"></include> |
| | | </select> |
| | | |
| | | |
| | | <select id="countList" resultMap="CountMap"> |
| | | select |
| | | source_code, count(*) as c |
| | | from ks_score_record |
| | | where 1=1 |
| | | <include refid="listWhere"></include> group by source_code |
| | | </select> |
| | | |
| | | |
| | |
| | | </delete> |
| | | |
| | | |
| | | <insert id="insert" parameterType="com.ks.goldcorn.pojo.DO.GoldCornRecord" > |
| | | <insert id="insert" parameterType="com.ks.goldcorn.pojo.DO.GoldCornRecord"> |
| | | insert into ks_score_record (id, app_id, uid, |
| | | `type`, title, `desc`, |
| | | source_id, gold_corn, remarks, |
| | | source_code, gold_corn, remarks, |
| | | create_time) |
| | | values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{uid,jdbcType=VARCHAR}, |
| | | #{type,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, |
| | | #{sourceId,jdbcType=BIGINT}, #{goldCorn,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, |
| | | #{sourceCode,jdbcType=VARCHAR}, #{goldCorn,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, |
| | | #{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornRecord" > |
| | | <insert id="insertSelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornRecord"> |
| | | insert into ks_score_record |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="appId != null" > |
| | | <if test="appId != null"> |
| | | app_id, |
| | | </if> |
| | | <if test="uid != null" > |
| | | <if test="uid != null"> |
| | | uid, |
| | | </if> |
| | | <if test="type != null" > |
| | | <if test="type != null"> |
| | | `type`, |
| | | </if> |
| | | <if test="title != null" > |
| | | <if test="title != null"> |
| | | title, |
| | | </if> |
| | | <if test="desc != null" > |
| | | <if test="desc != null"> |
| | | `desc`, |
| | | </if> |
| | | <if test="sourceId != null" > |
| | | source_id, |
| | | <if test="sourceCode != null"> |
| | | source_code, |
| | | </if> |
| | | <if test="goldCorn != null" > |
| | | <if test="goldCorn != null"> |
| | | gold_corn, |
| | | </if> |
| | | <if test="remarks != null" > |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="id != null" > |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="appId != null" > |
| | | <if test="appId != null"> |
| | | #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null" > |
| | | <if test="uid != null"> |
| | | #{uid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="type != null" > |
| | | <if test="type != null"> |
| | | #{type,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="title != null" > |
| | | <if test="title != null"> |
| | | #{title,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="desc != null" > |
| | | <if test="desc != null"> |
| | | #{desc,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sourceId != null" > |
| | | #{sourceId,jdbcType=BIGINT}, |
| | | <if test="sourceCode != null"> |
| | | #{sourceCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="goldCorn != null" > |
| | | <if test="goldCorn != null"> |
| | | #{goldCorn,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="remarks != null" > |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornRecord" > |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornRecord"> |
| | | update ks_score_record |
| | | <set > |
| | | <if test="appId != null" > |
| | | <set> |
| | | <if test="appId != null"> |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null" > |
| | | <if test="uid != null"> |
| | | uid = #{uid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="type != null" > |
| | | <if test="type != null"> |
| | | `type` = #{type,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="title != null" > |
| | | <if test="title != null"> |
| | | title = #{title,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="desc != null" > |
| | | <if test="desc != null"> |
| | | `desc` = #{desc,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="sourceId != null" > |
| | | source_id = #{sourceId,jdbcType=BIGINT}, |
| | | <if test="sourceCode != null"> |
| | | source_code = #{sourceCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="goldCorn != null" > |
| | | <if test="goldCorn != null"> |
| | | gold_corn = #{goldCorn,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="remarks != null" > |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.goldcorn.pojo.DO.GoldCornRecord" > |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.goldcorn.pojo.DO.GoldCornRecord"> |
| | | update ks_score_record |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | uid = #{uid,jdbcType=VARCHAR}, |
| | | `type` = #{type,jdbcType=INTEGER}, |
| | | title = #{title,jdbcType=VARCHAR}, |
| | | `desc` = #{desc,jdbcType=VARCHAR}, |
| | | source_id = #{sourceId,jdbcType=BIGINT}, |
| | | source_code = #{sourceCode,jdbcType=VARCHAR}, |
| | | gold_corn = #{goldCorn,jdbcType=INTEGER}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP} |
New file |
| | |
| | | registry { |
| | | # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa |
| | | type = "file" |
| | | |
| | | nacos { |
| | | application = "seata-server" |
| | | serverAddr = "localhost" |
| | | namespace = "" |
| | | username = "" |
| | | password = "" |
| | | } |
| | | eureka { |
| | | serviceUrl = "http://localhost:8761/eureka" |
| | | weight = "1" |
| | | } |
| | | redis { |
| | | serverAddr = "localhost:6379" |
| | | db = "0" |
| | | password = "" |
| | | timeout = "0" |
| | | } |
| | | zk { |
| | | serverAddr = "127.0.0.1:2181" |
| | | sessionTimeout = 6000 |
| | | connectTimeout = 2000 |
| | | username = "" |
| | | password = "" |
| | | } |
| | | consul { |
| | | serverAddr = "127.0.0.1:8500" |
| | | } |
| | | etcd3 { |
| | | serverAddr = "http://localhost:2379" |
| | | } |
| | | sofa { |
| | | serverAddr = "127.0.0.1:9603" |
| | | region = "DEFAULT_ZONE" |
| | | datacenter = "DefaultDataCenter" |
| | | group = "SEATA_GROUP" |
| | | addressWaitTime = "3000" |
| | | } |
| | | file { |
| | | name = "file.conf" |
| | | } |
| | | } |
| | | |
| | | config { |
| | | # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig |
| | | type = "file" |
| | | |
| | | nacos { |
| | | serverAddr = "localhost" |
| | | namespace = "" |
| | | group = "SEATA_GROUP" |
| | | username = "" |
| | | password = "" |
| | | } |
| | | consul { |
| | | serverAddr = "127.0.0.1:8500" |
| | | } |
| | | apollo { |
| | | appId = "seata-server" |
| | | apolloMeta = "http://192.168.1.204:8801" |
| | | namespace = "application" |
| | | } |
| | | zk { |
| | | serverAddr = "127.0.0.1:2181" |
| | | sessionTimeout = 6000 |
| | | connectTimeout = 2000 |
| | | username = "" |
| | | password = "" |
| | | } |
| | | etcd3 { |
| | | serverAddr = "http://localhost:2379" |
| | | } |
| | | file { |
| | | name = "file.conf" |
| | | } |
| | | } |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | 图标</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="icon" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | <span class="x-red">*</span>金币数量</label> |
| | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | <span class="x-red">*</span>每日获取最大次数</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="maxDayCount" required="" lay-verify="number" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | <span class="x-red">*</span>每次间隔时间(秒)</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="minTimeSpan" required="" lay-verify="number" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_desc" class="layui-form-label"> |
| | | 来源简介</label> |
| | | <div class="layui-input-inline"> |
| | |
| | | cols: [ |
| | | [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 80, sort: true, title: "ID"}, |
| | | {field: 'appCode', width: 120, title: "应用标识"}, |
| | | {field: 'appName', width: 120, title: "应用名称"}, |
| | | {field: 'icon', templet:'#iconTpl', edit: 'text', sort: true, width: 150, title: "图标"}, |
| | | {field: 'sourceName', edit: 'text', sort: true, width: 150, title: "来源名称"}, |
| | | {field: 'sourceCode', edit: 'text', sort: true, width: 120, title: "来源标识"}, |
| | | {field: 'state', edit: 'text',templet:'#stateTpl', sort: true, width: 120, title: "状态"}, |
| | | {field: 'weight', edit: 'text', sort: true, width: 80, title: "权重"}, |
| | | {field: 'goldCorn', edit: 'text', sort: true, width: 100, title: "金币数量"}, |
| | | {field: 'maxDayCount', edit: 'text', sort: true, width: 100, title: "每日最大次数"}, |
| | | {field: 'minTimeSpan', edit: 'text', sort: true, width: 100, title: "每次间隔时间(秒)"}, |
| | | {field: 'sourceDesc', edit: 'text', width: 200, title: "来源简介"}, |
| | | {field: 'remarks', edit: 'text', width: 200, title: "备注"}, |
| | | {field: 'createTime', sort: true, width: 150, title: "创建时间"}, |
| | | {field: 'updateTime', sort: true, width: 150, title: "修改时间"}, |
| | | {field: 'appCode', width: 120, title: "应用标识"}, |
| | | {field: 'appName', width: 120, title: "应用名称"}, |
| | | // {field: 'status', width: 80, title: "状态", templet: "#statusContainer"}, |
| | | {fixed: 'right', width: 150, title: "操作", toolbar: '#deleteContainer'}, |
| | | ] |
| | |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | |
| | | <script type="text/html" id="iconTpl"> |
| | | {{# if(d.icon ){ }} |
| | | <img src="{{d.icon}}" style="height:100%;" /> |
| | | {{# } else { }} |
| | | {{# } }} |
| | | </script> |
| | | |
| | | <script type="text/html" id="stateTpl"> |
| | | {{# if(d.state==1 ){ }} |
| | | <span>外显</span> |
| | | {{# } else if(d.state==2) { }} |
| | | <span>不外显</span> |
| | | {{# } else { }} |
| | | <span>禁用</span> |
| | | {{# } }} |
| | | </script> |
| | | </html> |
New file |
| | |
| | | package com.ks; |
| | | |
| | | import com.ks.goldcorn.pojo.DO.GoldCornGetSource; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.yeshi.utils.generater.mybatis.ColumnParseUtil; |
| | | |
| | | public class GeneralTest { |
| | | |
| | | |
| | | @Test |
| | | public void UpdateMapper() { |
| | | ColumnParseUtil.parseColumn(GoldCornGetSource.class,"D:\\workspace\\DayBuy\\service-goldcorn\\src\\main\\resources\\mapper\\GoldCornGetSourceMapper.xml"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ks; |
| | | |
| | | import com.ks.goldcorn.GoldCornApplication; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @SpringBootTest(classes = GoldCornApplication.class) |
| | | @ContextConfiguration |
| | | public class RedisTest { |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | @Test |
| | | public void getTime() throws InterruptedException { |
| | | String timeKey = "test-"; |
| | | redisTemplate.opsForValue().set(timeKey, "1", 2, TimeUnit.SECONDS); |
| | | long time1 = (redisTemplate.getExpire(timeKey)); |
| | | Thread.sleep(2000); |
| | | time1 = (redisTemplate.getExpire(timeKey)); |
| | | Thread.sleep(2000); |
| | | time1 = (redisTemplate.getExpire(timeKey)); |
| | | } |
| | | |
| | | } |
| | |
| | | @Test |
| | | public void list() throws Exception { |
| | | String appCode = "test1"; |
| | | List<GoldCornRecord> list = goldCornRecordService.listUserRecord(appCode, null, null, 1, 20); |
| | | long count = goldCornRecordService.countUserRecord(appCode, null, null); |
| | | System.out.println(count); |
| | | // List<GoldCornRecord> list = goldCornRecordService.listUserRecord(appCode, null, null, 1, 20); |
| | | // long count = goldCornRecordService.countUserRecord(appCode, null, null); |
| | | // System.out.println(count); |
| | | } |
| | | |
| | | |
| | |
| | | @Test |
| | | public void addGoldCorn() throws Exception { |
| | | String appCode = "test1"; |
| | | goldCornTradeService.addGoldCorn(appCode, "1", "source1", "测试自定义标题", null); |
| | | goldCornTradeService.addGoldCorn(appCode, "1", "source1",null, "测试自定义标题", null); |
| | | } |
| | | |
| | | @Test |
| | | public void consumeGoldCorn() throws Exception { |
| | | String appCode = "test1"; |
| | | goldCornTradeService.consumeGoldCorn(appCode, "1", "source1", "测试自定义标题", null); |
| | | goldCornTradeService.consumeGoldCorn(appCode, "1", "source1",null, "测试自定义标题", null); |
| | | } |
| | | |
| | | |
| | |
| | | database: 3 |
| | | |
| | | datasource: |
| | | url: jdbc:mysql://192.168.3.253:3306/test?serverTimezone=UTC |
| | | url: jdbc:mysql://192.168.3.253:3306/test?serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | |
| | | database: 3 |
| | | |
| | | datasource: |
| | | url: jdbc:mysql://192.168.3.253:3306/test?serverTimezone=UTC |
| | | url: jdbc:mysql://192.168.3.253:3306/test?serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | driver-class-name: com.mysql.jdbc.Driver |