解决多用户对同一机构同一护理单元进行绑定缴费都能成功问题
This commit is contained in:
parent
7aa9bd5aa1
commit
ee9a03cf7f
|
|
@ -6,6 +6,7 @@ import com.google.common.collect.Maps;
|
|||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.nu.dto.NuBaseElderMQDto;
|
||||
import com.nu.entity.NuBaseInfoEntity;
|
||||
import com.nu.entity.NuBillEntity;
|
||||
import com.nu.entity.PayParamEntity;
|
||||
import com.nu.entity.WechatpayConfigEntity;
|
||||
|
|
@ -20,6 +21,7 @@ import com.nu.utils.WeChatPayUtils;
|
|||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
|
|
@ -73,8 +75,7 @@ public class WeChatPayApi {
|
|||
* 绑定护理单元支付
|
||||
*/
|
||||
@PostMapping("/nuBindPay")
|
||||
public Map<String, String> nativePay(@Valid @RequestBody PayParamEntity params) throws Exception {
|
||||
|
||||
public Map<String, String> nativePay(@Valid @RequestBody PayParamEntity params) {
|
||||
//准备各种数据
|
||||
//系统订单号+商户订单号(使用同一个,便于管理):年月日时分秒+毫秒值后六位+2位随机数
|
||||
String outTradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + String.valueOf(System.currentTimeMillis() % 1000000) + String.format("%02d", new Random().nextInt(100));
|
||||
|
|
@ -144,14 +145,27 @@ public class WeChatPayApi {
|
|||
|
||||
//如果是护理单元 验证是否已被绑定(停留在付款界面直至点击支付期间,可能已经有人更快已经付款绑定了此护理单元)
|
||||
{
|
||||
if (!nuBaseInfoApi.canBinding(nuId)) {
|
||||
String valiResult = nuBaseInfoApi.canBinding(nuId);
|
||||
if (StringUtils.isNotBlank(valiResult)) {
|
||||
//不可以支付
|
||||
SystemOrderApiEntity upDto = new SystemOrderApiEntity();
|
||||
upDto.setId(systemOrderApiEntity.getId());
|
||||
upDto.setOrderStatus("NU_HAS_BEEN_BOUND");//护理单元已被其它用户绑定
|
||||
upDto.setReceiptDescription("护理单元已被其它用户绑定。");//回执描述
|
||||
if ("yiShiYong".equals(valiResult)) {
|
||||
upDto.setReceiptDescription("护理单元已被其它用户绑定。");//回执描述
|
||||
}
|
||||
if ("bangDingJiaoFeiZhong".equals(valiResult)) {
|
||||
upDto.setReceiptDescription("其它用户正在绑定此护理单元,如需要继续绑定,请于一分钟后重新查询。");//回执描述
|
||||
}
|
||||
Map<String, String> resultMap = Maps.newHashMap();
|
||||
resultMap.put("nuFailType", "NU_HAS_BEEN_BOUND");
|
||||
return resultMap;
|
||||
} else {
|
||||
//可以支付 修改绑定护理单元的缴费状态
|
||||
NuBaseInfoEntity baseInfo = new NuBaseInfoEntity();
|
||||
baseInfo.setNuId(nuId);
|
||||
baseInfo.setIzBindPaying("Y");
|
||||
nuBaseInfoApi.updateByNuId(baseInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -199,6 +213,13 @@ public class WeChatPayApi {
|
|||
mqDto.setOrgCode(orderData.getOrgCode());
|
||||
rabbitMQUtil.sendToExchange("hldy.nubaseelder", "hldy.nubaseelder.bindnu", mqDto);
|
||||
}
|
||||
|
||||
//这里是绑定护理单元支付回调 无论是否支付成功
|
||||
//护理单元绑定缴费中置为N(没有人在绑定缴费中)
|
||||
NuBaseInfoEntity baseInfo = new NuBaseInfoEntity();
|
||||
baseInfo.setNuId(orderData.getNuId());
|
||||
baseInfo.setIzBindPaying("N");
|
||||
nuBaseInfoApi.updateByNuId(baseInfo);
|
||||
}
|
||||
Date now = new Date();
|
||||
systemOrderApiEntity.setNotifyCount(orderData.getNotifyCount() + 1);//回执次数
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class NuBaseInfoEntity implements Serializable {
|
|||
private List<HumidDeviceEntity> humidDeviceList;
|
||||
//长者信息
|
||||
private ElderInfoEntity elderInfo;
|
||||
|
||||
|
||||
private List<NuidPermissionEntity> permissionList;
|
||||
|
||||
private java.lang.String fzr;
|
||||
|
|
@ -105,6 +105,11 @@ public class NuBaseInfoEntity implements Serializable {
|
|||
// @ApiModelProperty(value = "负责人年龄")
|
||||
private java.lang.String fzrAge;
|
||||
|
||||
/**
|
||||
* 是否绑定护理单元支付中 Y支付中(有客户正在给护理单元充值) N没有人在绑定缴费(可以让用户绑定)
|
||||
*/
|
||||
private String izBindPaying;
|
||||
|
||||
private List<Map<String,String>> readList;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public interface INuBaseInfoApi {
|
|||
|
||||
List<NuBaseInfoEntity> queryByOpenId(String openId);
|
||||
|
||||
boolean canBinding(String nuId);
|
||||
String canBinding(String nuId);
|
||||
|
||||
int izWarngin(NuBaseInfoEntity nuBaseInfoApiDto);
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,11 @@ public class NuBaseInfo implements Serializable {
|
|||
@ApiModelProperty(value = "负责人年龄")
|
||||
private java.lang.String fzrAge;
|
||||
|
||||
/**
|
||||
* 是否绑定护理单元支付中 Y支付中(有客户正在给护理单元充值) N没有人在绑定缴费(可以让用户绑定)
|
||||
*/
|
||||
private String izBindPaying;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String deviceId;//摄像头 ID
|
||||
@TableField(exist = false)
|
||||
|
|
|
|||
|
|
@ -352,11 +352,17 @@ public class NuBaseInfoServiceImpl extends ServiceImpl<NuBaseInfoMapper, NuBaseI
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBinding(String nuId) {
|
||||
public String canBinding(String nuId) {
|
||||
QueryWrapper<NuBaseInfo> qw = new QueryWrapper<>();
|
||||
qw.eq("nu_id",nuId);
|
||||
NuBaseInfo nuBaseInfo = baseMapper.selectOne(qw);
|
||||
return "0".equals(nuBaseInfo.getStatus()) || "3".equals(nuBaseInfo.getStatus());
|
||||
if(!("0".equals(nuBaseInfo.getStatus()) || "3".equals(nuBaseInfo.getStatus()))){
|
||||
return "yiShiYong";//已使用
|
||||
}
|
||||
if("Y".equals(nuBaseInfo.getIzBindPaying())){
|
||||
return "bangDingJiaoFeiZhong";//绑定缴费中
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -82,4 +82,5 @@ public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDi
|
|||
List<ConfigServiceDirective> queryAndTranslate(@Param("existIds") String[] existIds);
|
||||
|
||||
ConfigServiceDirective queryTranslate(@Param("id") String id);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,13 +45,13 @@
|
|||
<result property="tagName" column="bodyTagName"/>
|
||||
</collection>
|
||||
|
||||
<collection property="emotionTagList" ofType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
|
||||
<collection property="emotionTagList"
|
||||
ofType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
|
||||
<id property="id" column="emotionTagId"/>
|
||||
<result property="tagName" column="emotionTagName"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="pageList" resultMap="ConfigServiceDirectiveResultMap" parameterType="map">
|
||||
SELECT
|
||||
c.id,
|
||||
|
|
@ -180,7 +180,8 @@
|
|||
<!-- 一级、二级、三级 ID 可根据需要添加 -->
|
||||
<collection property="bodyTagList" ofType="com.nu.modules.config.directivetag.body.entity.DirectiveBodyTag"
|
||||
select="getBodyTagsByDirective" column="id"/>
|
||||
<collection property="emotionTagList" ofType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag"
|
||||
<collection property="emotionTagList"
|
||||
ofType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag"
|
||||
select="getEmotionTagsByDirective" column="id"/>
|
||||
</resultMap>
|
||||
|
||||
|
|
@ -228,7 +229,8 @@
|
|||
WHERE dbt.directive_id = #{directiveId}
|
||||
</select>
|
||||
|
||||
<select id="getEmotionTagsByDirective" resultType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
|
||||
<select id="getEmotionTagsByDirective"
|
||||
resultType="com.nu.modules.config.directivetag.emotion.entity.DirectiveEmotionTag">
|
||||
SELECT et.id, et.tag_name, et.sort, et.iz_enabled
|
||||
FROM nu_config_emotion_tag et
|
||||
INNER JOIN nu_directive_emotion_tag det ON et.id = det.tag_id
|
||||
|
|
@ -264,15 +266,14 @@
|
|||
</select>
|
||||
|
||||
<select id="queryTranslate" resultType="com.nu.modules.config.servicedirective.entity.ConfigServiceDirective">
|
||||
select
|
||||
m.*,
|
||||
i.instruction_name as instructionName,
|
||||
c.category_name as categoryName,
|
||||
t.type_name as typeName
|
||||
select m.*,
|
||||
i.instruction_name as instructionName,
|
||||
c.category_name as categoryName,
|
||||
t.type_name as typeName
|
||||
from nu_config_service_directive m
|
||||
left join nu_config_service_instruction_tag i on m.instruction_tag_id = i.id
|
||||
left join nu_config_service_category c on m.category_id = c.id
|
||||
left join nu_config_service_type t on m.type_id = t.id
|
||||
left join nu_config_service_instruction_tag i on m.instruction_tag_id = i.id
|
||||
left join nu_config_service_category c on m.category_id = c.id
|
||||
left join nu_config_service_type t on m.type_id = t.id
|
||||
where m.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -78,4 +78,6 @@ public interface IConfigServiceDirectiveService extends IService<ConfigServiceDi
|
|||
String getOrgCodeBySyncCode(String syncCode);
|
||||
|
||||
ConfigServiceDirective queryTranslate(String id);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -813,4 +813,5 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
public ConfigServiceDirective queryTranslate(String id) {
|
||||
return baseMapper.queryTranslate(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue