Merge remote-tracking branch 'origin/develop' into develop

master
Tayl0r 7 years ago
commit 000ba24c1b

@ -62,7 +62,7 @@ public interface RetailAppService {
JSONObject getClientCurrentRateNew(JSONObject device); JSONObject getClientCurrentRateNew(JSONObject device);
JSONObject listDailyTransactions(String dateStr, String timezone, JSONObject device); JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device);
JSONObject getActivities(JSONObject device, String activity_page, int page, int limit); JSONObject getActivities(JSONObject device, String activity_page, int page, int limit);

@ -952,7 +952,7 @@ public class RetailAppServiceImp implements RetailAppService {
} }
@Override @Override
public JSONObject listDailyTransactions(String dateStr, String timezone, JSONObject device) { public JSONObject listDailyTransactions(String dateStr, String timezone, boolean thisDevOnly, JSONObject device) {
try { try {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
dateFormat.setTimeZone(TimeZone.getTimeZone(timezone)); dateFormat.setTimeZone(TimeZone.getTimeZone(timezone));
@ -960,7 +960,7 @@ public class RetailAppServiceImp implements RetailAppService {
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
DeviceRegister register = deviceSupport.findRegister(clientType); DeviceRegister register = deviceSupport.findRegister(clientType);
String devId = null; String devId = null;
if (register.includeDevId()) { if (register.includeDevId() || thisDevOnly) {
devId = device.getString("dev_id"); devId = device.getString("dev_id");
} }
Date to = DateUtils.addDays(date, 1); Date to = DateUtils.addDays(date, 1);

@ -116,7 +116,7 @@ public class RetailAppController {
@RequestMapping(value = "/notice/{noticeId}", method = RequestMethod.PUT) @RequestMapping(value = "/notice/{noticeId}", method = RequestMethod.PUT)
public void updateNoticePartnerHasRead(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId, @RequestBody JSONObject account_param) { public void updateNoticePartnerHasRead(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId, @RequestBody JSONObject account_param) {
if (!device.getString("account_id").equals(account_param.getString("account_id"))){ if (!device.getString("account_id").equals(account_param.getString("account_id"))) {
throw new ForbiddenException("You have no permission"); throw new ForbiddenException("You have no permission");
} }
retailAppService.updateReadStatus(device, noticeId); retailAppService.updateReadStatus(device, noticeId);
@ -200,8 +200,9 @@ public class RetailAppController {
@RequestMapping(value = "/daily_transactions/date/{dateStr}", method = RequestMethod.GET) @RequestMapping(value = "/daily_transactions/date/{dateStr}", method = RequestMethod.GET)
public JSONObject listDailyTransactions(@PathVariable String dateStr, @RequestParam(defaultValue = "Australia/Melbourne") String timezone, public JSONObject listDailyTransactions(@PathVariable String dateStr, @RequestParam(defaultValue = "Australia/Melbourne") String timezone,
@RequestParam(defaultValue = "false") boolean thisdevice,
@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.listDailyTransactions(dateStr, timezone, device); return retailAppService.listDailyTransactions(dateStr, timezone, thisdevice, device);
} }
@RequestMapping(value = "/modify/retail_surcharge", method = RequestMethod.PUT) @RequestMapping(value = "/modify/retail_surcharge", method = RequestMethod.PUT)
@ -250,11 +251,11 @@ public class RetailAppController {
} }
@RequestMapping(value = "/cash_back/clean_info", method = RequestMethod.GET) @RequestMapping(value = "/cash_back/clean_info", method = RequestMethod.GET)
public JSONObject getCashbackCleanInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestParam(value = "client_id",required = false) String client_id) { public JSONObject getCashbackCleanInfo(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam(value = "client_id", required = false) String client_id) {
if (client_id==null){ if (client_id == null) {
client_id=device.getString("client_id"); client_id = device.getString("client_id");
} }
return retailAppService.getCashbackCleanInfo(device,client_id); return retailAppService.getCashbackCleanInfo(device, client_id);
} }
@RequestMapping(value = "/partner_signin_app_qrcode/{codeId}", method = RequestMethod.GET) @RequestMapping(value = "/partner_signin_app_qrcode/{codeId}", method = RequestMethod.GET)
@ -289,9 +290,10 @@ public class RetailAppController {
public JSONObject getAd(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public JSONObject getAd(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getAd(device); return retailAppService.getAd(device);
} }
@RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET) @RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET)
public JSONObject getAdDetail(@PathVariable String article_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public JSONObject getAdDetail(@PathVariable String article_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return retailAppService.getAdDetail(device,article_id); return retailAppService.getAdDetail(device, article_id);
} }

@ -21,7 +21,7 @@ public interface BDPrizeService {
JSONObject findReport(String month) throws Exception; JSONObject findReport(String month) throws Exception;
JSONObject getBDReport(String month, int managerId); JSONObject getBDReport(String month, String managerId);
List<JSONObject> getRateConfig(); List<JSONObject> getRateConfig();
@ -29,7 +29,7 @@ public interface BDPrizeService {
List<JSONObject> listBDLevels(); List<JSONObject> listBDLevels();
void updateBDLevel(int bdId, JSONObject info, JSONObject manager); void updateBDLevel(String bdId, JSONObject info, JSONObject manager);
List<JSONObject> listBDLeaderAndManager(String month); List<JSONObject> listBDLeaderAndManager(String month);

@ -246,7 +246,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
} }
@Override @Override
public JSONObject getBDReport(String month, int managerId) { public JSONObject getBDReport(String month, String managerId) {
try { try {
Date mon = DateUtils.parseDate(month, new String[]{"yyyy-MM"}); Date mon = DateUtils.parseDate(month, new String[]{"yyyy-MM"});
month = DateFormatUtils.format(mon, "yyyy-MM"); month = DateFormatUtils.format(mon, "yyyy-MM");
@ -281,16 +281,17 @@ public class BDPrizeServiceImpl implements BDPrizeService {
JSONObject totalDetail = financialBDPrizeLogMapper.findByReportAndBDTotal(report.getString("record_id"), managerId); JSONObject totalDetail = financialBDPrizeLogMapper.findByReportAndBDTotal(report.getString("record_id"), managerId);
log.putAll(totalDetail); log.putAll(totalDetail);
JSONObject bdInfo = managerMapper.findById(managerId);
if (ManagerRole.BD_LEADER.hasRole(managerId)) {
JSONObject groupPrizeLog = financialBDPrizeLogMapper.findByReportAndGroup(report.getString("record_id"), managerId);
log.put("group_prize", groupPrizeLog);
}
JSONObject bdInfo = managerMapper.findById(String.valueOf(managerId));
if (bdInfo == null) { if (bdInfo == null) {
log.put("leftCompany", true); log.put("leftCompany", true);
}else {
if (ManagerRole.BD_LEADER.hasRole(bdInfo.getIntValue("role"))) {
JSONObject groupPrizeLog = financialBDPrizeLogMapper.findByReportAndGroup(report.getString("record_id"), managerId);
log.put("group_prize", groupPrizeLog);
}
} }
return log; return log;
} }
@ -323,11 +324,10 @@ public class BDPrizeServiceImpl implements BDPrizeService {
} }
@Override @Override
public void updateBDLevel(int bdId, JSONObject info, JSONObject manager) { public void updateBDLevel(String bdId, JSONObject info, JSONObject manager) {
String bdIdStr = String.valueOf(bdId); JSONObject config = financialBDConfigMapper.getBdConfig(bdId);
JSONObject config = financialBDConfigMapper.getBdConfig(bdIdStr);
if (config == null) { if (config == null) {
JSONObject bdUser = managerMapper.findById(bdIdStr); JSONObject bdUser = managerMapper.findById(bdId);
if (bdUser == null || !ManagerRole.BD_USER.hasRole(bdUser.getIntValue("role"))) { if (bdUser == null || !ManagerRole.BD_USER.hasRole(bdUser.getIntValue("role"))) {
throw new BadRequestException("BD User Not exists"); throw new BadRequestException("BD User Not exists");
} }

@ -45,13 +45,13 @@ public class BDPrizeController {
} }
@ManagerMapping(value = "/records/{month}/bd_users/{managerId}", method = RequestMethod.GET, role = ManagerRole.FINANCIAL_STAFF) @ManagerMapping(value = "/records/{month}/bd_users/{managerId}", method = RequestMethod.GET, role = ManagerRole.FINANCIAL_STAFF)
public JSONObject getBDUserReportDetail(@PathVariable String month, @PathVariable int managerId) { public JSONObject getBDUserReportDetail(@PathVariable String month, @PathVariable String managerId) {
return bdPrizeService.getBDReport(month, managerId); return bdPrizeService.getBDReport(month, managerId);
} }
@ManagerMapping(value = "/records/{month}/bd_user_detail", method = RequestMethod.GET, role = ManagerRole.BD_USER) @ManagerMapping(value = "/records/{month}/bd_user_detail", method = RequestMethod.GET, role = ManagerRole.BD_USER)
public JSONObject getBDUserReportDetailForBD(@PathVariable String month, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public JSONObject getBDUserReportDetailForBD(@PathVariable String month, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
return bdPrizeService.getBDReport(month, manager.getIntValue("manager_id")); return bdPrizeService.getBDReport(month, manager.getString("manager_id"));
} }
@ManagerMapping(value = "/config/rates", method = RequestMethod.GET, role = {ManagerRole.BD_USER, ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN}) @ManagerMapping(value = "/config/rates", method = RequestMethod.GET, role = {ManagerRole.BD_USER, ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN})
@ -70,7 +70,7 @@ public class BDPrizeController {
} }
@ManagerMapping(value = "/config/bd_levels/{bdId}", method = RequestMethod.PUT, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN}) @ManagerMapping(value = "/config/bd_levels/{bdId}", method = RequestMethod.PUT, role = {ManagerRole.FINANCIAL_STAFF, ManagerRole.ADMIN})
public void updateBDLevel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable int bdId, @RequestBody JSONObject info) { public void updateBDLevel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String bdId, @RequestBody JSONObject info) {
bdPrizeService.updateBDLevel(bdId, info,manager); bdPrizeService.updateBDLevel(bdId, info,manager);
} }

@ -318,6 +318,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
orgIds.forEach((p)->{ orgIds.forEach((p)->{
generateAgent(monthStr,p); generateAgent(monthStr,p);
}); });
generateReferrer(monthStr);
}; };
new Thread(task).start(); new Thread(task).start();
} }

@ -30,21 +30,21 @@ public interface FinancialBDPrizeLogMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "prize_type=0") @AdvanceSelect(addonWhereClause = "prize_type=0")
List<JSONObject> findByReportAndBD(@Param("record_id") String recordId, @Param("manager_id") int managerId); List<JSONObject> findByReportAndBD(@Param("record_id") String recordId, @Param("manager_id") String managerId);
@Select("SELECT prize_log_id,record_id,manager_id,bd_name,bd_level,SUM(total_amount) total_amount, " + @Select("SELECT prize_log_id,record_id,manager_id,bd_name,bd_level,SUM(total_amount) total_amount, " +
"SUM(total_prize) total_prize,SUM(total_donation) total_donation, SUM(send_prize) send_prize, " + "SUM(total_prize) total_prize,SUM(total_donation) total_donation, SUM(send_prize) send_prize, " +
"SUM(hold_prize) hold_prize,last_punish,prize_type FROM financial_bd_prize_log fbpl " + "SUM(hold_prize) hold_prize,last_punish,prize_type FROM financial_bd_prize_log fbpl " +
"where fbpl.prize_type = 0 and fbpl.record_id = #{record_id} and fbpl.manager_id = #{manager_id} " + "where fbpl.prize_type = 0 and fbpl.record_id = #{record_id} and fbpl.manager_id = #{manager_id} " +
"GROUP BY fbpl.manager_id") "GROUP BY fbpl.manager_id")
JSONObject findByReportAndBDTotal(@Param("record_id") String recordId, @Param("manager_id") int managerId); JSONObject findByReportAndBDTotal(@Param("record_id") String recordId, @Param("manager_id") String managerId);
@Select("SELECT prize_log_id,record_id,manager_id,bd_name,bd_level,SUM(total_amount) total_amount," + @Select("SELECT prize_log_id,record_id,manager_id,bd_name,bd_level,SUM(total_amount) total_amount," +
"SUM(total_prize) total_prize,SUM(total_donation) total_donation, SUM(send_prize) send_prize," + "SUM(total_prize) total_prize,SUM(total_donation) total_donation, SUM(send_prize) send_prize," +
"SUM(hold_prize) hold_prize,last_punish,prize_type FROM financial_bd_prize_log fbpl " + "SUM(hold_prize) hold_prize,last_punish,prize_type FROM financial_bd_prize_log fbpl " +
"where fbpl.prize_type = 1 and fbpl.manager_id = #{manager_id} " + "where fbpl.prize_type = 1 and fbpl.manager_id = #{manager_id} " +
"GROUP BY fbpl.manager_id ") "GROUP BY fbpl.manager_id ")
JSONObject findByReportAndGroup(@Param("record_id") String recordId, @Param("manager_id") int managerId); JSONObject findByReportAndGroup(@Param("record_id") String recordId, @Param("manager_id") String managerId);
@AutoSql(type = SqlType.DELETE) @AutoSql(type = SqlType.DELETE)
void clearLogsOfReport(@Param("record_id") String recordId); void clearLogsOfReport(@Param("record_id") String recordId);

@ -23,7 +23,7 @@ public class PartnerQuery {
private String sub_merchant_id; private String sub_merchant_id;
private String org_id; private String org_id;
private String org_ids; private String org_ids;
private Integer bd; private String bd;
private String business_structure; private String business_structure;
private String industry; private String industry;
private Integer clean_day; private Integer clean_day;
@ -243,14 +243,6 @@ public class PartnerQuery {
this.org_id = org_id; this.org_id = org_id;
} }
public Integer getBd() {
return bd;
}
public void setBd(Integer bd) {
this.bd = bd;
}
public void setOnlyMe(boolean onlyMe) { public void setOnlyMe(boolean onlyMe) {
this.onlyMe = onlyMe; this.onlyMe = onlyMe;
} }
@ -452,4 +444,8 @@ public class PartnerQuery {
public void setOrg_ids(String org_ids) { public void setOrg_ids(String org_ids) {
this.org_ids = org_ids; this.org_ids = org_ids;
} }
public void setBd(String bd) {
this.bd = bd;
}
} }

Loading…
Cancel
Save