wangbeiyong@zhaoonline.com

提货时候,余额足够就扣否则不扣

......@@ -279,7 +279,6 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<version>2.5</version>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
......
......@@ -52,7 +52,7 @@ public class UserKitingAction {
clientName = "*" + clientName.substring(1);
bank.put("CLIENT_NAME", clientName);
model.addAttribute("bank", bank);
model.addAttribute("balance", fundBiz.balance(userId));
model.addAttribute("balance", fundBiz.balanceSelf(userId));
if (StringUtil.isBlank(params.get("_limit"))) {
params.put("_limit", 10);
......
......@@ -38,7 +38,7 @@ public class PositionAction {
/**持仓列表*/
@RequestMapping("position")
public String position(Model model) {
T2Result result = positionBiz.position(ActionUtil.getUser());
T2Result result = positionBiz.positionSelf(ActionUtil.getUser());
model.addAttribute("positions", result.getData());
return "user/pick/position.jsp";
}
......
......@@ -38,6 +38,23 @@ public class CommonBiz {
@Value("${${env}.pnr.pbKey}")
private String pbKey;
public boolean checkTime(boolean checkDate, int beginTimeId, int endTimeId) { if (checkDate) {
Map params = new HashMap();
params.put("function_id", "619824");
T2Result queryResult = T2Util.request(params, "619824");
if ("0".equals(((Map)queryResult.getData().get(0)).get("business_flag"))) {
return false;
}
}
int nowtime = Integer.parseInt(DateUtil.getNow(DateEnum.UNSIGNED_TIME));
String beginTime = this.sysParamValue.getValueById(beginTimeId);
String endTime = this.sysParamValue.getValueById(endTimeId);
boolean flag = (Integer.parseInt(beginTime) <= nowtime) && (
Integer.parseInt(endTime) >= nowtime);
return flag;
}
/**
* 检查开户时间
*
......
......@@ -15,7 +15,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import com.cjs.site.dao.pub.SysConfigDao;
import com.cjs.site.dao.user.fund.FundRealDao;
import com.cjs.site.dao.user.fund.OtcEntrustUsefulDao;
import com.cjs.site.dao.user.fund.UserKitingDao;
import com.cjs.site.dao.user.ration.RationNewFundDao;
import com.cjs.site.model.pub.SysConfigInfo;
import com.cjs.site.model.user.account.UserInfo;
......@@ -44,6 +46,8 @@ public class FundBiz {
private RationNewFundDao rationNewFundDao;
@Autowired
private OtcEntrustUsefulDao usefulDao;
@Autowired
private FundRealDao fundRealDao;
/**
* 余额查询
......@@ -61,6 +65,13 @@ public class FundBiz {
}
/**
* 余额查询
*/
public Map<String, Double> balanceSelf(String userId) {
return fundRealDao.getUserBalance(userId);
}
/**
* 冻结用户资金
*
* @param fundAccount 会员号
......@@ -281,6 +292,81 @@ public class FundBiz {
return funds;
}
public List<Map<String, Object>> fundRecordNew(Map<String, Object> params, UserInfo userInfo)
{
String startDate = StringUtil.castString(params.get("start_date"));
String endDate = StringUtil.castString(params.get("end_date"));
if (StringUtils.isBlank(startDate))
startDate = DateUtil.parseDate(new Date(), DateEnum.UNSIGNED_DATE);
else {
startDate = startDate.replace("-", "");
}
params.put("start_date", startDate);
if (StringUtils.isBlank(endDate))
endDate = DateUtil.parseDate(new Date(), DateEnum.UNSIGNED_DATE);
else {
endDate = endDate.replace("-", "");
}
params.put("end_date", endDate);
int businessFlag = 0;
if (!StringUtil.isBlank(params.get("en_business_flag"))) {
businessFlag = Integer.parseInt(params.get("en_business_flag").toString());
switch (businessFlag) {
case 1:
params.put("remark", "客户提现");
params.put("en_business_flag", "2516");
break;
case 2:
params.put("remark", "入金调增");
params.put("en_business_flag", "2515");
break;
default:
businessFlag = 0;
}
}
params.put("fundAccount", ActionUtil.getUser().getFund_account());
List<Map<String, Object>> funds = this.fundRealDao.queryFundRecord(params);
params.put("_total", Integer.valueOf(this.fundRealDao.queryFundRecordTotal(params)));
for (Map map : funds) {
map.put("PARENT_CODE", "2000");
SysConfigInfo sysConfigInfo = this.sysConfigDao.queryByCondition(map);
map.put("BUSINESS_FLAG", sysConfigInfo.getSysValue());
if ("存管资金红冲".equals(map.get("BUSINESS_FLAG").toString())) {
if (map.get("REMARK").toString().indexOf("客户提现") >= 0)
map.put("BUSINESS_FLAG", "客户提现");
}
else if (("存管资金蓝补".equals(map.get("BUSINESS_FLAG").toString())) &&
(map.get("REMARK").toString().indexOf("入金调增") >= 0)) {
map.put("BUSINESS_FLAG", "客户入金");
}
String initDate = DateUtil.parseDate(
DateUtil.parseDate(map.get("INIT_DATE").toString(), DateEnum.UNSIGNED_DATE),
DateEnum.DATE);
map.put("CURR_DATE_TIME", initDate);
}
if (businessFlag != 0) {
params.put("en_business_flag", Integer.valueOf(businessFlag));
}
startDate = DateUtil.parseDate(DateUtil.parseDate(startDate, DateEnum.UNSIGNED_DATE),
DateEnum.DATE);
endDate = DateUtil.parseDate(DateUtil.parseDate(endDate, DateEnum.UNSIGNED_DATE),
DateEnum.DATE);
params.put("start_date", startDate);
params.put("end_date", endDate);
return funds;
}
private List<Map<String, Object>> processFund(List<Map<String, Object>> funds) {
List<SysConfigInfo> configs = sysConfigDao.queryByParentCode("2000");
for (Map<String, Object> fund : funds) {
......
......@@ -60,12 +60,12 @@ public class UserKitingBiz {
public String kiting(String subBranch, Double amount, String validCode, HttpSession session) {
UserInfo userInfo = ActionUtil.getUser();
String userId = userInfo.getClient_id();
if (!commonBiz.checkKitingTime()) {
String beginTime = DateUtil.parseDate(DateUtil
.parseDate(sysParamDao.getParamValue("begin_time_fund"), DateEnum.UNSIGNED_TIME),
if (!this.commonBiz.checkTime(true, 10, 11)) {
String beginTime = DateUtil.parseDate(
DateUtil.parseDate(this.sysParamDao.getParamValue("begin_time_fund"), DateEnum.UNSIGNED_TIME),
DateEnum.TIME);
String endTime = DateUtil.parseDate(DateUtil.parseDate(
sysParamDao.getParamValue("end_time_fund"), DateEnum.UNSIGNED_TIME), DateEnum.TIME);
this.sysParamDao.getParamValue("end_time_fund"), DateEnum.UNSIGNED_TIME), DateEnum.TIME);
return "请于交易日的" + beginTime + " - " + endTime + "进行提现操作。";
}
//验证短信验证码
......@@ -113,7 +113,8 @@ public class UserKitingBiz {
T2Result result = null;
String msg = "提现申请成功";
try {
result = T2Util.request(params, "202101");
// result = T2Util.request(params, "202101");
result = this.ducureFund(userId, amount);
} finally {
UserKitingInfo kitInfo = new UserKitingInfo();
kitInfo.setUserId(userId);
......@@ -121,7 +122,8 @@ public class UserKitingBiz {
kitInfo.setMobile(bankInfo.get("MOBILE_TEL").toString());
kitInfo.setBankName(bankInfo.get("OPEN_BANK_NAME").toString());
kitInfo.setBankNo(bankInfo.get("BANK_ACCOUNT").toString());
kitInfo.setProvinceCity(bankInfo.get("PROVINCE_NAME") + bankInfo.get("CITY_NAME"));
kitInfo.setProvince(bankInfo.get("PROVINCE_NAME"));
kitInfo.setCity(bankInfo.get("CITY_NAME"));
kitInfo.setSubBranch(subBranch);
amount *= -1;
kitInfo.setKitAmount(amount);
......@@ -150,6 +152,13 @@ public class UserKitingBiz {
return msg;
}
private T2Result ducureFund(String userId,Double amount){
T2Result result = new T2Result();
fundRealDao.freezeAmount(userId, Math.abs(amount));
result.setCode(0);
return result;
}
/**
* 查询用户提现列表
* @param params
......
......@@ -55,6 +55,21 @@ public class PositionBiz {
return T2Util.request(params, "619008");
}
public T2Result positionSelf(UserInfo userInfo){
List<PickPackInfo> list = pickPackDao.queryUserPosition(userInfo.getClient_id());
List<Map<String, Object>> t2 = new ArrayList<Map<String, Object>>();
for(PickPackInfo info :list){
Map<String, Object> map = new HashMap<String, Object>();
map.put("otc_code",info.getOtcCode());
map.put("otc_name",info.getOtcName());
map.put("enable_amount",info.getCurrentAmount());
t2.add(map);
}
T2Result t = new T2Result();
t.setData(t2);
return t;
}
/**持仓列表(封装)*/
public List<Map<String, Object>> packPosition(UserInfo userInfo) {
List<Map<String, Object>> positions = this.position(userInfo).getData();
......
package com.cjs.site.dao.pub;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
......@@ -19,4 +20,6 @@ public interface SysConfigDao {
SysConfigInfo queryBySysKey(String sysKey);
public SysConfigInfo queryByCondition(Map<String, Object> paramMap);
}
......
......@@ -15,4 +15,6 @@ public interface SysParamValueDao {
String getParamValue(String paramName);
Date getSysDate();
public String getValueById(int paramInt);
}
......
package com.cjs.site.dao.user.fund;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.cjs.site.util.db.OracleDao;
......@@ -18,4 +20,14 @@ public interface FundRealDao extends OracleDao {
/**查询指定客户资金*/
Map<String, Object> queryByUserId(String userId);
Map<String,Double> getUserBalance(String userId);
void freezeAmount(@Param("userId")String userId,@Param("amount")Double amount);
public List<Map<String, Object>> queryFundRecord(Map<String, Object> paramMap);
public int queryFundRecordTotal(Map<String, Object> paramMap);
}
......
package com.cjs.site.dao.user.pick;
import java.util.List;
import java.util.Map;
import com.cjs.site.model.user.pick.OutpropApplyInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.cjs.site.model.user.pick.PickPackInfo;
......@@ -20,4 +23,14 @@ public interface PickPackDao extends OracleDao {
List<PickPackInfo> queryAll();
PickPackInfo queryById(Integer id);
List<PickPackInfo> queryUserPosition(String userId);
Map<String,Object> queryUserFundAccount(String userId);
void ducueUserFundAmount(@Param("money") Double money,@Param("userId") String userId);
void ducueUserInventory(@Param("amount") Integer amount,@Param("otcCode") String otcCode,@Param("userId") String userId);
void insertPick(Map<String,Object> map);
}
......
......@@ -20,7 +20,8 @@ public class UserKitingInfo extends BaseInfo {
private String bankName;
private String bankNo;
private String subBranch; //支行名称
private String provinceCity;
private String province;
private String city;
private Double kitAmount; //提现金额
private Double kitFare;
private Double payableAmount;
......@@ -169,12 +170,21 @@ public class UserKitingInfo extends BaseInfo {
this.refuseBy = refuseBy;
}
public String getProvinceCity() {
return provinceCity;
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setProvinceCity(String provinceCity) {
this.provinceCity = provinceCity;
public void setCity(String city) {
this.city = city;
}
public String getSubBranch() {
......
......@@ -23,6 +23,20 @@ public class PickPackInfo extends BaseInfo {
private String createTime; //创建时间
private String createBy; //创建人
private int currentAmount;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public int getCurrentAmount() {
return currentAmount;
}
public void setCurrentAmount(int currentAmount) {
this.currentAmount = currentAmount;
}
public Integer getId() {
return id;
}
......
......@@ -2,6 +2,7 @@ package com.cjs.site.util.web;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
......@@ -9,6 +10,7 @@ import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.RandomUtils;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
......@@ -26,10 +28,13 @@ public class DesUtil {
public static void main(String[] args) throws Exception {
//String data = "{uid: \"80018500\", pwd: \"111111\"}";
String data = "111111";
String data = "v9OZqooWMhI=";
String key = "ZHAOYN_WEB_UP";
System.err.println(encrypt(data, key));
System.err.println(decrypt(data, key));
System.err.println(decrypt(encrypt(data, key), key));
Random ran=new Random();
long a=RandomUtils.nextLong(1, 10);
System.out.println(System.currentTimeMillis());
}
/**
......
env=test
env=prod
#===============================开发环境====================================
#jdbc
......@@ -79,6 +79,7 @@ prod.user.username=80018609
prod.user.password=111111
prod.host=http://www.zhao.com/
prod.redis.host=10.4.35.194
prod.redis.port=6379
#汇付接口参数
prod.pnr.operId=873497
prod.pnr.pbKey=PgPubk.key
......
......@@ -55,7 +55,7 @@
</AsyncLogger>
<!-- 全局配置,默认所有的Logger都继承此配置 -->
<AsyncRoot level="info">
<AsyncRoot level="debug">
<AppenderRef ref="console" />
<AppenderRef ref="rollingInfoFile" />
<AppenderRef ref="rollingErrorFile" />
......
......@@ -50,4 +50,13 @@
AND INSTR(remark, #{remark}) > 0
</if>
</select>
<select id="getUserBalance" resultType="java.util.HashMap">
select current_balance from hs_fund.fundreal a where a.client_id =#{userId}
</select>
<update id="freezeAmount">
update hs_fund.fundreal set current_balance =current_balance-#{amount},enable_balance=enable_balance-#{amount} ,frozen_balance=#{amount} where client_id = #{userId}
</update>
</mapper>
\ No newline at end of file
......
......@@ -22,4 +22,42 @@
WHERE ID = #{id}
</select>
<select id="queryUserPosition" parameterType="string" resultType="PickPackInfo">
select
a.otc_code as otcCode ,
d.otc_name AS otcName ,
a.current_amount as currentAmount
from hs_otc.otcstockreal a, hs_asset.clientinfo b, hs_asset.client c,hs_otc.otccode d
where a.client_id = b.client_id
and a.client_id = c.client_id
and a.otc_code=d.otc_code
and a.client_id = #{userId}
</select>
<select id="queryUserFundAccount" resultType="java.util.HashMap" parameterType="string" >
select current_balance from hs_fund.fundreal a where a.client_id =#{userId}
</select>
<update id="ducueUserFundAmount">
update hs_fund.fundreal set current_balance = current_balance-#{money} where client_id =#{userId}
</update>
<update id="ducueUserInventory">
update hs_otc.otcstockreal set current_amount = current_amount-#{amount} where client_id =#{userId} and otc_code=#{otcCode}
</update>
<insert id="insertPick" parameterType="java.util.HashMap">
insert into HS_ASSET.OUTPROPAPPLY(
OTC_CODE, OTC_NAME, OCCUR_AMOUNT, PICKING_DATE,
PHONE_CODE, PICKING_ADDRESS,REMARK, OP_STATION,
SDCPROPAPPLY_STATUS, EXPRESS_ADRESS,
INIT_DATE,PICKING_NAME,POSITION_STR
) values(
#{otcCode},#{otcName},#{occurAmount},#{pickDate},
#{phone,jdbcType=VARCHAR},#{pikingAddress,jdbcType=VARCHAR},'临时解决',#{opStation},
0,#{address,jdbcType=VARCHAR},#{initDate},#{pickName,jdbcType=VARCHAR},#{postionStr,jdbcType=VARCHAR}
)
</insert>
</mapper>
\ No newline at end of file
......
......@@ -69,8 +69,8 @@ var Position = function($) {
$("#btnNormalPick").val("确认提货")
}else{
for (var i = 0; i < occurAmounts.length; i++) {
$(occurAmounts[i]).val('')
$(occurAmounts[i]).removeAttr("disabled")
//$(occurAmounts[i]).val('')
//$(occurAmounts[i]).removeAttr("disabled")
}
$("#aaetip1").css('display','none')
$("#aaetip2").css('display','none')
......
......@@ -9,7 +9,7 @@
<p class="title">合作企业</p>
<p><a href="http://www.zhaoonline.com/">赵涌在线</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.hosane.com/">泓盛</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://www.ytgrading.com/">源泰评级</a><!-- &nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.zbd8.com/">召宝贷</a></p> -->
<p><a href="/trade/article?id=87&cid=30" class="title">关于我们</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/trade/article?id=108&cid=31" class="title">联系我们</a>&nbsp;&nbsp;&nbsp;&nbsp;
<p><!-- <a href="/trade/article?id=87&cid=30" class="title">关于我们</a>&nbsp;&nbsp;&nbsp;&nbsp; --><a href="/trade/article?id=108&cid=31" class="title">联系我们</a>&nbsp;&nbsp;&nbsp;&nbsp;
<!-- <a href="/trade/article?id=110&cid=32" class="title">诚聘英才</a>&nbsp;&nbsp;&nbsp;&nbsp; --><a href="/trade/article?id=89&cid=33" class="title">法律声明</a></p>
<!-- <p><a href="http://www.zhongyoubi.com/">中邮币</a></p> -->
</div>
......
......@@ -82,12 +82,12 @@
</c:if>
<td>
<div>
<a href="/ec/entrust/detail/${entrust.SDC_CODE}">
<a href="#">
<img src="${entrust.IMAGE }" height="95" width="140" />
</a>
</div>
<p style="text-align: left;">
<a href="/ec/entrust/detail/${entrust.SDC_CODE}">${entrust.SDC_NAME }</a>
<a href="#">${entrust.SDC_NAME }</a>
<span style="float: right;">
<c:if test="${entrust.PRICE == 0 }">--</c:if>
<c:if test="${entrust.PRICE > 0 }">
......
......@@ -78,7 +78,7 @@
<form id="kitingForm" action="${ctx }/user/kiting" method="post">
<p>
<label>可用余额:</label> <span><fmt:formatNumber type="number" maxFractionDigits="2" minFractionDigits="2" value="${balance.current_balance }" /></span>
<label>可用余额:</label> <span><fmt:formatNumber type="number" maxFractionDigits="2" minFractionDigits="2" value="${balance.CURRENT_BALANCE }" /></span>
</p>
<p>
<label>银行账户:</label> <span>${bank.BANK_ACCOUNT }(${bank.OPEN_BANK_NAME })${bank.CLIENT_NAME }</span>
......@@ -91,7 +91,7 @@
<p>
<label>提现金额:</label>
<input type="text" name="amount" placeholder="单笔提现不得少于10元" id="txtAmount" maxlength="8" />
<input type="text" name="amount" placeholder="单笔提现不得少于10元" id="txtAmount" maxlength="8" value="${balance.CURRENT_BALANCE }" readonly="readonly"/>
</p>
<p>
......
......@@ -59,10 +59,10 @@
<td class="left-font">${position.otc_name }</td>
<td><fmt:formatNumber pattern="#####" value="${position.enable_amount }" /></td>
<td>
<input type="number" name="occurAmount" min="1" maxlength="5"
<input type="number" name="occurAmount" min="1" maxlength="5" value="${position.enable_amount}" style="display: none"
onkeyup="this.value=this.value.replace(/\D/g,'')"
onafterpaste="this.value=this.value.replace(/\D/g,'')" />
<span style="display: none;">${position.enable_amount }</span>
<span>${position.enable_amount }</span>
</td>
</tr>
</c:if>
......