diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/ActMonDelaySettleService.java b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/ActMonDelaySettleService.java index ca686229c..0f2217c10 100644 --- a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/ActMonDelaySettleService.java +++ b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/ActMonDelaySettleService.java @@ -1,4 +1,7 @@ package au.com.royalpay.payment.manage.activities.monsettledelay.core; +import com.alibaba.fastjson.JSONObject; + public interface ActMonDelaySettleService { + JSONObject getActNotice(JSONObject device); } diff --git a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleServiceImp.java index ba44a5df7..67810a92b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/activities/monsettledelay/core/impls/ActMonDelaySettleServiceImp.java @@ -1,9 +1,68 @@ 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.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 javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.List; + @Service 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 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 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; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.java index a1ea0f777..716c74eda 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleMapper.java @@ -1,12 +1,20 @@ 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.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + +import java.util.List; @AutoMapper(tablename = "act_mon_delay_settle", pkName = "id") public interface ActMonDelaySettleMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject dietOrderInfo); + + @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1") + List clientLog (@Param("client_id") int client_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.java index 3dce216c3..39fc5fc48 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.java @@ -4,9 +4,19 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; @AutoMapper(tablename = "act_mon_delay_settle_redpack", pkName = "id") public interface ActMonDelaySettleRedPackMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject dietOrderInfo); + + BigDecimal getTotalRedPack(int client_id); + + @AutoSql(type = SqlType.SELECT) + PageList listRedpacks(@Param("client_id") int client_id, PageBounds pagination); } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.xml new file mode 100644 index 000000000..ac1cf8a4e --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActMonDelaySettleRedPackMapper.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file