parent
5d79371788
commit
92a9fb7482
@ -1,4 +1,7 @@
|
|||||||
package au.com.royalpay.payment.manage.activities.monsettledelay.core;
|
package au.com.royalpay.payment.manage.activities.monsettledelay.core;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
public interface ActMonDelaySettleService {
|
public interface ActMonDelaySettleService {
|
||||||
|
JSONObject getActNotice(JSONObject device);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,68 @@
|
|||||||
package au.com.royalpay.payment.manage.activities.monsettledelay.core.impls;
|
package au.com.royalpay.payment.manage.activities.monsettledelay.core.impls;
|
||||||
|
|
||||||
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService;
|
import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleMapper;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper;
|
||||||
|
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
|
||||||
|
import au.com.royalpay.payment.tools.device.DeviceSupport;
|
||||||
|
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
|
public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService{
|
||||||
|
@Resource
|
||||||
|
private ActMonDelaySettleRedPackMapper actMonDelaySettleRedPackMapper;
|
||||||
|
@Resource
|
||||||
|
private ActMonDelaySettleMapper actMonDelaySettleMapper;
|
||||||
|
@Resource
|
||||||
|
private DeviceSupport deviceSupport;
|
||||||
|
@Resource
|
||||||
|
private ClientAccountMapper clientAccountMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getActNotice(JSONObject device){
|
||||||
|
String clientType = device.getString("client_type");
|
||||||
|
deviceSupport.findRegister(clientType);
|
||||||
|
int client_id = device.getIntValue("client_id");
|
||||||
|
// JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
||||||
|
// if (device.getIntValue("client_id") != account.getIntValue("client_id") || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) {
|
||||||
|
// throw new ForbiddenException("You have no permission");
|
||||||
|
// }
|
||||||
|
// device.put("account_name",account.getString("display_name"));
|
||||||
|
// device.put("create_time",new Date());
|
||||||
|
// device.put("rate",new BigDecimal(12));
|
||||||
|
BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id);
|
||||||
|
JSONObject res = new JSONObject();
|
||||||
|
res.put("total_redpack",total_redpack);
|
||||||
|
res.put("des","你有一份奖励待领取");
|
||||||
|
res.put("url", PlatformEnvironment.getEnv().concatUrl("/act/mondelay/desc"));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getActDetail(JSONObject device){
|
||||||
|
String clientType = device.getString("client_type");
|
||||||
|
deviceSupport.findRegister(clientType);
|
||||||
|
int client_id = device.getIntValue("client_id");
|
||||||
|
List<JSONObject> clientLogs = actMonDelaySettleMapper.clientLog(client_id);
|
||||||
|
JSONObject res = new JSONObject();
|
||||||
|
Boolean apply = false;
|
||||||
|
if (!clientLogs.isEmpty() && clientLogs.size()>0){
|
||||||
|
apply = true;
|
||||||
|
}
|
||||||
|
BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id);
|
||||||
|
PageList<JSONObject> list = actMonDelaySettleRedPackMapper.listRedpacks(client_id,new PageBounds(Order.formString("send_time")));
|
||||||
|
res.put("apply",apply);
|
||||||
|
res.put("total_redpack",total_redpack);
|
||||||
|
res.put("list",list);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
package au.com.royalpay.payment.manage.mappers.act;
|
package au.com.royalpay.payment.manage.mappers.act;
|
||||||
|
|
||||||
|
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
|
||||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@AutoMapper(tablename = "act_mon_delay_settle", pkName = "id")
|
@AutoMapper(tablename = "act_mon_delay_settle", pkName = "id")
|
||||||
public interface ActMonDelaySettleMapper {
|
public interface ActMonDelaySettleMapper {
|
||||||
@AutoSql(type = SqlType.INSERT)
|
@AutoSql(type = SqlType.INSERT)
|
||||||
void save(JSONObject dietOrderInfo);
|
void save(JSONObject dietOrderInfo);
|
||||||
|
|
||||||
|
@AutoSql(type = SqlType.SELECT)
|
||||||
|
@AdvanceSelect(addonWhereClause = "is_valid=1")
|
||||||
|
List<JSONObject> clientLog (@Param("client_id") int client_id);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
<?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="au.com.royalpay.payment.manage.mappers.act.ActMonDelaySettleRedPackMapper">
|
||||||
|
<select id="getTotalRedPack" resultType="java.math.BigDecimal">
|
||||||
|
|
||||||
|
SELECT sum(redpack_amount)
|
||||||
|
FROM act_mon_delay_settle_redpack where client_id=#{client_id}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in new issue