收银点

This commit is contained in:
19991905653 2024-02-29 09:01:39 +08:00
parent 6c77bdecbd
commit 1beb292d28
9 changed files with 560 additions and 1 deletions

View File

@ -31,4 +31,6 @@ public interface TbPlussMerchantBaseInfoMapper {
TbPlussMerchantBaseInfo selectByMerchantcode(String merchantcode);
List<MerchantCashVO> selectByMasterMerchantCode();
List<TbPlussMerchantBaseInfo> selectListByCode(@Param("merchantcode") String merchantcode);
}

View File

@ -66,4 +66,6 @@ public interface TbPlussMerchantChannelStatusMapper {
TbPlussMerchantChannelStatus selectByChannelAndmerchantCodeAndStatus(@Param("channel") String channel,@Param("merchantCode") String merchantCode);
int selectAllCount(@Param("status") String status,@Param("merchantcode") String merchantcode);
}

View File

@ -0,0 +1,17 @@
package com.chaozhanggui.dao.system.dao;
import com.chaozhanggui.dao.system.entity.TbPlussUserCashPlace;
public interface TbPlussUserCashPlaceMapper {
int deleteByPrimaryKey(Integer id);
int insert(TbPlussUserCashPlace record);
int insertSelective(TbPlussUserCashPlace record);
TbPlussUserCashPlace selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(TbPlussUserCashPlace record);
int updateByPrimaryKey(TbPlussUserCashPlace record);
}

View File

