| @@ -24,7 +24,6 @@ import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.core.task.AsyncTaskExecutor; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.servlet.ServletException; | import javax.servlet.ServletException; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| @@ -33,6 +32,8 @@ import java.io.*; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.UUID; | import java.util.UUID; | ||||
| import java.util.concurrent.ExecutorService; | |||||
| import java.util.concurrent.Executors; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxAppinfo") | @RequestMapping("wxAppinfo") | ||||
| @@ -57,26 +58,25 @@ public class WxAppinfoController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private UploadController uploadController; | private UploadController uploadController; | ||||
| @Autowired | |||||
| private AsyncTaskExecutor asyncTaskExecutor; | |||||
| @Autowired | @Autowired | ||||
| private WxCouponChannelMapper wxCouponChannelMapper; | private WxCouponChannelMapper wxCouponChannelMapper; | ||||
| ExecutorService fixedThreadPool = Executors.newFixedThreadPool(100); | |||||
| @ApiOperation("加载老数据二维码") | @ApiOperation("加载老数据二维码") | ||||
| @GetMapping("/updateQrCode") | @GetMapping("/updateQrCode") | ||||
| public void updateQrCode(String p)throws ServletException, IOException { | public void updateQrCode(String p)throws ServletException, IOException { | ||||
| if("xlldxx".equals(p)){ | |||||
| if("xlldxx".equals(p)) { | |||||
| String pageUrl = "pages/index/index"; | String pageUrl = "pages/index/index"; | ||||
| List<WxMerchant> list = wxMerchantMapper.findQrcodeEmptyList(); | List<WxMerchant> list = wxMerchantMapper.findQrcodeEmptyList(); | ||||
| for (WxMerchant merchant:list) { | |||||
| asyncTaskExecutor.execute(new Runnable() { | |||||
| for (WxMerchant merchant : list) { | |||||
| fixedThreadPool.execute(new Runnable() { | |||||
| @Override | @Override | ||||
| public void run() { | public void run() { | ||||
| String param = merchant.getWeappScene(); | String param = merchant.getWeappScene(); | ||||
| ResultData resultData = exportQrcode(null,null,merchant.getTenantId(),1,pageUrl,param,0,"","","店铺详情",true); | |||||
| Map<String,String> map = (Map)resultData.data; | |||||
| ResultData resultData = exportQrcode(null, null, merchant.getTenantId(), 1, pageUrl, param, 0, "", "", "店铺详情", true); | |||||
| Map<String, String> map = (Map) resultData.data; | |||||
| String url = map.get("url"); | String url = map.get("url"); | ||||
| merchant.setQrCode(url); | merchant.setQrCode(url); | ||||
| wxMerchantMapper.updateByPrimaryKeySelective(merchant); | wxMerchantMapper.updateByPrimaryKeySelective(merchant); | ||||
| @@ -94,7 +94,7 @@ public class WxAppinfoController extends BaseController { | |||||
| List<WxCouponChannel> list = wxCouponChannelMapper.findQrcodeEmptyList(); | List<WxCouponChannel> list = wxCouponChannelMapper.findQrcodeEmptyList(); | ||||
| for (WxCouponChannel couponChannel:list) { | for (WxCouponChannel couponChannel:list) { | ||||
| asyncTaskExecutor.execute(new Runnable() { | |||||
| fixedThreadPool.execute(new Runnable() { | |||||
| @Override | @Override | ||||
| public void run() { | public void run() { | ||||
| String param = couponChannel.getWeappScene(); | String param = couponChannel.getWeappScene(); | ||||
| @@ -146,9 +146,9 @@ public class WxAppinfoController extends BaseController { | |||||
| } | } | ||||
| public ResultData exportQrcode(HttpServletRequest request, HttpServletResponse response, | public ResultData exportQrcode(HttpServletRequest request, HttpServletResponse response, | ||||
| String tenantId, int type, String pageUrl, String sceneParam, | |||||
| int withText, String text1, String text2, | |||||
| String name,boolean upload) { | |||||
| String tenantId, int type, String pageUrl, String sceneParam, | |||||
| int withText, String text1, String text2, | |||||
| String name,boolean upload) { | |||||
| // type 0 有限二维码, 1 无限制二维码 | // type 0 有限二维码, 1 无限制二维码 | ||||
| // withText 0 不带字 1. 带下面的字,2 带下面的两行字 | // withText 0 不带字 1. 带下面的字,2 带下面的两行字 | ||||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(tenantId); | WxAppinfo appinfo = wxAppinfoService.getCAppInfo(tenantId); | ||||
| @@ -280,3 +280,4 @@ public class WxAppinfoController extends BaseController { | |||||
| } | } | ||||
| @@ -95,6 +95,7 @@ public class WxRentContractController extends BaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| wxRentContract.setRentPriceHandle(); | |||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName()); | return wxRentContractService.update(wxRentContract, user.getId(),user.getName()); | ||||
| } | } | ||||
| @@ -110,6 +111,7 @@ public class WxRentContractController extends BaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| wxRentContract.setRentPriceHandle(); | |||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName()); | return wxRentContractService.update(wxRentContract, user.getId(),user.getName()); | ||||
| } | } | ||||
| @@ -120,6 +122,7 @@ public class WxRentContractController extends BaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxRentContract.setTenantId(user.getTenantId()); | wxRentContract.setTenantId(user.getTenantId()); | ||||
| wxRentContract.setAdjustPeriodHandle(); | wxRentContract.setAdjustPeriodHandle(); | ||||
| wxRentContract.setRentPriceHandle(); | |||||
| return wxRentContractService.updateFile(wxRentContract, user.getId(),user.getName()); | return wxRentContractService.updateFile(wxRentContract, user.getId(),user.getName()); | ||||
| } | } | ||||
| @@ -258,3 +261,4 @@ public class WxRentContractController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @@ -61,9 +61,9 @@ public class AsyncTask { | |||||
| public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) { | public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) { | ||||
| ImportParams params = new ImportParams(); | ImportParams params = new ImportParams(); | ||||
| // 需要验证 | // 需要验证 | ||||
| params.setImportFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日","积分", "地址", "上次活跃时间", "注册时间", "标签", "成长值"}); | |||||
| params.setImportFields(new String[]{"姓名", "性别", "手机号*", "微信昵称", "学历", "生日", "积分", "地址", "上次活跃时间", "注册时间", "标签", "成长值"}); | |||||
| IExcelDataHandler<CUserBaseInfoT> handler = new AsyncTask.UserExcelHandler(); | IExcelDataHandler<CUserBaseInfoT> handler = new AsyncTask.UserExcelHandler(); | ||||
| handler.setNeedHandlerFields(new String[] { "手机号" }); | |||||
| handler.setNeedHandlerFields(new String[]{"手机号*"}); | |||||
| params.setNeedVerify(true); | params.setNeedVerify(true); | ||||
| ExcelImportResult<CUserBaseInfoT> datalist = null; | ExcelImportResult<CUserBaseInfoT> datalist = null; | ||||
| @@ -65,9 +65,9 @@ public class BillDailyAsyncTask { | |||||
| public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) { | public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) { | ||||
| ImportParams params = new ImportParams(); | ImportParams params = new ImportParams(); | ||||
| // 需要验证 | // 需要验证 | ||||
| params.setImportFields(new String[]{"商铺号", "费用类型", "实际应收金额(元)", "实收金额(元)", "缴款截止日期"}); | |||||
| params.setImportFields(new String[]{"商铺号*", "费用类型*", "实际应收金额(元)*", "实收金额(元)*", "缴款截止日期*"}); | |||||
| IExcelDataHandler<WxBillDailyVo> handler = new BillDailyAsyncTask.BillDailyExcelHandler(); | IExcelDataHandler<WxBillDailyVo> handler = new BillDailyAsyncTask.BillDailyExcelHandler(); | ||||
| handler.setNeedHandlerFields(new String[]{"商铺号", "费用类型", "实际应收金额(元)", "实收金额(元)", "缴款截止日期"}); | |||||
| handler.setNeedHandlerFields(new String[]{"商铺号*", "费用类型*", "实际应收金额(元)*", "实收金额(元)*", "缴款截止日期*"}); | |||||
| params.setNeedVerify(true); | params.setNeedVerify(true); | ||||
| ExcelImportResult<WxBillDailyVo> datalist = null; | ExcelImportResult<WxBillDailyVo> datalist = null; | ||||
| @@ -11,7 +11,6 @@ import com.iformall.domain.vo.MallUserInfoVo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.mapper.WxMerchantMapper; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.shiro.UserSession; | import com.iformall.shiro.UserSession; | ||||
| import com.iformall.shiro.UseriFormallToken; | import com.iformall.shiro.UseriFormallToken; | ||||
| @@ -32,7 +31,6 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.imageio.ImageIO; | import javax.imageio.ImageIO; | ||||
| import javax.servlet.ServletException; | import javax.servlet.ServletException; | ||||
| import javax.servlet.ServletOutputStream; | import javax.servlet.ServletOutputStream; | ||||
| @@ -41,7 +39,6 @@ import javax.servlet.http.HttpServletResponse; | |||||
| import java.awt.image.BufferedImage; | import java.awt.image.BufferedImage; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.URLEncoder; | import java.net.URLEncoder; | ||||
| import java.util.Date; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -0,0 +1,52 @@ | |||||
| DROP TABLE IF EXISTS `sys_monitor`; | |||||
| CREATE TABLE `sys_monitor` ( | |||||
| `id` bigint(20) NOT NULL, | |||||
| `name` varchar(50) NOT NULL COMMENT '网址名称', | |||||
| `url` varchar(255) NOT NULL COMMENT '网址url', | |||||
| `type` tinyint(20) DEFAULT '1' COMMENT '1=网址监控', | |||||
| `deploy` tinyint(20) DEFAULT '1' COMMENT '1=dev 2=test 3=release', | |||||
| `err_msg` varchar(50) DEFAULT NULL COMMENT '错误信息', | |||||
| PRIMARY KEY (`id`), | |||||
| UNIQUE `id_UNIQUE` USING BTREE (`id`) comment '' | |||||
| ) ENGINE=`InnoDB` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='网络监控' CHECKSUM=0 DELAY_KEY_WRITE=0; | |||||
| INSERT INTO `sys_monitor` (`id`,`name`,`url`,`type`,`deploy`,`err_msg`) VALUES | |||||
| (1, "dev-管理端","https://mall.youlane.cn/api/version", 1, 1, "{url}不响应"), | |||||
| (2, "dev-C端","https://ciformall.youlane.cn/C/api/mall/version", 1, 1, "{name}: {url} 不响应"), | |||||
| (3, "dev-B端","https://biformall.youlane.cn/B/api/mall/version", 1, 1, "{name}: {url}不响应"), | |||||
| (4, "dev-Schedule","http://202.165.179.86:5000/S/version", 1, 1, "{name}: {url}不响应"), | |||||
| (5, "dev-消息服务器","http://202.165.179.86:5001/mq/version", 1, 1, "{name}: {url}不响应"), | |||||
| (6, "dev-websocket服务器","http://202.165.179.86:7100/W/version", 1, 1, "{name}: {url}不响应"), | |||||
| (7, "dev-微信第三方开放平台","https://open.youlane.cn/O/version", 1, 1, "{name}: {url}不响应"), | |||||
| (8, "dev-移动端数据塔台","https://mobile.youlane.cn/#/", 1, 1, "{name}: {url}不响应"), | |||||
| (9, "dev-幸运卡牌","https://game.youlane.cn/luckCard/index.html", 1, 1, "{name}: {url}不响应"), | |||||
| (10, "dev-幸运砸金蛋","https://game.youlane.cn/goldEgg/index.html", 1, 1, "{name}: {url}不响应"), | |||||
| (11, "dev-幸运刮刮乐","https://game.youlane.cn/guaguale/index.html", 1, 1, "{name}: {url}不响应"), | |||||
| (12, "dev-callback","http://202.165.179.86:9100/version", 1, 1, "{name}: {url}不响应"), | |||||
| (101, "test-管理端","https://admintest.malls.iformall.com/api/version", 1, 2, "{name}: {url}不响应"), | |||||
| (102, "test-C端","https://ctest.malls.iformall.com/C/api/mall/version", 1, 2, "{name}: {url} 不响应"), | |||||
| (103, "test-B端","https://btest.malls.iformall.com/B/api/mall/version", 1, 2, "{name}: {url}不响应"), | |||||
| (104, "test-Schedule","https://stest.malls.iformall.com/S/version", 1, 2, "{name}: {url}不响应"), | |||||
| (105, "test-消息服务器","https://stest.malls.iformall.com/mq/version", 1, 2, "{name}: {url}不响应"), | |||||
| (106, "test-websocket服务器","https://stest.malls.iformall.com/W/version", 1, 2, "{name}: {url}不响应"), | |||||
| (107, "test-微信第三方开放平台","https://opentest.malls.iformall.com/O/version", 1, 2, "{name}: {url}不响应"), | |||||
| (108, "test-移动端数据塔台","https://mobiletest.malls.iformall.com/#/", 1, 2, "{name}: {url}不响应"), | |||||
| (109, "test-幸运卡牌","https://gametest.malls.iformall.com/game/luckCard/index.html", 1, 2, "{name}: {url}不响应"), | |||||
| (110, "test-幸运砸金蛋","https://gametest.malls.iformall.com/game/goldEgg/index.html", 1, 2, "{name}: {url}不响应"), | |||||
| (111, "test-幸运刮刮乐","https://gametest.malls.iformall.com/game/guaguale/index.html", 1, 2, "{name}: {url}不响应"), | |||||
| (112, "test-callback","https://callbacktest.malls.iformall.com/api/version", 1, 2, "{name}: {url}不响应"), | |||||
| (201, "生产环境-管理端","https://admin.malls.iformall.com/api/version", 1, 3, "{name}: {url}不响应"), | |||||
| (202, "生产环境-C端","https://c.malls.iformall.com/C/api/mall/version", 1, 3, "{name}: {url} 不响应"), | |||||
| (203, "生产环境-B端","https://b.malls.iformall.com/B/api/mall/version", 1, 3, "{name}: {url}不响应"), | |||||
| (204, "生产环境-Schedule","https://s.malls.iformall.com/S/version", 1, 3, "{name}: {url}不响应"), | |||||
| (205, "生产环境-消息服务器","https://s.malls.iformall.com/mq/version", 1, 3, "{name}: {url}不响应"), | |||||
| (206, "生产环境-websocket服务器","https://s.malls.iformall.com/W/version", 1, 3, "{name}: {url}不响应"), | |||||
| (207, "生产环境-微信第三方开放平台","https://open.malls.iformall.com/O/version", 1, 3, "{name}: {url}不响应"), | |||||
| (208, "生产环境-移动端数据塔台","https://mobile.malls.iformall.com/#/", 1, 3, "{name}: {url}不响应"), | |||||
| (209, "生产环境-幸运卡牌","https://game.malls.iformall.com/game/luckCard/index.html", 1, 3, "{name}: {url}不响应"), | |||||
| (210, "生产环境-幸运砸金蛋","https://game.malls.iformall.com/game/goldEgg/index.html", 1, 3, "{name}: {url}不响应"), | |||||
| (211, "生产环境-幸运刮刮乐","https://game.malls.iformall.com/game/guaguale/index.html", 1, 3, "{name}: {url}不响应"), | |||||
| (212, "生产环境-callback","https://callback.malls.iformall.com/api/version", 1, 3, "{name}: {url}不响应") | |||||
| ; | |||||
| @@ -0,0 +1,2 @@ | |||||
| ALTER TABLE `wx_rent_contract` | |||||
| ADD COLUMN `subject_name` varchar(200) DEFAULT NULL COMMENT '主体名称'; | |||||
| @@ -32,6 +32,12 @@ public class ScheduleApplication { | |||||
| @Value("${fm.upload_dir}") | @Value("${fm.upload_dir}") | ||||
| private String uploadDir; | private String uploadDir; | ||||
| @Value("${fm.monitor_emails}") | |||||
| private String fmMonitorEmails; | |||||
| @Value("${fm.monitor_enable}") | |||||
| private boolean fmMonitor; | |||||
| @Bean | @Bean | ||||
| public boolean isFmException() { | public boolean isFmException() { | ||||
| return fmException; | return fmException; | ||||
| @@ -52,6 +58,17 @@ public class ScheduleApplication { | |||||
| return uploadDir; | return uploadDir; | ||||
| } | } | ||||
| @Bean | |||||
| public String fmMonitorEmails() { | |||||
| return fmMonitorEmails; | |||||
| } | |||||
| @Bean | |||||
| public boolean isFmMonitor() { | |||||
| return fmMonitor; | |||||
| } | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| SpringApplication.run(ScheduleApplication.class, args); | SpringApplication.run(ScheduleApplication.class, args); | ||||
| @@ -0,0 +1,82 @@ | |||||
| package com.iformall.schedule; | |||||
| import com.iformall.domain.po.SysMonitor; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.MailService; | |||||
| import com.iformall.utils.HttpUtil; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | |||||
| import org.springframework.stereotype.Component; | |||||
| import java.util.List; | |||||
| @Component | |||||
| public class SysMonitorSchedule { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private String fmMonitorEmails; | |||||
| @Autowired | |||||
| private boolean isFmMonitor; | |||||
| @Autowired | |||||
| private MailService mailService; | |||||
| @Autowired | |||||
| private SysMonitorMapper sysMonitorMapper; | |||||
| @Scheduled(cron = "0 */5 * * * *?") // 每隔5分钟检查一下各个网址 | |||||
| public void checkUrls() { | |||||
| if(isFmMonitor) { | |||||
| SysMonitor q = new SysMonitor(); | |||||
| List<SysMonitor> sysMonitors = sysMonitorMapper.findList(q); | |||||
| for (SysMonitor sysMonitor : sysMonitors) { | |||||
| checkSysMonitor(sysMonitor); | |||||
| } | |||||
| } | |||||
| } | |||||
| private void checkSysMonitor(SysMonitor sysMonitor) { | |||||
| boolean isNormal = true; | |||||
| for(int i=0;i<3;i++) { | |||||
| try { | |||||
| String result = HttpUtil.doGet(sysMonitor.getUrl()); | |||||
| if (StringUtils.isBlank(result)) { | |||||
| isNormal = false; | |||||
| } else { | |||||
| if (result.length() < 60) { | |||||
| logger.info(result); | |||||
| } else { | |||||
| logger.info(result.substring(0, 50)); | |||||
| } | |||||
| } | |||||
| } catch (RuntimeException e) { | |||||
| logger.error(e.getMessage()); | |||||
| isNormal = false; | |||||
| } | |||||
| if(isNormal) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| if(!isNormal) { | |||||
| String[] receivers = fmMonitorEmails.split(","); | |||||
| String content = sysMonitor.getErrMsg(); | |||||
| content = content.replace("{name}", sysMonitor.getName()); | |||||
| content = content.replace("{url}", sysMonitor.getUrl()); | |||||
| //发送邮件 | |||||
| logger.error(sysMonitor.getName() + "访问异常"); | |||||
| mailService.sendSimpleMail(receivers, sysMonitor.getName() + "访问异常", content); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -108,6 +108,8 @@ fm: | |||||
| deploy: 1 | deploy: 1 | ||||
| open: true | open: true | ||||
| upload_dir: /home/test/server/uploads/ | upload_dir: /home/test/server/uploads/ | ||||
| monitor_emails: hupeng@iformall.com,wuguoqiang@iformall.com,gongbiao@iformall.com,luozukai@iformall.com,sunmingming@iformall.com,huanghui@iformall.com,wangmei@iformall.com,liuhui@iformall.com,luqicai@iformall.com | |||||
| monitor_enable: true | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -93,6 +93,8 @@ fm: | |||||
| deploy: 3 | deploy: 3 | ||||
| open: true | open: true | ||||
| upload_dir: /home/ec2-user/server/uploads/ | upload_dir: /home/ec2-user/server/uploads/ | ||||
| monitor_emails: hupeng@iformall.com,wuguoqiang@iformall.com,gongbiao@iformall.com,luozukai@iformall.com,sunmingming@iformall.com,huanghui@iformall.com,wangmei@iformall.com,liuhui@iformall.com,luqicai@iformall.com | |||||
| monitor_enable: false | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -93,6 +93,8 @@ fm: | |||||
| deploy: 2 | deploy: 2 | ||||
| open: true | open: true | ||||
| upload_dir: /home/ec2-user/server/uploads/ | upload_dir: /home/ec2-user/server/uploads/ | ||||
| monitor_emails: hupeng@iformall.com,wuguoqiang@iformall.com,gongbiao@iformall.com,luozukai@iformall.com,sunmingming@iformall.com,huanghui@iformall.com,wangmei@iformall.com,liuhui@iformall.com,luqicai@iformall.com | |||||
| monitor_enable: false | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| @@ -0,0 +1,95 @@ | |||||
| package com.iformall.domain.po; | |||||
| import lombok.Data; | |||||
| import javax.persistence.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | |||||
| import java.io.Serializable; | |||||
| @Table(name = "sys_monitor") | |||||
| @Data | |||||
| public class SysMonitor implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| @io.swagger.annotations.ApiModelProperty(value="网址url",name="name") | |||||
| private String name; | |||||
| @io.swagger.annotations.ApiModelProperty(value="网址url",name="url") | |||||
| private String url; | |||||
| @io.swagger.annotations.ApiModelProperty(value="1=网址监控",name="type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value="1=dev 2=test 3=release",name="deploy") | |||||
| private Integer deploy; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="errMsg") | |||||
| private String errMsg; | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||||
| ,Url_ASC("`url` ASC"),Url_DESC("`url` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||||
| ,Deploy_ASC("`deploy` ASC"),Deploy_DESC("`deploy` DESC") | |||||
| ,ErrMsg_ASC("`err_msg` ASC"),ErrMsg_DESC("`err_msg` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(SysMonitor.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| this.sortColumns = sb.toString(); | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -37,7 +37,7 @@ public class WxBillDaily extends BaseEntity{ | |||||
| @Transient | @Transient | ||||
| private String merchantName; | private String merchantName; | ||||
| @Excel(name = "费用类型", replace = {"水费_1", "电费_2"}, width = 10, orderNum = "2") | |||||
| @Excel(name = "费用类型*", replace = {"水费_1", "电费_2"}, width = 10, orderNum = "2") | |||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value="账单类型",name="type") | @io.swagger.annotations.ApiModelProperty(value="账单类型",name="type") | ||||
| private Integer type; | private Integer type; | ||||
| @@ -49,7 +49,7 @@ public class WxBillDaily extends BaseEntity{ | |||||
| @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") | @io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay") | ||||
| private Long pay; | private Long pay; | ||||
| @Excel(name = "缴款截止日期", orderNum = "5", width = 20, format = "yyyy-MM-dd") | |||||
| @Excel(name = "缴款截止日期*", orderNum = "5", width = 20, format = "yyyy-MM-dd") | |||||
| @NotNull | @NotNull | ||||
| @SortColumn(column = "receiveDate") | @SortColumn(column = "receiveDate") | ||||
| @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") | @io.swagger.annotations.ApiModelProperty(value="截止收款日期",name="receiveDate") | ||||
| @@ -10,7 +10,6 @@ import javax.persistence.Id; | |||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| import javax.validation.constraints.NotNull; | import javax.validation.constraints.NotNull; | ||||
| import java.io.Serializable; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Objects; | import java.util.Objects; | ||||
| @@ -45,7 +44,7 @@ public class WxCUserBasicInfo extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | ||||
| private Integer sex; | private Integer sex; | ||||
| @Excel(name="手机号",width = 20,orderNum = "3") | |||||
| @Excel(name = "手机号*", width = 20, orderNum = "3") | |||||
| @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | ||||
| @NotNull | @NotNull | ||||
| @@ -6,6 +6,7 @@ import com.iformall.enums.EnumRentContractAdjustPeriod; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | import lombok.ToString; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| @@ -213,6 +214,9 @@ public class WxRentContract extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit") | @io.swagger.annotations.ApiModelProperty(value = "多径租赁单价(其他放rentInfo)", name = "priceUnit") | ||||
| private String rentPrice; | private String rentPrice; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "主体名称", name = "subjectName") | |||||
| private String subjectName; | |||||
| public static enum Field { | public static enum Field { | ||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC") | Id_ASC("`id` ASC"), Id_DESC("`id` DESC") | ||||
| , MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC") | , MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC") | ||||
| @@ -301,4 +305,11 @@ public class WxRentContract extends BaseEntity { | |||||
| } | } | ||||
| } | } | ||||
| public void setRentPriceHandle() { | |||||
| if(StringUtils.isNotBlank(rentPrice)) { | |||||
| rentPrice = Double.parseDouble(rentPrice) * 100 +""; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -17,17 +17,17 @@ import javax.validation.constraints.NotNull; | |||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
| public class WxBillDailyVo extends WxBillDaily { | public class WxBillDailyVo extends WxBillDaily { | ||||
| @Excel(name = "商铺号", width = 20, orderNum = "1") | |||||
| @Excel(name = "商铺号*", width = 20, orderNum = "1") | |||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value = "商铺号", name = "shopNumber") | @io.swagger.annotations.ApiModelProperty(value = "商铺号", name = "shopNumber") | ||||
| private String shopNumber; | private String shopNumber; | ||||
| @Excel(name = "实际应收金额(元)", orderNum = "3", width = 20, numFormat = "#.##") | |||||
| @Excel(name = "实际应收金额(元)*", orderNum = "3", width = 20, numFormat = "#.##") | |||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value = "实际应收金额", name = "receivePayStr") | @io.swagger.annotations.ApiModelProperty(value = "实际应收金额", name = "receivePayStr") | ||||
| private String receivePayStr; | private String receivePayStr; | ||||
| @Excel(name = "实收金额(元)", orderNum = "4", width = 20, numFormat = "#.##") | |||||
| @Excel(name = "实收金额(元)*", orderNum = "4", width = 20, numFormat = "#.##") | |||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value = "实收金额", name = "payStr") | @io.swagger.annotations.ApiModelProperty(value = "实收金额", name = "payStr") | ||||
| private String payStr; | private String payStr; | ||||
| @@ -36,6 +36,11 @@ public class WxProfitSharingOrderQueryVo extends BaseEntity { | |||||
| @javax.persistence.Transient | @javax.persistence.Transient | ||||
| private Integer type; | private Integer type; | ||||
| @javax.persistence.Transient | |||||
| private Integer payAmount; | |||||
| @javax.persistence.Transient | |||||
| private Date createTime; | |||||
| @Override | @Override | ||||
| public String getSortColumns() { | public String getSortColumns() { | ||||
| super.setSortColumns(this.sortColumns); | super.setSortColumns(this.sortColumns); | ||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.mapper; | |||||
| import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.SysMonitor; | |||||
| public interface SysMonitorMapper extends CommonMapper<SysMonitor, Long> { | |||||
| List<SysMonitor> findList(SysMonitor sysMonitor); | |||||
| } | |||||
| @@ -515,20 +515,108 @@ public class WxPayment { | |||||
| return str; | return str; | ||||
| } | } | ||||
| public static void main(String[] args) { | |||||
| Map map = MapUtil.getOrderMap(); | |||||
| map.put("mch_id", "1451696902"); | |||||
| map.put("nonce_str", RandomUtils.getStr(32)); | |||||
| String sign = WxPayment.createSign(map, "9f779d18a174f83879be48574afcb6f6"); | |||||
| map.put("sign", sign); | |||||
| String response = WxPay.sanboxSignGet(map); | |||||
| System.out.println(response); | |||||
| /* | |||||
| private static void getSanboxKeyTest() { | |||||
| Map map = MapUtil.getOrderMap(); | |||||
| map.put("mch_id", "1511925291"); | |||||
| // map.put("sub_mch_id", "1513691501"); | |||||
| map.put("nonce_str", RandomUtils.getStr(32)); | |||||
| String sign = WxPayment.createSign(map, "XHZfpVA0NzoXgLEjsujctUTcyj8Zur2C"); | |||||
| map.put("sign", sign); | |||||
| String response = WxPay.sanboxSignGet(map); | |||||
| System.out.println(response); | |||||
| /* | |||||
| <xml> | <xml> | ||||
| <return_code><![CDATA[SUCCESS]]></return_code> | |||||
| <return_msg><![CDATA[ok]]></return_msg> | |||||
| <sandbox_signkey><![CDATA[eb68c9a387f33b3a94ab375b2ca30816]]></sandbox_signkey> | |||||
| </xml> | |||||
| <return_code><![CDATA[SUCCESS]]></return_code> | |||||
| <return_msg><![CDATA[ok]]></return_msg> | |||||
| <sandbox_signkey><![CDATA[7e9d244da17632cdf608e04564a628da]]></sandbox_signkey> | |||||
| </xml> | |||||
| */ | */ | ||||
| } | |||||
| private static void getDownloadBillTest(String signKey) { | |||||
| Map map = MapUtil.getOrderMap(); | |||||
| map.put("appid", "wxed2f44705544b892"); | |||||
| map.put("mch_id", "1511925291"); | |||||
| map.put("nonce_str", RandomUtils.getStr(32)); | |||||
| map.put("bill_date", "20190524"); | |||||
| map.put("bill_type", "ALL"); | |||||
| String sign = WxPayment.createSign(map, signKey); | |||||
| map.put("sign", sign); | |||||
| String response = WxPay.downloadBill(map); | |||||
| System.out.println(response); | |||||
| } | |||||
| private static void microPaySanbox(String signKey, String outTradeNo) { | |||||
| Map map = MapUtil.getOrderMap(); | |||||
| map.put("appid", "wxed2f44705544b892"); | |||||
| map.put("mch_id", "1511925291"); | |||||
| map.put("nonce_str", RandomUtils.getStr(32)); | |||||
| map.put("body", "image形象店-深圳腾大- QQ公仔"); | |||||
| map.put("out_trade_no", outTradeNo); | |||||
| map.put("total_fee", "502"); | |||||
| map.put("spbill_create_ip", "172.16.115.182"); | |||||
| map.put("auth_code", "134659695358765866"); | |||||
| String sign = WxPayment.createSign(map, signKey); | |||||
| map.put("sign", sign); | |||||
| String response = WxPay.micropay(map); | |||||
| System.out.println("micropay"); | |||||
| System.out.println(response); | |||||
| } | |||||
| private static void queryPaySanbox(String signKey, String outTradeNo) { | |||||
| Map map = MapUtil.getOrderMap(); | |||||
| map.put("appid", "wxed2f44705544b892"); | |||||
| map.put("mch_id", "1511925291"); | |||||
| map.put("out_trade_no", outTradeNo); | |||||
| map.put("nonce_str", RandomUtils.getStr(32)); | |||||
| String sign = WxPayment.createSign(map, signKey); | |||||
| map.put("sign", sign); | |||||
| String response = WxPay.orderQuery(map); | |||||
| System.out.println("micropayQuery"); | |||||
| System.out.println(response); | |||||
| } | |||||
| private static void refundSanbox(String signKey, String outTradeNo, String outRefundNo) { | |||||
| Map map = MapUtil.getOrderMap(); | |||||
| map.put("appid", "wxed2f44705544b892"); | |||||
| map.put("mch_id", "1511925291"); | |||||
| map.put("nonce_str", RandomUtils.getStr(32)); | |||||
| map.put("out_trade_no", outTradeNo); | |||||
| map.put("out_refund_no", outRefundNo); | |||||
| map.put("total_fee", "502"); | |||||
| map.put("refund_fee", "501"); | |||||
| String sign = WxPayment.createSign(map, signKey); | |||||
| map.put("sign", sign); | |||||
| String response = WxPay.orderRefund(map, "/opt/iformall/service/apiclient_cert.p12", "1511925291"); | |||||
| System.out.println("refund"); | |||||
| System.out.println(response); | |||||
| } | |||||
| private static void refundQuerySanbox(String signKey, String outTradeNo, String outRefundNo) { | |||||
| Map map = MapUtil.getOrderMap(); | |||||
| map.put("appid", "wxed2f44705544b892"); | |||||
| map.put("mch_id", "1511925291"); | |||||
| map.put("nonce_str", RandomUtils.getStr(32)); | |||||
| map.put("out_trade_no", outTradeNo); | |||||
| map.put("out_refund_no", outRefundNo); | |||||
| String sign = WxPayment.createSign(map, signKey); | |||||
| map.put("sign", sign); | |||||
| String response = WxPay.orderRefundQuery(map); | |||||
| System.out.println("refundQuery"); | |||||
| System.out.println(response); | |||||
| } | |||||
| public static void main(String[] args) { | |||||
| String signKey = "7e9d244da17632cdf608e04564a628da"; | |||||
| String outTradeNo = "1459833232543346"; | |||||
| String outRefundNo = "143446547"; | |||||
| microPaySanbox(signKey, outTradeNo); | |||||
| queryPaySanbox(signKey, outTradeNo); | |||||
| refundSanbox(signKey, outTradeNo, outRefundNo); | |||||
| refundQuerySanbox(signKey, outTradeNo, outRefundNo); | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,10 +9,9 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.poi.ss.usermodel.Workbook; | |||||
| import org.apache.poi.ss.usermodel.*; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||
| @@ -34,12 +33,12 @@ public class ExcelService { | |||||
| ExportParams exportParams = new ExportParams(title, sheetName); | ExportParams exportParams = new ExportParams(title, sheetName); | ||||
| exportParams.setCreateHeadRows(isCreateHeader); | exportParams.setCreateHeadRows(isCreateHeader); | ||||
| exportParams.setType(ExcelType.XSSF); | exportParams.setType(ExcelType.XSSF); | ||||
| defaultExport(list, pojoClass, fileName, response, exportParams); | |||||
| defaultExport(list, pojoClass, fileName, response, exportParams, false); | |||||
| } | } | ||||
| public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass,String fileName, HttpServletResponse response) | |||||
| public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, HttpServletResponse response, boolean template) | |||||
| { | { | ||||
| defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName, ExcelType.XSSF)); | |||||
| defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName, ExcelType.XSSF), template); | |||||
| } | } | ||||
| public static void exportExcel(List<Map<String, Object>> list, String fileName, HttpServletResponse response) | public static void exportExcel(List<Map<String, Object>> list, String fileName, HttpServletResponse response) | ||||
| @@ -47,12 +46,23 @@ public class ExcelService { | |||||
| defaultExport(list, fileName, response); | defaultExport(list, fileName, response); | ||||
| } | } | ||||
| private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) | |||||
| private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams, boolean template) | |||||
| { | { | ||||
| Workbook workbook = ExcelExportUtil.exportExcel(exportParams,pojoClass,list); | Workbook workbook = ExcelExportUtil.exportExcel(exportParams,pojoClass,list); | ||||
| if (workbook != null); | |||||
| downLoadExcel(fileName, response, workbook); | |||||
| if (workbook != null) { | |||||
| if (template) { | |||||
| Sheet sheetAt = workbook.getSheetAt(0); | |||||
| CellStyle cellStyle = workbook.createCellStyle(); | |||||
| Font font = workbook.createFont(); | |||||
| font.setColor(IndexedColors.RED.getIndex()); | |||||
| cellStyle.setFont(font); | |||||
| Row row = sheetAt.createRow(sheetAt.getLastRowNum() + 2); | |||||
| Cell cell = row.createCell(0); | |||||
| cell.setCellValue("*为必填字段(此段文字导入数据时请删除)"); | |||||
| cell.setCellStyle(cellStyle); | |||||
| } | |||||
| } | |||||
| downLoadExcel(fileName, response, workbook); | |||||
| } | } | ||||
| private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) | private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) | ||||
| @@ -0,0 +1,57 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.SysMonitor; | |||||
| import java.util.List; | |||||
| public interface SysMonitorService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<SysMonitor> listAsPage(SysMonitor record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据实体查询列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<SysMonitor> getList(SysMonitor record); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| SysMonitor getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(SysMonitor record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| } | |||||
| @@ -0,0 +1,59 @@ | |||||
| package com.iformall.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.SysMonitor; | |||||
| import com.iformall.mapper.SysMonitorMapper; | |||||
| import com.iformall.service.SysMonitorService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.common.IdWorker; | |||||
| @Service | |||||
| public class SysMonitorServiceImpl implements SysMonitorService { | |||||
| @Autowired | |||||
| SysMonitorMapper sysMonitorMapper; | |||||
| @Override | |||||
| public PageInfo<SysMonitor> listAsPage(SysMonitor record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> sysMonitorMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public List<SysMonitor> getList(SysMonitor record) { | |||||
| return sysMonitorMapper.findList(record); | |||||
| } | |||||
| @Override | |||||
| public SysMonitor getById(Long id) { | |||||
| return sysMonitorMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(SysMonitor record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| sysMonitorMapper.insertSelective(record); | |||||
| } else { | |||||
| sysMonitorMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| sysMonitorMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -256,7 +256,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| datalist.add(wxBillAllVo); | datalist.add(wxBillAllVo); | ||||
| } | } | ||||
| } | } | ||||
| excelService.exportExcel(datalist, null, "账单数据", WxBillAllVo.class, "账单数据.xlsx", response); | |||||
| excelService.exportExcel(datalist, null, "账单数据", WxBillAllVo.class, "账单数据.xlsx", response, false); | |||||
| } | } | ||||
| private int updateBillOtherDeposit(Map<String, Object> bill) { | private int updateBillOtherDeposit(Map<String, Object> bill) { | ||||
| @@ -952,7 +952,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| list.add(oweMerchantVo); | list.add(oweMerchantVo); | ||||
| } | } | ||||
| String name = "欠缴商户列表"; | String name = "欠缴商户列表"; | ||||
| excelService.exportExcel(list,null, name, OweMerchantVo.class,name+".xlsx",response); | |||||
| excelService.exportExcel(list, null, name, OweMerchantVo.class, name + ".xlsx", response, false); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -973,6 +973,6 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| list.add(oweMerchantVo); | list.add(oweMerchantVo); | ||||
| } | } | ||||
| String name = "待缴商户列表"; | String name = "待缴商户列表"; | ||||
| excelService.exportExcel(list,null, name, WaitMerchantVo.class,name+".xlsx",response); | |||||
| excelService.exportExcel(list, null, name, WaitMerchantVo.class, name + ".xlsx", response, false); | |||||
| } | } | ||||
| } | } | ||||
| @@ -237,7 +237,7 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| v2.setExpiredDay(0L); | v2.setExpiredDay(0L); | ||||
| list.add(v2); | list.add(v2); | ||||
| excelService.exportExcel(list, null, "水电费模板", WxBillDailyVo.class, "水电费模板.xlsx", response); | |||||
| excelService.exportExcel(list, null, "水电费模板", WxBillDailyVo.class, "水电费模板.xlsx", response, true); | |||||
| } | } | ||||
| @@ -624,7 +624,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/"); | String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/"); | ||||
| u.setTagNames(tagNames); | u.setTagNames(tagNames); | ||||
| }); | }); | ||||
| excelService.exportExcel(list,null,"会员信息",WxCUserBasicInfoVo.class,"会员信息数据.xlsx",response); | |||||
| excelService.exportExcel(list, null, "会员信息", WxCUserBasicInfoVo.class, "会员信息数据.xlsx", response, false); | |||||
| } | } | ||||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | ||||
| @@ -699,7 +699,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| list.add(u2); | list.add(u2); | ||||
| list.add(u3); | list.add(u3); | ||||
| excelService.exportExcel(list,null,"会员信息模板",WxCUserBasicInfoVo.class,"会员信息模板.xlsx",response); | |||||
| excelService.exportExcel(list, null, "会员信息模板", WxCUserBasicInfoVo.class, "会员信息模板.xlsx", response, true); | |||||
| } | } | ||||
| @@ -950,7 +950,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { | public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { | ||||
| List<WxCarPayRecord> list = wxCarPayRecordMapper.findCarPayList(record); | List<WxCarPayRecord> list = wxCarPayRecordMapper.findCarPayList(record); | ||||
| String sheetName = (record.getIsPay()!=null && 1==record.getIsPay())?"线上缴费车辆列表":"进出车辆列表"; | String sheetName = (record.getIsPay()!=null && 1==record.getIsPay())?"线上缴费车辆列表":"进出车辆列表"; | ||||
| excelService.exportExcel(list,null,sheetName,WxCarPayRecord.class,sheetName+".xlsx",response); | |||||
| excelService.exportExcel(list, null, sheetName, WxCarPayRecord.class, sheetName + ".xlsx", response, false); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -3,6 +3,7 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxSharingOrderDto; | import com.iformall.domain.dto.WxSharingOrderDto; | ||||
| @@ -14,20 +15,18 @@ import com.iformall.mapper.*; | |||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxCardSpendService; | import com.iformall.service.WxCardSpendService; | ||||
| import com.iformall.service.WxProfitSharingOrderService; | import com.iformall.service.WxProfitSharingOrderService; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | |||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.*; | |||||
| import java.util.*; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @Service | @Service | ||||
| public class WxCardSpendServiceImpl implements WxCardSpendService { | public class WxCardSpendServiceImpl implements WxCardSpendService { | ||||
| @@ -499,7 +498,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| @Override | @Override | ||||
| public void exportData(WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) { | public void exportData(WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) { | ||||
| List<WxCardSpendVo> list = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo); | List<WxCardSpendVo> list = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo); | ||||
| excelService.exportExcel(list,null,"消费记录",WxCardSpendVo.class,"消费记录.xlsx",response); | |||||
| excelService.exportExcel(list, null, "消费记录", WxCardSpendVo.class, "消费记录.xlsx", response, false); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,6 +1,5 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| @@ -11,7 +10,10 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxSharingOrderDto; | import com.iformall.domain.dto.WxSharingOrderDto; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.msg.*; | |||||
| import com.iformall.domain.po.msg.AppUniformMsg; | |||||
| import com.iformall.domain.po.msg.FmInsideCouponVerifyMsg; | |||||
| import com.iformall.domain.po.msg.MpAppMsg; | |||||
| import com.iformall.domain.po.msg.SmartAppMsg; | |||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| @@ -19,7 +21,6 @@ import com.iformall.mapper.*; | |||||
| import com.iformall.mq.MqBaseProducer; | import com.iformall.mq.MqBaseProducer; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import me.chanjar.weixin.mp.bean.template.WxMpTemplateData; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -269,7 +270,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| wxMall = wxMallMapper.findList(wxMall).get(0); | wxMall = wxMallMapper.findList(wxMall).get(0); | ||||
| String filename = wxMall.getName() + DateUtils.getSystemTime("yyyyMMDDHHmmss"); | String filename = wxMall.getName() + DateUtils.getSystemTime("yyyyMMDDHHmmss"); | ||||
| List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); | List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); | ||||
| excelService.exportExcel(list, null, filename, WxCouponOrderBVo.class, filename + ".xlsx", response); | |||||
| excelService.exportExcel(list, null, filename, WxCouponOrderBVo.class, filename + ".xlsx", response, false); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1,6 +1,5 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| @@ -366,18 +365,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | ||||
| wxMerchant.setUpdateDate(date); | wxMerchant.setUpdateDate(date); | ||||
| wxMerchant.setCreateDate(date); | wxMerchant.setCreateDate(date); | ||||
| if(StringUtils.isNotBlank(wxMerchant.getCoverPicture())) { | |||||
| List<String> coverPicture = JSONArray.parseArray(wxMerchant.getCoverPicture(), String.class); | |||||
| if (!coverPicture.isEmpty()) { | |||||
| wxMerchant.setImgUrl(coverPicture.get(0)); | |||||
| } | |||||
| } else { | |||||
| if(StringUtils.isNotBlank(wxMerchant.getImgUrl())) { | |||||
| List<String> strList = new ArrayList<String>(); | |||||
| strList.add(wxMerchant.getImgUrl()); | |||||
| wxMerchant.setCoverPicture(JSONArray.toJSONString(strList)); | |||||
| } | |||||
| } | |||||
| wxMerchantMapper.insertSelective(wxMerchant); | wxMerchantMapper.insertSelective(wxMerchant); | ||||
| //关联合同 | //关联合同 | ||||
| @@ -638,7 +626,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| }); | }); | ||||
| excelService.exportExcel(list,null,"商户信息",WxMerchant.class,"商户信息数据.xlsx",response); | |||||
| excelService.exportExcel(list, null, "商户信息", WxMerchant.class, "商户信息数据.xlsx", response, false); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -3,25 +3,20 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMerchantSubsidy; | import com.iformall.domain.po.WxMerchantSubsidy; | ||||
| import com.iformall.domain.vo.WxMerchantSubsidyVo; | import com.iformall.domain.vo.WxMerchantSubsidyVo; | ||||
| import com.iformall.mapper.WxMerchantSubsidyMapper; | import com.iformall.mapper.WxMerchantSubsidyMapper; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxMerchantSubsidyService; | import com.iformall.service.WxMerchantSubsidyService; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.*; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -82,7 +77,7 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||||
| @Override | @Override | ||||
| public void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { | public void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { | ||||
| List<WxMerchantSubsidyVo> list = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy); | List<WxMerchantSubsidyVo> list = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy); | ||||
| excelService.exportExcel(list,null,"补贴记录",WxMerchantSubsidyVo.class,"补贴记录.xlsx",response); | |||||
| excelService.exportExcel(list, null, "补贴记录", WxMerchantSubsidyVo.class, "补贴记录.xlsx", response, false); | |||||
| } | } | ||||
| @@ -95,7 +95,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| //init dateDiff | //init dateDiff | ||||
| if(wxPropertyContract.getRentalStartDate() != null && wxPropertyContract.getRentalEndDate() != null){ | if(wxPropertyContract.getRentalStartDate() != null && wxPropertyContract.getRentalEndDate() != null){ | ||||
| int[] array = DateUtils.getDiff(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate()); | |||||
| //加1天 | |||||
| Date newEndDate = DateUtils.getDaySet(wxPropertyContract.getRentalEndDate(),Calendar.DATE,1); | |||||
| int[] array = DateUtils.getDiff(wxPropertyContract.getRentalStartDate(),newEndDate); | |||||
| result.put("totalPeriodMonth",array[0]); | result.put("totalPeriodMonth",array[0]); | ||||
| result.put("totalPeriodDay",array[1]); | result.put("totalPeriodDay",array[1]); | ||||
| } | } | ||||
| @@ -550,7 +552,6 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| List<BillTimeVo> billTimeVoList = WxRentContractServiceImpl.initBillTimeList(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate(),wxPropertyContract.getAdjustPeriod(),dayType,receivePeriod); | List<BillTimeVo> billTimeVoList = WxRentContractServiceImpl.initBillTimeList(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate(),wxPropertyContract.getAdjustPeriod(),dayType,receivePeriod); | ||||
| int index = 0; | int index = 0; | ||||
| for (BillTimeVo billTimeVo : billTimeVoList){ | for (BillTimeVo billTimeVo : billTimeVoList){ | ||||
| if(yearList.size() > 1) { | if(yearList.size() > 1) { | ||||
| @@ -582,13 +583,13 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| long needpay; | long needpay; | ||||
| //当天也算,加1天 | |||||
| Date newEndDate = DateUtils.getDaySet(wxBillProperty.getEndtime(),Calendar.DATE,1); | |||||
| //按日 | //按日 | ||||
| if(wxPropertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode())){ | |||||
| int dayCount = DateUtils.daysBetween(wxBillProperty.getStarttime(),newEndDate); | |||||
| needpay = dayCount*price; | |||||
| if (wxPropertyContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ | |||||
| double needpayD = WxRentContractServiceImpl.getNeedPay(0,price,wxBillProperty.getStarttime(),wxBillProperty.getEndtime()); | |||||
| needpay = new Double(needpayD).longValue(); | |||||
| }else{ | }else{ | ||||
| //当天也算,加1天 | |||||
| Date newEndDate = DateUtils.getDaySet(wxBillProperty.getEndtime(),Calendar.DATE,1); | |||||
| //按月 | //按月 | ||||
| int[] diff = DateUtils.getDiff(wxBillProperty.getStarttime(),newEndDate); | int[] diff = DateUtils.getDiff(wxBillProperty.getStarttime(),newEndDate); | ||||
| needpay = diff[0]*price; | needpay = diff[0]*price; | ||||
| @@ -674,16 +675,16 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| //按月计租 | //按月计租 | ||||
| if (propertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) | |||||
| ||propertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { | |||||
| // if (propertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) | |||||
| // ||propertyContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { | |||||
| result = buildRentMonth(wxMerchant, userId, propertyContract, receivePeriod, lease, rentalStartDate, price,isPreview); | result = buildRentMonth(wxMerchant, userId, propertyContract, receivePeriod, lease, rentalStartDate, price,isPreview); | ||||
| } else { | |||||
| //如果按日 | |||||
| List<Date> yearList = new ArrayList<>(); | |||||
| yearList.add(rentalStartDate); | |||||
| Map<String, Object> resultMap = buildRent(receivePeriod,new long[]{price}, yearList, Calendar.DAY_OF_MONTH, propertyContract, userId, wxMerchant, 0, isPreview, null); | |||||
| result = (List<WxBillProperty>)resultMap.get("billList"); | |||||
| } | |||||
| // } else { | |||||
| // //如果按日 | |||||
| // List<Date> yearList = new ArrayList<>(); | |||||
| // yearList.add(rentalStartDate); | |||||
| // Map<String, Object> resultMap = buildRent(receivePeriod,new long[]{price}, yearList, Calendar.DAY_OF_MONTH, propertyContract, userId, wxMerchant, 0, isPreview, null); | |||||
| // result = (List<WxBillProperty>)resultMap.get("billList"); | |||||
| // } | |||||
| } | } | ||||
| for (int i = 0; i < result.size(); i++) { | for (int i = 0; i < result.size(); i++) { | ||||
| result.get(i).setPeriod(i+1); | result.get(i).setPeriod(i+1); | ||||
| @@ -13,7 +13,10 @@ import com.iformall.domain.vo.BillTimeVo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.*; | |||||
| import com.iformall.service.WxFlowRecordService; | |||||
| import com.iformall.service.WxFlowService; | |||||
| import com.iformall.service.WxMerchantService; | |||||
| import com.iformall.service.WxRentContractService; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.DownFileUtil; | import com.iformall.utils.DownFileUtil; | ||||
| import com.iformall.utils.PriceUtil; | import com.iformall.utils.PriceUtil; | ||||
| @@ -37,7 +40,6 @@ import java.io.File; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.math.RoundingMode; | import java.math.RoundingMode; | ||||
| import java.text.DecimalFormat; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.*; | import java.util.*; | ||||
| @@ -118,11 +120,18 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| //init dateDiff | //init dateDiff | ||||
| if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ | if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ | ||||
| int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate()); | |||||
| //加1天 | |||||
| Date newEndDate = DateUtils.getDaySet(wxRentContract.getRentalEndDate(),Calendar.DATE,1); | |||||
| int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),newEndDate); | |||||
| result.put("totalPeriodMonth",array[0]); | result.put("totalPeriodMonth",array[0]); | ||||
| result.put("totalPeriodDay",array[1]); | result.put("totalPeriodDay",array[1]); | ||||
| } | } | ||||
| //init rentPrice | |||||
| if(StringUtils.isNotBlank(wxRentContract.getRentPrice())){ | |||||
| wxRentContract.setRentPrice(Double.parseDouble(wxRentContract.getRentPrice())/100 + ""); | |||||
| } | |||||
| //init 租赁单价 | //init 租赁单价 | ||||
| String rentInfo = wxRentContract.getRentInfo(); | String rentInfo = wxRentContract.getRentInfo(); | ||||
| if(StringUtils.isNotBlank(rentInfo)){ | if(StringUtils.isNotBlank(rentInfo)){ | ||||
| @@ -665,7 +674,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| logger.info("合同id:{},开始停止...", id); | logger.info("合同id:{},开始停止...", id); | ||||
| //结束审批流 by luozukai | //结束审批流 by luozukai | ||||
| List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(WxFlowServiceImpl.getFlowKeyByType(1)) | List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(WxFlowServiceImpl.getFlowKeyByType(1)) | ||||
| .processVariableValueEquals("businessId", id).list(); | |||||
| .processVariableValueEquals("businessId", id+"").list(); | |||||
| if (!CollectionUtils.isEmpty(tasks)) { | if (!CollectionUtils.isEmpty(tasks)) { | ||||
| for (Task task : tasks) { | for (Task task : tasks) { | ||||
| logger.info("合同id:{},taskid:{}", id, task.getId()); | logger.info("合同id:{},taskid:{}", id, task.getId()); | ||||
| @@ -715,16 +724,16 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| //按月计租 | //按月计租 | ||||
| if (wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) | |||||
| ||wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { | |||||
| // if (wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode()) | |||||
| // ||wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode())) { | |||||
| rentList = buildRentMonth(wxMerchant, userId, wxRentContract, receivePeriod, lease, rentalStartDate, price,isPreview); | rentList = buildRentMonth(wxMerchant, userId, wxRentContract, receivePeriod, lease, rentalStartDate, price,isPreview); | ||||
| } else { | |||||
| //如果按日 | |||||
| List<Date> yearList = new ArrayList<>(); | |||||
| yearList.add(rentalStartDate); | |||||
| Map<String, Object> resultMap = buildRent(receivePeriod, new long[]{price}, yearList, Calendar.DAY_OF_MONTH, wxRentContract, userId, wxMerchant, 0, isPreview,null); | |||||
| rentList = ( List<WxBillRent>)resultMap.get("billList"); | |||||
| } | |||||
| // } else { | |||||
| // //如果按日 | |||||
| // List<Date> yearList = new ArrayList<>(); | |||||
| // yearList.add(rentalStartDate); | |||||
| // Map<String, Object> resultMap = buildRent(receivePeriod, new long[]{price}, yearList, Calendar.DAY_OF_MONTH, wxRentContract, userId, wxMerchant, 0, isPreview,null); | |||||
| // rentList = ( List<WxBillRent>)resultMap.get("billList"); | |||||
| // } | |||||
| } | } | ||||
| for (int i = 0; i < rentList.size(); i++) { | for (int i = 0; i < rentList.size(); i++) { | ||||
| rentList.get(i).setPeriod(i+1); | rentList.get(i).setPeriod(i+1); | ||||
| @@ -868,6 +877,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| List<BillTimeVo> billTimeVoList = initBillTimeList(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate(),wxRentContract.getAdjustPeriod(),dayType,receivePeriod); | List<BillTimeVo> billTimeVoList = initBillTimeList(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate(),wxRentContract.getAdjustPeriod(),dayType,receivePeriod); | ||||
| // for (BillTimeVo vo:billTimeVoList) { | |||||
| // System.out.println(sd.format(vo.getStartDate()) + " "+sd.format(vo.getEndDate()) ); | |||||
| // } | |||||
| int index = 0; | int index = 0; | ||||
| for (BillTimeVo billTimeVo : billTimeVoList){ | for (BillTimeVo billTimeVo : billTimeVoList){ | ||||
| @@ -923,13 +935,13 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| long needpay; | long needpay; | ||||
| //当天也算,加1天 | |||||
| Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1); | |||||
| //按日 | //按日 | ||||
| if(wxRentContract.getAdjustPeriod().equals(EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode())){ | |||||
| int dayCount = DateUtils.daysBetween(wxBillRent.getStarttime(),newEndDate); | |||||
| needpay = dayCount*price; | |||||
| if (wxRentContract.getPriceUnit().equals(EnumPriceUnit.D.getCode())){ | |||||
| double needpayD = WxRentContractServiceImpl.getNeedPay(0,price,wxBillRent.getStarttime(),wxBillRent.getEndtime()); | |||||
| needpay = new Double(needpayD).longValue(); | |||||
| }else{ | }else{ | ||||
| //当天也算,加1天 | |||||
| Date newEndDate = DateUtils.getDaySet(wxBillRent.getEndtime(),Calendar.DATE,1); | |||||
| //按月 | //按月 | ||||
| int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),newEndDate); | int[] diff = DateUtils.getDiff(wxBillRent.getStarttime(),newEndDate); | ||||
| needpay = diff[0]*price; | needpay = diff[0]*price; | ||||
| @@ -937,6 +949,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxRentContract.getRentalEndDate()); | double oneDayProce = (double) price/DateUtils.getMonthDayCount(wxRentContract.getRentalEndDate()); | ||||
| needpay += diff[1] * oneDayProce; | needpay += diff[1] * oneDayProce; | ||||
| } | } | ||||
| wxBillRent.setNeedPay(needpay); | wxBillRent.setNeedPay(needpay); | ||||
| wxBillRent.setOwe(needpay); | wxBillRent.setOwe(needpay); | ||||
| wxBillRent.setReceivePay(needpay); | wxBillRent.setReceivePay(needpay); | ||||
| @@ -963,7 +976,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxBillRent.setRevenue(0L); | wxBillRent.setRevenue(0L); | ||||
| wxBillRent.setTenantId(wxRentContract.getTenantId()); | wxBillRent.setTenantId(wxRentContract.getTenantId()); | ||||
| wxBillRent.setIsDel(0); | wxBillRent.setIsDel(0); | ||||
| wxBillRent.setMerchantId(wxMerchant.getId()); | |||||
| wxBillRent.setMerchantId(wxRentContract.getMerchantId()); | |||||
| wxBillRent.setUserId(userId); | wxBillRent.setUserId(userId); | ||||
| wxBillRent.setShopId(wxRentContract.getShopId()); | wxBillRent.setShopId(wxRentContract.getShopId()); | ||||
| wxBillRent.setCreatetime(date); | wxBillRent.setCreatetime(date); | ||||
| @@ -1375,13 +1388,20 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| double priceRent = new BigDecimal(wxRentContract.getPrice()) | double priceRent = new BigDecimal(wxRentContract.getPrice()) | ||||
| .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | ||||
| result.put("priceRent", priceRent); | result.put("priceRent", priceRent); | ||||
| double unitPrice = new BigDecimal(wxRentContract.getPrice()) | |||||
| .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) | |||||
| .divide(new BigDecimal(100)) | |||||
| .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||||
| result.put("unitPriceRent", unitPrice); | |||||
| result.put("priceRentUpper", PriceUtil.digitUppercase(priceRent)); | |||||
| result.put("unitPriceRentUpper", PriceUtil.digitUppercase(unitPrice)); | |||||
| if (!wxRentContract.getRentArea().equals("0")) { | |||||
| double unitPrice = new BigDecimal(wxRentContract.getPrice()) | |||||
| .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) | |||||
| .divide(new BigDecimal(100)) | |||||
| .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||||
| result.put("unitPriceRent", unitPrice); | |||||
| result.put("priceRentUpper", PriceUtil.digitUppercase(priceRent)); | |||||
| result.put("unitPriceRentUpper", PriceUtil.digitUppercase(unitPrice)); | |||||
| } else { | |||||
| result.put("unitPriceRent", 0); | |||||
| result.put("priceRentUpper", "0"); | |||||
| result.put("unitPriceRentUpper", "0"); | |||||
| } | |||||
| //租赁保证金 | //租赁保证金 | ||||
| int cashDepositMonthRent = 3; | int cashDepositMonthRent = 3; | ||||
| double cashDepositRent = new BigDecimal(wxRentContract.getPrice()).multiply(new BigDecimal(cashDepositMonthRent)) | double cashDepositRent = new BigDecimal(wxRentContract.getPrice()).multiply(new BigDecimal(cashDepositMonthRent)) | ||||
| @@ -1728,25 +1748,78 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return wxRentContractMapper.getShopType(wxRentContract); | return wxRentContractMapper.getShopType(wxRentContract); | ||||
| } | } | ||||
| public static void main(String[] args) throws Exception{ | |||||
| /** | |||||
| * 按日计租 根据每月的日期总数计算needpay | |||||
| * @param monthPrice | |||||
| * @param start | |||||
| * @param end | |||||
| * @return | |||||
| */ | |||||
| public static double getNeedPay(long monthPrice,long dayPrice,Date start,Date end){ | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | ||||
| // Date start = sd.parse("2019-05-24"); | |||||
| // Date end = sd.parse("2020-06-24"); | |||||
| Date start = sd.parse("2019-05-24"); | |||||
| Date end = sd.parse("2019-08-10"); | |||||
| SimpleDateFormat sdM = new SimpleDateFormat("yyyy-MM"); | |||||
| Double total; | |||||
| int[] diff; | |||||
| int dayCount = DateUtils.getMonthDayCount(start); | |||||
| double price; | |||||
| if(monthPrice > 0){ | |||||
| price = (double) monthPrice/dayCount; | |||||
| }else{ | |||||
| price = dayPrice; | |||||
| } | |||||
| Integer adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_NAR_MONTH.getCode(); | |||||
| Integer dayType = Calendar.MONTH; | |||||
| int receivePeriod = 2; | |||||
| //同一天 | |||||
| if(sd.format(start).equals(sd.format(end))){ | |||||
| return 1 * price; //算1天 | |||||
| } | |||||
| //同月 | |||||
| if(sdM.format(start).equals(sdM.format(end))){ | |||||
| diff = DateUtils.getDiff(start,end); | |||||
| return (diff[1]+1) * price; | |||||
| } | |||||
| List<BillTimeVo> list = initBillTimeList(start,end,adjustPeriod,dayType,receivePeriod); | |||||
| for (BillTimeVo b:list) { | |||||
| System.out.print(sd.format(b.getStartDate())); | |||||
| System.out.print(" "+sd.format(b.getEndDate())); | |||||
| System.out.print(" "+sd.format(b.getReceiveDate())); | |||||
| Date currEnd = DateUtils.getLastDayForMonth(start); | |||||
| diff = DateUtils.getDiff(start,currEnd); | |||||
| total = (diff[1]+1) * price; | |||||
| System.out.println(); | |||||
| while (true){ | |||||
| Date monthStartDate = DateUtils.getDaySet(currEnd,Calendar.DATE,1); | |||||
| dayCount = DateUtils.getMonthDayCount(monthStartDate); | |||||
| if(monthPrice > 0){ | |||||
| price = (double) monthPrice/dayCount; | |||||
| }else{ | |||||
| price = dayPrice; | |||||
| } | |||||
| System.out.println("-------monthStartDate:"+sd.format(monthStartDate)); | |||||
| System.out.println("-------monthStartDate:"+sd.format(end)); | |||||
| //最后一个月 | |||||
| if(sdM.format(monthStartDate).equals(sdM.format(end))){ | |||||
| System.out.println("-----------"); | |||||
| System.out.println(sd.format(monthStartDate)); | |||||
| System.out.println(sd.format(end)); | |||||
| diff = DateUtils.getDiff(monthStartDate,end); | |||||
| total += price * (diff[1] +1); | |||||
| break; | |||||
| }else{ | |||||
| currEnd = DateUtils.getLastDayForMonth(monthStartDate); | |||||
| diff = DateUtils.getDiff(monthStartDate,currEnd); | |||||
| total += price * (diff[1] +1); | |||||
| } | |||||
| } | } | ||||
| return total; | |||||
| } | |||||
| public static void main(String[] args) throws Exception{ | |||||
| long tprice = 100; | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| Date start = sd.parse("2019-05-13"); | |||||
| Date end = sd.parse("2019-07-05"); | |||||
| System.out.println("===="+new WxRentContractServiceImpl().getNeedPay(tprice,0,start,end));; | |||||
| } | } | ||||
| public static List<BillTimeVo> initBillTimeList(Date start,Date end,Integer adjustPeriod,Integer dayType,int receivePeriod){ | public static List<BillTimeVo> initBillTimeList(Date start,Date end,Integer adjustPeriod,Integer dayType,int receivePeriod){ | ||||
| @@ -1804,3 +1877,4 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| @@ -189,7 +189,7 @@ public class WxShopServiceImpl implements WxShopService { | |||||
| public void exportShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) { | public void exportShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) { | ||||
| List<WxShopVo> list = wxShopMapper.findListWithMerchantMap(wxShop); | List<WxShopVo> list = wxShopMapper.findListWithMerchantMap(wxShop); | ||||
| String name = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表"; | String name = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表"; | ||||
| excelService.exportExcel(list,null, name, WxShopVo.class,name+".xlsx",response); | |||||
| excelService.exportExcel(list, null, name, WxShopVo.class, name + ".xlsx", response, false); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -212,6 +212,6 @@ public class WxShopServiceImpl implements WxShopService { | |||||
| notRentShopVoList.add(notRentShopVo); | notRentShopVoList.add(notRentShopVo); | ||||
| } | } | ||||
| String name = "未出租商铺列表"; | String name = "未出租商铺列表"; | ||||
| excelService.exportExcel(notRentShopVoList,null, name, WxNotRentShopVo.class,name+".xlsx",response); | |||||
| excelService.exportExcel(notRentShopVoList, null, name, WxNotRentShopVo.class, name + ".xlsx", response, false); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1092,8 +1092,12 @@ public class DateUtils { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static int[] getDiff(Date startDate,Date endDate) { | public static int[] getDiff(Date startDate,Date endDate) { | ||||
| ZoneId zone = ZoneId.systemDefault(); | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| if(sd.format(startDate).equals(sd.format(endDate))){ | |||||
| return new int[] {0, 1}; | |||||
| } | |||||
| ZoneId zone = ZoneId.systemDefault(); | |||||
| LocalDateTime localDateTime = LocalDateTime.ofInstant(startDate.toInstant(), zone); | LocalDateTime localDateTime = LocalDateTime.ofInstant(startDate.toInstant(), zone); | ||||
| LocalDate start = localDateTime.toLocalDate(); | LocalDate start = localDateTime.toLocalDate(); | ||||
| @@ -0,0 +1,56 @@ | |||||
| <?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="com.iformall.mapper.SysMonitorMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.SysMonitor"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||||
| <result column="url" jdbcType="VARCHAR" property="url" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||||
| <result column="deploy" jdbcType="INTEGER" property="deploy" /> | |||||
| <result column="err_msg" jdbcType="VARCHAR" property="errMsg" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`name`,`url`,`type`,`deploy`,`err_msg` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != name "> | |||||
| and `name` = #{name} | |||||
| </if> | |||||
| <if test=" null != url "> | |||||
| and `url` = #{url} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != deploy "> | |||||
| and `deploy` = #{deploy} | |||||
| </if> | |||||
| <if test=" null != errMsg "> | |||||
| and `err_msg` like concat('%', #{errMsg},'%') | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.SysMonitor" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from sys_monitor | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -24,7 +24,7 @@ | |||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | ||||
| `create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time` | `create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time` | ||||
| ,(select level from wx_level_config where poins >= points order by points desc limit 1 ) level | |||||
| ,(select level from wx_level_config where poins >= points and tenant_id=#{tenantId} order by points desc limit 1 ) level | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -46,6 +46,7 @@ | |||||
| <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | <result column="file_names" jdbcType="VARCHAR" property="fileNames"/> | ||||
| <result column="price_unit" property="priceUnit"/> | <result column="price_unit" property="priceUnit"/> | ||||
| <result column="rent_price" property="rentPrice"/> | <result column="rent_price" property="rentPrice"/> | ||||
| <result column="subject_name" property="subjectName"/> | |||||
| </resultMap> | </resultMap> | ||||
| @@ -56,7 +57,7 @@ | |||||
| `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | ||||
| `start_date`,`end_date`, | `start_date`,`end_date`, | ||||
| `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`, | `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`, | ||||
| `business_type`,`rent_info`, `file_names`,price_unit,rent_price | |||||
| `business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name` | |||||
| </sql> | </sql> | ||||
| @@ -115,7 +116,8 @@ | |||||
| rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, | rc.lease,rc.filepath,rc.filename,rc.pay_account payAccount,rc.sign_date signDate,rc.merchant_id merchantId,rc.type, | ||||
| rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name | rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name | ||||
| bankName,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate | bankName,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate | ||||
| ,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names fileNames,rc.price_unit | |||||
| ,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names | |||||
| fileNames,rc.price_unit,rc.subject_name subjectName | |||||
| from wx_rent_contract rc | from wx_rent_contract rc | ||||
| left join wx_shop s on rc.shop_id=s.id | left join wx_shop s on rc.shop_id=s.id | ||||
| left join wx_mall_floor f on s.floor=f.id | left join wx_mall_floor f on s.floor=f.id | ||||