| @@ -4,19 +4,22 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxMerchantTradeDaily; | |||||
| import com.iformall.domain.vo.WxMerchantTradeDailyVo; | import com.iformall.domain.vo.WxMerchantTradeDailyVo; | ||||
| import com.iformall.service.WxMerchantTradeDailyService; | import com.iformall.service.WxMerchantTradeDailyService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.collections.CollectionUtils; | |||||
| import org.apache.commons.collections.map.LinkedMap; | |||||
| 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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.Calendar; | |||||
| import java.util.Date; | |||||
| import java.util.*; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxMerchantTradeDaily") | @RequestMapping("wxMerchantTradeDaily") | ||||
| @@ -84,4 +87,92 @@ public class WxMerchantTradeDailyController extends BaseController { | |||||
| //// /** | |||||
| //// * 详情 | |||||
| //// * @param wxMerchantTradeDaily | |||||
| //// * @return | |||||
| //// */ | |||||
| //// @ApiOperation("详情") | |||||
| //// @GetMapping("findById") | |||||
| //// public ResultData findById(WxMerchantTradeDaily wxMerchantTradeDaily) { | |||||
| //// logger.debug("[" + getIpAddr() + "] wxMerchantTradeDaily::findById"); | |||||
| //// String tenantId = getTenantId(); | |||||
| //// wxMerchantTradeDaily.setTenantId(tenantId); | |||||
| //// return new ResultData(wxMerchantTradeDailyService.getById(wxMerchantTradeDaily.getId())); | |||||
| //// } | |||||
| //// | |||||
| //// /** | |||||
| //// * 保存或编辑 | |||||
| //// * @param wxMerchantTradeDaily | |||||
| //// * @return | |||||
| //// */ | |||||
| //// @ApiOperation("保存或编辑") | |||||
| //// @PostMapping("saveOrUpdate") | |||||
| //// public ResultData saveOrUpdate(@RequestBody WxMerchantTradeDaily wxMerchantTradeDaily) { | |||||
| //// logger.debug("[" + getIpAddr() + "] wxMerchantTradeDaily::saveOrUpdate"); | |||||
| //// wxMerchantTradeDaily.setTenantId(super.getTenantId()); | |||||
| //// wxMerchantTradeDailyService.saveOrUpdate(wxMerchantTradeDaily); | |||||
| //// return new ResultData(); | |||||
| //// } | |||||
| // | |||||
| // /** | |||||
| // * 列表 | |||||
| // * | |||||
| // * @param wxMerchantTradeDaily | |||||
| // * @return | |||||
| // */ | |||||
| // @ApiImplicitParams({ | |||||
| // @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| // @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true) | |||||
| // }) | |||||
| // public ResultData list(WxMerchantTradeDaily wxMerchantTradeDaily, Integer pageNum,Integer pageSize) throws Exception{ | |||||
| // PageInfo<WxMerchantTradeDaily> pageInfo = wxMerchantTradeDailyService.listAsPage(wxMerchantTradeDaily, pageNum,pageSize); | |||||
| // List<WxMerchantTradeDaily> tradeDailyList = pageInfo.getList(); | |||||
| // SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| // | |||||
| // //todo:看下数据是不是每天一条解单 | |||||
| // | |||||
| // String startTime = wxMerchantTradeDaily.getMonth()+"-01"; | |||||
| // String endTime = sd.format(DateUtils.getLastDayForMonth(sd.parse(startTime))); | |||||
| // List<String> days = DateUtils.getTjTimeList(startTime, endTime,"0"); | |||||
| // | |||||
| // Map<String,WxMerchantTradeDaily> resultMap = getMap(days); | |||||
| // | |||||
| // for (WxMerchantTradeDaily wx:tradeDailyList) { | |||||
| // resultMap.put(sd.format(wx.getCreateDate()),wx); | |||||
| // } | |||||
| // | |||||
| // List<WxMerchantTradeDaily> resultList = mapToList(resultMap); | |||||
| // //判断第1条是否是当天 | |||||
| // if(CollectionUtils.isNotEmpty(resultList)){ | |||||
| // if(sd.format(resultList.get(0).getCreateDate()).equals(sd.format(new Date()))){ | |||||
| // resultList.get(0).setIsToday(1); | |||||
| // } | |||||
| // } | |||||
| // | |||||
| // //todo如果是本月,截止日期应该是到当天,而不是整月 | |||||
| // | |||||
| // pageInfo.setList(resultList); | |||||
| // return new ResultData(pageInfo); | |||||
| // } | |||||
| // | |||||
| // public List<WxMerchantTradeDaily> mapToList(Map<String,WxMerchantTradeDaily> map){ | |||||
| // List<WxMerchantTradeDaily> result = new ArrayList<>(); | |||||
| // for (String k:map.keySet()) { | |||||
| // result.add(map.get(k)); | |||||
| // } | |||||
| // return result; | |||||
| // } | |||||
| // | |||||
| // public Map<String,WxMerchantTradeDaily> getMap(List<String> days) throws Exception{ | |||||
| // SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| // Map<String,WxMerchantTradeDaily> map = new LinkedMap(); | |||||
| // for (String d:days) { | |||||
| // WxMerchantTradeDaily w = new WxMerchantTradeDaily(); | |||||
| // w.setCreateDate(sd.parse(d)); | |||||
| // map.put(d,w); | |||||
| // } | |||||
| // return map; | |||||
| // } | |||||
| } | } | ||||
| @@ -166,7 +166,7 @@ public class HomeController extends BaseController { | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| map.put("username", info.getUsername()); | map.put("username", info.getUsername()); | ||||
| map.put("withWechat", info.getWithWechat()); | |||||
| map.put("withWechat", info.getWithWechatFormat()); | |||||
| data.data = map; | data.data = map; | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| @@ -259,7 +259,7 @@ public class HomeController extends BaseController { | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| map.put("username", info.getUsername()); | map.put("username", info.getUsername()); | ||||
| map.put("withWechat", info.getWithWechat()); | |||||
| map.put("withWechat", info.getWithWechatFormat()); | |||||
| data.data = map; | data.data = map; | ||||
| } catch(Exception e){ | } catch(Exception e){ | ||||
| @@ -359,7 +359,7 @@ public class HomeController extends BaseController { | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| map.put("username", info.getUsername()); | map.put("username", info.getUsername()); | ||||
| map.put("withWechat", info.getWithWechat()); | |||||
| map.put("withWechat", info.getWithWechatFormat()); | |||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| @@ -1,17 +1,27 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMerchantTradeDaily; | import com.iformall.domain.po.WxMerchantTradeDaily; | ||||
| import com.iformall.service.WxMerchantTradeDailyService; | import com.iformall.service.WxMerchantTradeDailyService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.collections.CollectionUtils; | |||||
| import org.apache.commons.collections.map.LinkedMap; | |||||
| 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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/wxMerchantTradeDaily") | @RequestMapping("/api/wxMerchantTradeDaily") | ||||
| @Api(description = "解单相关接口") | @Api(description = "解单相关接口") | ||||
| @@ -71,14 +81,62 @@ public class WxMerchantTradeDailyController extends BaseController { | |||||
| /** | /** | ||||
| * 列表 | * 列表 | ||||
| * | |||||
| * @param wxMerchantTradeDaily | * @param wxMerchantTradeDaily | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(WxMerchantTradeDaily wxMerchantTradeDaily, Integer pageNum, Integer pageSize) { | |||||
| return new ResultData(wxMerchantTradeDailyService.listAsPage(wxMerchantTradeDaily, pageNum,pageSize)); | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true) | |||||
| }) | |||||
| public ResultData list(WxMerchantTradeDaily wxMerchantTradeDaily, Integer pageNum,Integer pageSize) throws Exception{ | |||||
| PageInfo<WxMerchantTradeDaily> pageInfo = wxMerchantTradeDailyService.listAsPage(wxMerchantTradeDaily, pageNum,pageSize); | |||||
| List<WxMerchantTradeDaily> tradeDailyList = pageInfo.getList(); | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| //todo:看下数据是不是每天一条解单 | |||||
| String startTime = wxMerchantTradeDaily.getMonth()+"-01"; | |||||
| String endTime = sd.format(DateUtils.getLastDayForMonth(sd.parse(startTime))); | |||||
| List<String> days = DateUtils.getTjTimeList(startTime, endTime,"0"); | |||||
| Map<String,WxMerchantTradeDaily> resultMap = getMap(days); | |||||
| for (WxMerchantTradeDaily wx:tradeDailyList) { | |||||
| resultMap.put(sd.format(wx.getCreateDate()),wx); | |||||
| } | |||||
| List<WxMerchantTradeDaily> resultList = mapToList(resultMap); | |||||
| //判断第1条是否是当天 | |||||
| if(CollectionUtils.isNotEmpty(resultList)){ | |||||
| if(sd.format(resultList.get(0).getCreateDate()).equals(sd.format(new Date()))){ | |||||
| resultList.get(0).setIsToday(1); | |||||
| } | |||||
| } | |||||
| //todo如果是本月,截止日期应该是到当天,而不是整月 | |||||
| pageInfo.setList(resultList); | |||||
| return new ResultData(pageInfo); | |||||
| } | |||||
| public List<WxMerchantTradeDaily> mapToList(Map<String,WxMerchantTradeDaily> map){ | |||||
| List<WxMerchantTradeDaily> result = new ArrayList<>(); | |||||
| for (String k:map.keySet()) { | |||||
| result.add(map.get(k)); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| public Map<String,WxMerchantTradeDaily> getMap(List<String> days) throws Exception{ | |||||
| SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| Map<String,WxMerchantTradeDaily> map = new LinkedMap(); | |||||
| for (String d:days) { | |||||
| WxMerchantTradeDaily w = new WxMerchantTradeDaily(); | |||||
| w.setCreateDate(sd.parse(d)); | |||||
| map.put(d,w); | |||||
| } | |||||
| return map; | |||||
| } | } | ||||
| } | } | ||||
| @@ -16,9 +16,8 @@ import java.util.List; | |||||
| @Table(name = "mall_user_info") | @Table(name = "mall_user_info") | ||||
| @Data | @Data | ||||
| public class MallUserInfo implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| public class MallUserInfo extends BaseEntity { | |||||
| @Id | @Id | ||||
| protected Long id; | protected Long id; | ||||
| @@ -34,13 +33,13 @@ public class MallUserInfo implements Serializable { | |||||
| public void setId(Long id) { | public void setId(Long id) { | ||||
| this.id = id; | this.id = id; | ||||
| } | } | ||||
| @Override | |||||
| public String getSortColumns() { | public String getSortColumns() { | ||||
| return sortColumns; | |||||
| super.setSortColumns(this.sortColumns); | |||||
| return super.getSortColumns(); | |||||
| } | } | ||||
| /**租户ID**/ | /**租户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| @@ -227,14 +226,18 @@ public class MallUserInfo implements Serializable { | |||||
| } | } | ||||
| public Integer getWithWechat() { | public Integer getWithWechat() { | ||||
| if(StringUtils.isNotBlank(this.webOpenId)) { | |||||
| this.withWechat = EnumUserWechat.HAD.getCode(); | |||||
| } else { | |||||
| this.withWechat = EnumUserWechat.NO.getCode(); | |||||
| } | |||||
| return this.withWechat; | return this.withWechat; | ||||
| } | } | ||||
| public Integer getWithWechatFormat() { | |||||
| if(StringUtils.isNotBlank(this.webOpenId)) { | |||||
| this.withWechat = EnumUserWechat.HAD.getCode(); | |||||
| } else { | |||||
| this.withWechat = EnumUserWechat.NO.getCode(); | |||||
| } | |||||
| return this.withWechat; | |||||
| } | |||||
| public void setWithWechat(Integer withWechat) { | public void setWithWechat(Integer withWechat) { | ||||
| this.withWechat = withWechat; | this.withWechat = withWechat; | ||||
| } | } | ||||
| @@ -67,6 +67,31 @@ public class WxMerchantTradeDaily implements Serializable { | |||||
| /*凭证**/ | /*凭证**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value = "凭证", name = "proof") | @io.swagger.annotations.ApiModelProperty(value = "凭证", name = "proof") | ||||
| private String proof; | private String proof; | ||||
| /*月份*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "月份如2019-05", name = "month") | |||||
| @Transient | |||||
| private String month; | |||||
| /*是否是当天*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否是当天 1是", name = "isToday") | |||||
| @Transient | |||||
| private Integer isToday; | |||||
| public Integer getIsToday() { | |||||
| return isToday; | |||||
| } | |||||
| public void setIsToday(Integer isToday) { | |||||
| this.isToday = isToday; | |||||
| } | |||||
| public String getMonth() { | |||||
| return month; | |||||
| } | |||||
| public void setMonth(String month) { | |||||
| this.month = month; | |||||
| } | |||||
| public String getTradeCount() { | public String getTradeCount() { | ||||
| return tradeCount; | return tradeCount; | ||||
| @@ -84,7 +84,14 @@ | |||||
| <if test=" null != email "> | <if test=" null != email "> | ||||
| and `email` = #{email} | and `email` = #{email} | ||||
| </if> | </if> | ||||
| <if test="null != withWechat "> | |||||
| <if test="0 == withWechat "> | |||||
| and `web_open_id` is not null | |||||
| </if> | |||||
| <if test="1 == withWechat "> | |||||
| and `web_open_id` is null | |||||
| </if> | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| @@ -56,7 +56,9 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != reportDate "> | <if test=" null != reportDate "> | ||||
| and `report_date` = #{reportDate} | and `report_date` = #{reportDate} | ||||
| </if> | |||||
| <if test=" null != month "> | |||||
| and date_format(create_date,'%Y-%m')=#{month} | |||||
| </if> | </if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| @@ -166,7 +166,7 @@ public class HomeController extends BaseController { | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| map.put("username", info.getUsername()); | map.put("username", info.getUsername()); | ||||
| map.put("withWechat", info.getWithWechat()); | |||||
| map.put("withWechat", info.getWithWechatFormat()); | |||||
| data.data = map; | data.data = map; | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| @@ -259,7 +259,7 @@ public class HomeController extends BaseController { | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| map.put("username", info.getUsername()); | map.put("username", info.getUsername()); | ||||
| map.put("withWechat", info.getWithWechat()); | |||||
| map.put("withWechat", info.getWithWechatFormat()); | |||||
| data.data = map; | data.data = map; | ||||
| } catch(Exception e){ | } catch(Exception e){ | ||||
| @@ -359,7 +359,7 @@ public class HomeController extends BaseController { | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| map.put("username", info.getUsername()); | map.put("username", info.getUsername()); | ||||
| map.put("withWechat", info.getWithWechat()); | |||||
| map.put("withWechat", info.getWithWechatFormat()); | |||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||