@ -0,0 +1,108 @@
package com.chaozhanggui.dao.system.entity;
import java.io.Serializable;
import java.util.Date;
public class TbPlussUserCashPlace implements Serializable {
private Integer id;
private Integer userId;
private Integer merchantId;
private String isRootAccount;
private String remark;
private String orgCode;
private Integer rootAccountId;
private Integer chasplaceId;
private Date createtime;
private Date updatetime;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getMerchantId() {
return merchantId;
}
public void setMerchantId(Integer merchantId) {
this.merchantId = merchantId;
}
public String getIsRootAccount() {
return isRootAccount;
}
public void setIsRootAccount(String isRootAccount) {
this.isRootAccount = isRootAccount == null ? null : isRootAccount.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode == null ? null : orgCode.trim();
}
public Integer getRootAccountId() {
return rootAccountId;
}
public void setRootAccountId(Integer rootAccountId) {
this.rootAccountId = rootAccountId;
}
public Integer getChasplaceId() {
return chasplaceId;
}
public void setChasplaceId(Integer chasplaceId) {
this.chasplaceId = chasplaceId;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
}

View File

@ -635,5 +635,8 @@
WHERE
a.masterMerchantCode IS NOT NULL AND a.masterMerchantCode <![CDATA[ <> ]]>''
</select>
<select id="selectListByCode" resultType="com.chaozhanggui.dao.system.entity.TbPlussMerchantBaseInfo">
select <include refid="Base_Column_List" /> from tb_pluss_merchant_base_info where merchantCode = #{merchantcode}
</select>
</mapper>

View File

@ -1,6 +1,201 @@
<?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.chaozhanggui.dao.system.dao.TbPlussMerchantCashPlaceMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussMerchantCashPlace">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="logo" jdbcType="VARCHAR" property="logo" />
<result column="userId" jdbcType="INTEGER" property="userid" />
<result column="bindingCode" jdbcType="VARCHAR" property="bindingcode" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
<result column="root_account_id" jdbcType="INTEGER" property="rootAccountId" />
<result column="merchant_code" jdbcType="VARCHAR" property="merchantCode" />
<result column="pay_passage_id" jdbcType="INTEGER" property="payPassageId" />
<result column="pay_passage_name" jdbcType="VARCHAR" property="payPassageName" />
</resultMap>
<sql id="Base_Column_List">
id, logo, userId, bindingCode, name, code, address, remark, createTime, updateTime,
root_account_id, merchant_code, pay_passage_id, pay_passage_name
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_pluss_merchant_cash_place
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_pluss_merchant_cash_place
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantCashPlace">
insert into tb_pluss_merchant_cash_place (id, logo, userId,
bindingCode, name, code,
address, remark, createTime,
updateTime, root_account_id, merchant_code,
pay_passage_id, pay_passage_name)
values (#{id,jdbcType=INTEGER}, #{logo,jdbcType=VARCHAR}, #{userid,jdbcType=INTEGER},
#{bindingcode,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{address,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP},
#{updatetime,jdbcType=TIMESTAMP}, #{rootAccountId,jdbcType=INTEGER}, #{merchantCode,jdbcType=VARCHAR},
#{payPassageId,jdbcType=INTEGER}, #{payPassageName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantCashPlace">
insert into tb_pluss_merchant_cash_place
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="logo != null">
logo,
</if>
<if test="userid != null">
userId,
</if>
<if test="bindingcode != null">
bindingCode,
</if>
<if test="name != null">
name,
</if>
<if test="code != null">
code,
</if>
<if test="address != null">
address,
</if>
<if test="remark != null">
remark,
</if>
<if test="createtime != null">
createTime,
</if>
<if test="updatetime != null">
updateTime,
</if>
<if test="rootAccountId != null">
root_account_id,
</if>
<if test="merchantCode != null">
merchant_code,
</if>
<if test="payPassageId != null">
pay_passage_id,
</if>
<if test="payPassageName != null">
pay_passage_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="logo != null">
#{logo,jdbcType=VARCHAR},
</if>
<if test="userid != null">
#{userid,jdbcType=INTEGER},
</if>
<if test="bindingcode != null">
#{bindingcode,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
<if test="updatetime != null">
#{updatetime,jdbcType=TIMESTAMP},
</if>
<if test="rootAccountId != null">
#{rootAccountId,jdbcType=INTEGER},
</if>
<if test="merchantCode != null">
#{merchantCode,jdbcType=VARCHAR},
</if>
<if test="payPassageId != null">
#{payPassageId,jdbcType=INTEGER},
</if>
<if test="payPassageName != null">
#{payPassageName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantCashPlace">
update tb_pluss_merchant_cash_place
<set>
<if test="logo != null">
logo = #{logo,jdbcType=VARCHAR},
</if>
<if test="userid != null">
userId = #{userid,jdbcType=INTEGER},
</if>
<if test="bindingcode != null">
bindingCode = #{bindingcode,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createtime != null">
createTime = #{createtime,jdbcType=TIMESTAMP},
</if>
<if test="updatetime != null">
updateTime = #{updatetime,jdbcType=TIMESTAMP},
</if>
<if test="rootAccountId != null">
root_account_id = #{rootAccountId,jdbcType=INTEGER},
</if>
<if test="merchantCode != null">
merchant_code = #{merchantCode,jdbcType=VARCHAR},
</if>
<if test="payPassageId != null">
pay_passage_id = #{payPassageId,jdbcType=INTEGER},
</if>
<if test="payPassageName != null">
pay_passage_name = #{payPassageName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantCashPlace">
update tb_pluss_merchant_cash_place
set logo = #{logo,jdbcType=VARCHAR},
userId = #{userid,jdbcType=INTEGER},
bindingCode = #{bindingcode,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
createTime = #{createtime,jdbcType=TIMESTAMP},
updateTime = #{updatetime,jdbcType=TIMESTAMP},
root_account_id = #{rootAccountId,jdbcType=INTEGER},
merchant_code = #{merchantCode,jdbcType=VARCHAR},
pay_passage_id = #{payPassageId,jdbcType=INTEGER},
pay_passage_name = #{payPassageName,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussMerchantCashPlace">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="logo" jdbcType="VARCHAR" property="logo" />

View File

@ -582,4 +582,7 @@
WHERE merchantCode = #{merchantCode}
AND status <![CDATA[ <> ]]> 1
</select>
<select id="selectAllCount" resultType="java.lang.Integer">
select count(*) from tb_pluss_merchant_channel_status where status = #{status} and merchantCode = #{merchantcode}
</select>
</mapper>

View File

@ -0,0 +1,153 @@
<?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.chaozhanggui.dao.system.dao.TbPlussUserCashPlaceMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussUserCashPlace">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="merchant_id" jdbcType="INTEGER" property="merchantId" />
<result column="is_root_account" jdbcType="VARCHAR" property="isRootAccount" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="root_account_id" jdbcType="INTEGER" property="rootAccountId" />
<result column="chasplace_id" jdbcType="INTEGER" property="chasplaceId" />
<result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, merchant_id, is_root_account, remark, org_code, root_account_id, chasplace_id,
createTime, updateTime
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_pluss_user_cash_place
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_pluss_user_cash_place
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussUserCashPlace">
insert into tb_pluss_user_cash_place (id, user_id, merchant_id,
is_root_account, remark, org_code,
root_account_id, chasplace_id, createTime,
updateTime)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{merchantId,jdbcType=INTEGER},
#{isRootAccount,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{orgCode,jdbcType=VARCHAR},
#{rootAccountId,jdbcType=INTEGER}, #{chasplaceId,jdbcType=INTEGER}, #{createtime,jdbcType=TIMESTAMP},
#{updatetime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussUserCashPlace">
insert into tb_pluss_user_cash_place
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="merchantId != null">
merchant_id,
</if>
<if test="isRootAccount != null">
is_root_account,
</if>
<if test="remark != null">
remark,
</if>
<if test="orgCode != null">
org_code,
</if>
<if test="rootAccountId != null">
root_account_id,
</if>
<if test="chasplaceId != null">
chasplace_id,
</if>
<if test="createtime != null">
createTime,
</if>
<if test="updatetime != null">
updateTime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="merchantId != null">
#{merchantId,jdbcType=INTEGER},
</if>
<if test="isRootAccount != null">
#{isRootAccount,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="orgCode != null">
#{orgCode,jdbcType=VARCHAR},
</if>
<if test="rootAccountId != null">
#{rootAccountId,jdbcType=INTEGER},
</if>
<if test="chasplaceId != null">
#{chasplaceId,jdbcType=INTEGER},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
<if test="updatetime != null">
#{updatetime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussUserCashPlace">
update tb_pluss_user_cash_place
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="merchantId != null">
merchant_id = #{merchantId,jdbcType=INTEGER},
</if>
<if test="isRootAccount != null">
is_root_account = #{isRootAccount,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="orgCode != null">
org_code = #{orgCode,jdbcType=VARCHAR},
</if>
<if test="rootAccountId != null">
root_account_id = #{rootAccountId,jdbcType=INTEGER},
</if>
<if test="chasplaceId != null">
chasplace_id = #{chasplaceId,jdbcType=INTEGER},
</if>
<if test="createtime != null">
createTime = #{createtime,jdbcType=TIMESTAMP},
</if>
<if test="updatetime != null">
updateTime = #{updatetime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussUserCashPlace">
update tb_pluss_user_cash_place
set user_id = #{userId,jdbcType=INTEGER},
merchant_id = #{merchantId,jdbcType=INTEGER},
is_root_account = #{isRootAccount,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
org_code = #{orgCode,jdbcType=VARCHAR},
root_account_id = #{rootAccountId,jdbcType=INTEGER},
chasplace_id = #{chasplaceId,jdbcType=INTEGER},
createTime = #{createtime,jdbcType=TIMESTAMP},
updateTime = #{updatetime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -3,8 +3,10 @@ package com.chaozhanggui.merchant.service;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.hutool.system.UserInfo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chaozhanggui.common.system.config.MsgException;
import com.chaozhanggui.dao.system.dao.*;
import com.chaozhanggui.dao.system.entity.*;
@ -1766,7 +1768,8 @@ public class HfMerService {
}
@Autowired
TbPlussMerchantCashPlaceMapper merchantCashPlaceMapper;
@Autowired
TbPlussAccountMapper tbPlussAccountMapper;
@Autowired
@ -1780,6 +1783,8 @@ public class HfMerService {
@Autowired
TbPlussMerchantHfInfoMapper tbPlussMerchantHfInfoMapper;
@Autowired
TbPlussMerchantChannelMapper plussMerchantChannelMapper;
@Autowired
TbPlussMccReflectMapper tbPlussMccReflectMapper;
@Autowired
TbPlussMccInfoHfMapper tbPlussMccInfoHfMapper;
@ -1797,6 +1802,10 @@ public class HfMerService {
RestTemplate restTemplate;
@Autowired
TbPlussUserInfoMapper tbPlussUserInfoMapper;
@Autowired
TbPlussUserCashPlaceMapper userCashPlaceMapper;
@Autowired
TbPlussMerchantBaseInfoMapper merchantBaseInfoMapper;
@Value("${hf.account.backUrl}")
private String backUrl;
@Value("${hf.account.wxLite.appId}")
@ -2461,6 +2470,11 @@ public class HfMerService {
if (ObjectUtil.isNotEmpty(baseInfo)) {
merchantResident(baseInfo, tbPlussMerchantHfInfo.getLiveApiKey(), tbPlussMerchantHfInfo.getAppId(), tbPlussMerchantHfInfo);
}
try {
addCash(channelStatus,7);
}catch (Exception e){
log.info("addCash Fail:"+e.getMessage());
}
}
}
}
@ -2512,6 +2526,68 @@ public class HfMerService {
}
private void addCash(TbPlussMerchantChannelStatus mcs, int channl) {
int num = tbPlussMerchantChannelStatusMapper.selectAllCount("3",mcs.getMerchantcode());
if (num < 2) {
List<TbPlussMerchantBaseInfo> list = merchantBaseInfoMapper.selectListByCode( mcs.getMerchantcode());
if (list.size() > 0) {
TbPlussMerchantBaseInfo merchantBaseInfo = list.iterator().next();
TbPlussMerchantCashPlace merchantCashPlace = new TbPlussMerchantCashPlace();
merchantCashPlace.setAddress(merchantBaseInfo.getAddress());
merchantCashPlace.setUserid(merchantBaseInfo.getUserid());
merchantCashPlace.setName("收银点一");
merchantCashPlace.setPayPassageId(channl);
TbPlussMerchantChannel merchantChannel = plussMerchantChannelMapper.selectByPrimaryKey(channl);
if (Objects.nonNull(merchantChannel)){
merchantCashPlace.setPayPassageName(merchantChannel.getChannelname());
}
merchantCashPlace.setCreatetime(new Date());
merchantCashPlace.setName(merchantBaseInfo.getAlias());
merchantCashPlace.setRootAccountId(merchantBaseInfo.getUserid());
merchantCashPlace.setCode(getCode());
merchantCashPlaceMapper.insert(merchantCashPlace);
TbPlussUserInfo userInfo = tbPlussUserInfoMapper.selectByPrimaryKey(Long.valueOf(merchantBaseInfo.getUserid()));
TbPlussUserCashPlace childUserCashPlace = new TbPlussUserCashPlace();
childUserCashPlace.setChasplaceId(merchantCashPlace.getId());
childUserCashPlace.setCreatetime(new Date());
childUserCashPlace.setIsRootAccount("true");
childUserCashPlace.setOrgCode(userInfo.getLoginname());
childUserCashPlace.setRootAccountId(userInfo.getId().intValue());
childUserCashPlace.setUserId(userInfo.getId().intValue());
userCashPlaceMapper.insert(childUserCashPlace);
}
}
}
public String getCode(){
String randomDigits = generateRandomDigits(2);
String randomLetters = generateRandomLetters(6);
String randomString = randomDigits + randomLetters;
return randomString;
}
// 生成n位随机数字
private static String generateRandomDigits(int n) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
int digit = random.nextInt(10);
sb.append(digit);
}
return sb.toString();
}
private static String generateRandomLetters(int n) {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
char letter = (char) (random.nextInt(26) + 'A');
sb.append(letter);
}
return sb.toString();
}
public void authInfo(String requestId) {
TbPlussMerchantAuditRecord record = tbPlussMerchantAuditRecordMapper.selectByApplicationid(requestId);
if (ObjectUtil.isNotEmpty(record)) {