diff --git a/src/db/modify.sql b/src/db/modify.sql index 537a71eb7..b24bac50b 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -315,4 +315,22 @@ ADD COLUMN `globalpay_openid` varchar(100) NULL AFTER `kanga_openid`; ALTER TABLE act_app_list ADD banner_img VARCHAR(200) NULL COMMENT 'App首页banner图片'; + + +alter table act_app_list add column `msg_start_date` date DEFAULT NULL; +alter table act_app_list add column `msg_end_date` date DEFAULT NULL; +alter table act_app_list add column `msg_interval` smallint(3) DEFAULT NULL; + +alter table sys_clients add column `manual_settle` tinyint(1) DEFAULT 0; + + +create table log_clients_operation( +id varchar(50) not null, +client_id int(11) not null, +operator_id varchar(50) not null comment '操作人者 账户ID', +operator_type SMALLINT (2) not null comment '操作人者类型', +create_time datetime not null, +operation varchar(50) DEFAULT NULL, +PRIMARY key(`id`) +); alter table act_app_list MODIFY column is_show_window tinyint(1) DEFAULT 0 COMMENT 'app是否弹框' \ No newline at end of file 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 0d7342475..cabb285fe 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 @@ -4,9 +4,12 @@ import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelay import au.com.royalpay.payment.manage.mappers.act.ActAppMapper; 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.log.ClientsOperationLogMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; +import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.tools.device.DeviceSupport; import au.com.royalpay.payment.tools.env.PlatformEnvironment; +import au.com.royalpay.payment.tools.env.RequestEnvironment; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.permission.enums.PartnerRole; @@ -17,7 +20,9 @@ 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.context.MessageSource; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.math.BigDecimal; @@ -40,12 +45,15 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService { private ClientAccountMapper clientAccountMapper; @Resource private ActAppMapper actAppMapper; - + @Resource + private ClientsOperationLogMapper clientsOperationLogMapper; + @Resource + private ClientManager clientManager; + @Resource + private MessageSource messageSource; @Override public JSONObject getActNotice(JSONObject device) { - String clientType = device.getString("client_type"); - deviceSupport.findRegister(clientType); int client_id = device.getIntValue("client_id"); BigDecimal total_redpack = actMonDelaySettleRedPackMapper.getTotalRedPack(client_id); JSONObject res = new JSONObject(); @@ -62,15 +70,14 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService { if (!act.getBoolean("is_valid")) { throw new BadRequestException("Activity is not valid"); } - 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(); res.put("operation_pause",false); - Boolean apply = false; - if (!clientLogs.isEmpty()) { - apply = true; + Boolean apply = true; + if (clientLogs.isEmpty()) { + apply = false; + res.put("cancel_waring",messageSource.getMessage("sys.mondelay.cancel.waring", null, RequestEnvironment.getLocale())); } if (new Date().compareTo(act.getDate("active_date")) < 0) { res.put("active", false); @@ -92,10 +99,12 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService { res.put("apply", apply); res.put("total_redpack", total_redpack); res.put("list", list); + return res; } @Override + @Transactional public void actApply(JSONObject device) { LocalDateTime dt = LocalDateTime.now(); if(dt.getDayOfWeek()== DayOfWeek.MONDAY && dt.getHour()<18){ @@ -112,8 +121,6 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService { if (new Date().compareTo(act.getDate("expire_date")) > 0) { throw new BadRequestException("The activity has expired"); } - String clientType = device.getString("client_type"); - deviceSupport.findRegister(clientType); int client_id = device.getIntValue("client_id"); List clientLogs = actMonDelaySettleMapper.clientLog(client_id); if (!clientLogs.isEmpty()) { @@ -129,16 +136,19 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService { device.put("rate", params.getBigDecimal("rate") == null ? new BigDecimal(0.15) : params.getBigDecimal("rate")); device.put("expire_time", act.getDate("expire_date")); actMonDelaySettleMapper.save(device); + clientManager.changeManualSettle(client_id,true,device.getString("account_id"),1,"参加活动打开手动清算"); + } + + @Override + @Transactional public void cancelAct(JSONObject device) { LocalDateTime dt = LocalDateTime.now(); if(dt.getDayOfWeek()== DayOfWeek.MONDAY && dt.getHour()<18){ throw new BadRequestException("每周一0点至18点为收益计算时间,暂停退出活动操作"); } - String clientType = device.getString("client_type"); - deviceSupport.findRegister(clientType); int client_id = device.getIntValue("client_id"); List clientLogs = actMonDelaySettleMapper.clientLog(client_id); if (clientLogs.isEmpty()) { @@ -148,6 +158,8 @@ public class ActMonDelaySettleServiceImp implements ActMonDelaySettleService { clientLog.put("is_valid", 0); clientLog.put("expire_time", new Date()); actMonDelaySettleMapper.update(clientLog); + clientManager.changeManualSettle(client_id,false,device.getString("account_id"),1,"退出活动关闭手动清算"); } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index 0f1f5213b..309a2af8f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -115,4 +115,6 @@ public interface RetailAppService { JSONObject getCheckClientInfo(JSONObject device); + void changeManualSettle(JSONObject device,boolean manual_settle); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 857e5d35a..0a9bf4bec 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -1385,6 +1385,11 @@ public class RetailAppServiceImp implements RetailAppService { return clientManager.getCheckClientInfo(device.getIntValue("client_id"), device.getString("account_id")); } + @Override + public void changeManualSettle(JSONObject device,boolean manual_settle) { + clientManager.changeManualSettle(device.getIntValue("client_id"),manual_settle,device.getString("account_id"),1,"商户修改手动清算配置"); + } + private static boolean mathchLetterorNum(String str) { String regex = "[A-Za-z0-9]{8}"; return str.matches(regex); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index 4482b23ef..22031c480 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -406,4 +406,11 @@ public class RetailAppController { throw new ParamInvalidException("settle_to", "error.payment.valid.invalid_time"); } } + + + @RequestMapping(value = "/manual_settle", method = RequestMethod.PUT) + public void confirmSourceAgreeFile(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestParam boolean manual_settle) { + retailAppService.changeManualSettle(device,manual_settle); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClientsOperationLogMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClientsOperationLogMapper.java new file mode 100644 index 000000000..c69f68e87 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/ClientsOperationLogMapper.java @@ -0,0 +1,16 @@ +package au.com.royalpay.payment.manage.mappers.log; + +import com.alibaba.fastjson.JSONObject; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; + +/** + * Created by yixian on 2017-04-18. + */ +@AutoMapper(tablename = "log_clients_operation",pkName = "id") +public interface ClientsOperationLogMapper { + @AutoSql(type = SqlType.INSERT) + void save(JSONObject review); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 3e0825e09..21cf9b55b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -231,6 +231,7 @@ public interface ClientManager { void changePaymentPage(JSONObject account, String paypad_version); + void changeManualSettle(int client_id, boolean manual_settle,String operator_id,int type,String operation); void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 67dab6933..8c9b3867f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -13,6 +13,7 @@ import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.device.core.DeviceManager; import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper; +import au.com.royalpay.payment.manage.mappers.log.ClientsOperationLogMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; @@ -219,6 +220,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private ClientContractService clientContractService; @Resource private MessageSource messageSource; + @Resource + private ClientsOperationLogMapper clientsOperationLogMapper; private static final String SOURCE_AGREE_FILE = "source_agree_file"; private static final String CLIENT_BANK_FILE = "client_bank_file"; @@ -2607,6 +2610,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clearClientCache(clientId); } + @Override + @Transactional + public void changeManualSettle(int client_id, boolean manual_settle,String operator_id,int type,String operation) { + JSONObject client = getClientInfo(client_id); + if(client==null){ + throw new BadRequestException("merchant not found"); + } + JSONObject record = new JSONObject(); + record.put("client_id",client_id); + record.put("manual_settle",manual_settle); + clientMapper.update(record); + + JSONObject actClientLog = new JSONObject(); + actClientLog.put("client_id",client_id); + actClientLog.put("operator_id",operator_id); + actClientLog.put("operation",operation); + actClientLog.put("create_time",new Date()); + actClientLog.put("operator_type",type); + clientsOperationLogMapper.save(actClientLog); + + } + @Override public void changeQRCodePaySurcharge(JSONObject account, boolean paySurcharge) { int clientId = account.getIntValue("client_id"); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 5343e2075..14c71d748 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -524,6 +524,12 @@ public class PartnerManageController { return clientManager.listMerchantIds(clientMoniker,manager); } + @ManagerMapping(value = "/{clientMoniker}/manual_settle",method = RequestMethod.PUT,role = {ManagerRole.OPERATOR,ManagerRole.ADMIN}) + public void manualSettle(@PathVariable String clientMoniker, @RequestParam boolean manual_settle, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); + clientManager.changeManualSettle(client.getIntValue("client_id"),manual_settle,manager.getString("manager_id"),2,"运营人员修改手动清算配置"); + } + @PartnerMapping(value = "/check", method = RequestMethod.GET) public JSONObject getCheckClientInfo(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { return clientManager.getCheckClientInfo(account.getIntValue("client_id"),account.getString("account_id")); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java index 3782de3b1..223dc2858 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java @@ -2,14 +2,12 @@ package au.com.royalpay.payment.manage.merchants.web; import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; -import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientSignEventSupport; import au.com.royalpay.payment.manage.permission.manager.PartnerMapping; +import au.com.royalpay.payment.manage.permission.manager.RequirePartner; import au.com.royalpay.payment.manage.support.wechatclients.KangaLandWechatApiImpl; import au.com.royalpay.payment.manage.support.wechatclients.RedpackWechatApiImpl; -import au.com.royalpay.payment.tools.permission.enums.PartnerRole; -import au.com.royalpay.payment.manage.permission.manager.RequirePartner; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.core.TradeLogService; import au.com.royalpay.payment.tools.CommonConsts; @@ -17,20 +15,31 @@ import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.http.HttpUtils; +import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; +import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.wechat.WechatMapping; + import com.alibaba.fastjson.JSONObject; + import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.Errors; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; import java.io.IOException; import java.io.OutputStream; import java.util.List; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + /** * view for partner client * Created by yixian on 2016-07-03. @@ -348,4 +357,12 @@ public class PartnerViewController { public void fullReleasePreAuthorization(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestBody TradeLogQuery query) throws Exception { tradeLogService.fullReleasePreAuthorization(account, query); } + + + @PartnerMapping(value = "/manual_settle", method = RequestMethod.PUT, roles = PartnerRole.ADMIN) + @ResponseBody + public void manualSettle(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account, @RequestParam boolean manual_settle) { + } + + } diff --git a/src/main/resources/i18n/msg_en.properties b/src/main/resources/i18n/msg_en.properties index 1ea334469..88903aca8 100644 --- a/src/main/resources/i18n/msg_en.properties +++ b/src/main/resources/i18n/msg_en.properties @@ -104,4 +104,7 @@ app.label.coupons=Available Coupons sys.contract.ordinary.info=Dear merchant, your service contract with ROYALPAY has expired. In order not to affect your normal use, please contact your supervisor or use your administrator account as soon as possible for service renewal. sys.contract.ordinary.waring=Dear merchant, your service contract with ROYALPAY expires in {0} days. In order not to affect your normal use, please contact your supervisor or use your administrator account as soon as possible in order to renew your service contract. sys.contract.waring=Dear merchant, your service contract with ROYALPAY is due to expire in {0} days. In order not to affect your normal use, please see the latest service agreement for renewal. -sys.contract.info=Dear merchant, your service contract with ROYALPAY has expired. Please check the latest service agreement to renew your contract so as not to affect your normal use. \ No newline at end of file +sys.contract.info=Dear merchant, your service contract with ROYALPAY has expired. Please check the latest service agreement to renew your contract so as not to affect your normal use. + + +sys.mondelay.cancel.waring=this is mondelay cancel waring \ No newline at end of file diff --git a/src/main/resources/i18n/msg_zh.properties b/src/main/resources/i18n/msg_zh.properties index a2a041316..20964d285 100644 --- a/src/main/resources/i18n/msg_zh.properties +++ b/src/main/resources/i18n/msg_zh.properties @@ -98,4 +98,6 @@ app.label.coupons=可用优惠券 sys.contract.ordinary.info=尊敬的商户,您与ROYALPAY的服务合同已到期,为了不影响您的正常使用,请尽快联系您的主管或使用管理员账户登录以便进行服务续约 sys.contract.ordinary.waring=尊敬的商户,您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请尽快联系您的主管或使用管理员账户登录以便进行服务续约 sys.contract.waring=尊敬的商户,您与ROYALPAY的服务合同还有{0}天到期,为了不影响您的正常使用,请查看最新服务协议进行续约。 -sys.contract.info=尊敬的商户,您与ROYALPAY的服务合同已到期,为了不影响您的正常使用,请查看最新服务协议进行续约。 \ No newline at end of file +sys.contract.info=尊敬的商户,您与ROYALPAY的服务合同已到期,为了不影响您的正常使用,请查看最新服务协议进行续约。 + +sys.mondelay.cancel.waring=商户取消活动警告 \ No newline at end of file diff --git a/src/main/resources/templates/activity/mondelay/mondelay.html b/src/main/resources/templates/activity/mondelay/mondelay.html index 6cf9c91e8..e21edce0b 100644 --- a/src/main/resources/templates/activity/mondelay/mondelay.html +++ b/src/main/resources/templates/activity/mondelay/mondelay.html @@ -111,6 +111,8 @@