Commit 9a7306b4 authored by shiyu's avatar shiyu

开店费更为数据库配置

parent c33282ce
package com.wwdz.ch.db.dao.openShop;
import com.wwdz.ch.db.domain.openShop.OpenShopCostConfig;
public interface OpenShopCostConfigDao {
OpenShopCostConfig findOne();
}
package com.wwdz.ch.db.domain.openShop;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data;
/**
* @author shiyu
* @date 2024/10/31
*/
@Data
public class OpenShopCostConfig implements Entity {
private Integer id;
/**
* 开店费,单位为分
*/
private Long openShopAmount;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否有效
*/
private Boolean isValid;
private static final long serialVersionUID = 1L;
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", openShopAmount=").append(openShopAmount);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isValid=").append(isValid);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
OpenShopCostConfig other = (OpenShopCostConfig) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getOpenShopAmount() == null ? other.getOpenShopAmount() == null : this.getOpenShopAmount().equals(other.getOpenShopAmount()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getIsValid() == null ? other.getIsValid() == null : this.getIsValid().equals(other.getIsValid()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getOpenShopAmount() == null) ? 0 : getOpenShopAmount().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getIsValid() == null) ? 0 : getIsValid().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
openShopAmount("open_shop_amount", "openShopAmount", "BIGINT", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
isValid("is_valid", "isValid", "BIT", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
}
}
\ No newline at end of file
package com.wwdz.ch.db.impl.openShop;
import com.wwdz.ch.db.dao.openShop.OpenShopCostConfigDao;
import com.wwdz.ch.db.domain.openShop.OpenShopCostConfig;
import com.wwdz.ch.db.domain.openShop.OpenShopCostConfigExample;
import com.wwdz.ch.db.mapper.openShop.OpenShopCostConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class OpenShopCostConfigDaoImpl implements OpenShopCostConfigDao {
@Autowired
OpenShopCostConfigMapper openShopCostConfigMapper;
@Override
public OpenShopCostConfig findOne() {
OpenShopCostConfigExample example = new OpenShopCostConfigExample();
OpenShopCostConfigExample.Criteria criteria = example.createCriteria();
criteria.andIsValidEqualTo(true);
return openShopCostConfigMapper.selectOneByExample(example);
}
}
package com.wwdz.ch.db.mapper.openShop;
import com.wwdz.ch.db.domain.openShop.OpenShopCostConfig;
import com.wwdz.ch.db.domain.openShop.OpenShopCostConfigExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface OpenShopCostConfigMapper {
long countByExample(OpenShopCostConfigExample example);
int deleteByExample(OpenShopCostConfigExample example);
int deleteByPrimaryKey(Integer id);
int insert(OpenShopCostConfig record);
int insertSelective(OpenShopCostConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
OpenShopCostConfig selectOneByExample(OpenShopCostConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
OpenShopCostConfig selectOneByExampleSelective(@Param("example") OpenShopCostConfigExample example, @Param("selective") OpenShopCostConfig.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<OpenShopCostConfig> selectByExampleSelective(@Param("example") OpenShopCostConfigExample example, @Param("selective") OpenShopCostConfig.Column ... selective);
List<OpenShopCostConfig> selectByExample(OpenShopCostConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table open_shop_cost_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
OpenShopCostConfig selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") OpenShopCostConfig.Column ... selective);
OpenShopCostConfig selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") OpenShopCostConfig record, @Param("example") OpenShopCostConfigExample example);
int updateByExample(@Param("record") OpenShopCostConfig record, @Param("example") OpenShopCostConfigExample example);
int updateByPrimaryKeySelective(OpenShopCostConfig record);
int updateByPrimaryKey(OpenShopCostConfig record);
}
\ No newline at end of file
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.openShop"
targetProject="ch-dao/src/main/java"/>
<table tableName="guarantee_money_record" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="open_shop_cost_config" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
......@@ -14,11 +14,13 @@ import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.dao.distribution.UserBankCardDao;
import com.wwdz.ch.db.dao.openShop.GuaranteeMoneyRecordDao;
import com.wwdz.ch.db.dao.openShop.OpenShopApplyOrderDao;
import com.wwdz.ch.db.dao.openShop.OpenShopCostConfigDao;
import com.wwdz.ch.db.dao.openShop.OpenShopCostRecordDao;
import com.wwdz.ch.db.domain.CollectorWhiteList;
import com.wwdz.ch.db.domain.distribution.UserBankCard;
import com.wwdz.ch.db.domain.openShop.GuaranteeMoneyRecord;
import com.wwdz.ch.db.domain.openShop.OpenShopApplyOrder;
import com.wwdz.ch.db.domain.openShop.OpenShopCostConfig;
import com.wwdz.ch.db.domain.openShop.OpenShopCostRecord;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import com.wwdz.ch.db.dto.request.openShop.GuaranteeMoneyRecordRequestDto;
......@@ -68,6 +70,9 @@ public class OpenShopServiceImpl implements OpenShopService {
@Autowired
UserBankCardDao userBankCardDao;
@Autowired
OpenShopCostConfigDao openShopCostConfigDao;
@Override
public Result checkAbleToOpenShop(OpenShopInfoRequestDto dto) {
try {
......@@ -94,8 +99,9 @@ public class OpenShopServiceImpl implements OpenShopService {
public Result createOpenShopApplyOrder(OpenShopInfoRequestDto dto) {
try {
Date now = new Date();
OpenShopCostConfig openShopCostConfig = openShopCostConfigDao.findOne();
//月底修改为300
long openShopAmount = 1L;
long openShopAmount = openShopCostConfig.getOpenShopAmount();
//创建申请单
String orderId = IdUtils.getOrderNumber("OA");
OpenShopApplyOrder openShopApplyOrder = new OpenShopApplyOrder();
......@@ -219,12 +225,15 @@ public class OpenShopServiceImpl implements OpenShopService {
@Override
public Result findOpenShopApplyOrder(OpenShopApplyOrderRequestDto dto) {
try {
OpenShopApplyOrderVo openShopApplyOrderVo = new OpenShopApplyOrderVo();
long userId = dto.getUserId();
OpenShopApplyOrder openShopApplyOrder = openShopApplyOrderDao.findByUserId(userId);
if (openShopApplyOrder == null) {
return Result.success();
OpenShopCostConfig openShopCostConfig = openShopCostConfigDao.findOne();
long openShopAmount = openShopCostConfig.getOpenShopAmount();
openShopApplyOrderVo.setOpenShopAmount(String.valueOf(openShopAmount));
return Result.success(openShopApplyOrderVo);
}
OpenShopApplyOrderVo openShopApplyOrderVo = new OpenShopApplyOrderVo();
EntityMapper.copyAttribute(openShopApplyOrder, openShopApplyOrderVo);
openShopApplyOrderVo.setStateName(OpenShopApplyOrderEnum.StateEnum.getNameByCode(openShopApplyOrderVo.getState()));
......
......@@ -89,12 +89,12 @@ public class WxPayServiceTest {
@Test
public void refund() {
List<String> list = Arrays.asList("DA2410182000468846189");
List<String> list = Arrays.asList("OSC2410301513339847057", "OSC2410301635131217582");
list.forEach(orderId ->{
DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId);
dto.setAmount("186");
dto.setRefundPrice("186");
dto.setAmount("100");
dto.setRefundPrice("100");
Result result = wxPayServiceApi.refund(dto);
logger.info("申请微信支付退款:{}", result);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment