Преглед изворни кода

[租金管理][修改]业务接口

release_toaliyun_real
gongbiao пре 7 година
родитељ
комит
844e4dd914
11 измењених фајлова са 598 додато и 17 уклоњено
  1. +67
    -0
      mallinkAdmin/src/main/java/com/simple/controller/WxBillRentController.java
  2. +15
    -2
      mallinkAdmin/src/main/java/com/simple/controller/WxShopController.java
  3. +262
    -0
      mallinkService/src/main/java/com/simple/domain/po/WxBillRent.java
  4. +15
    -0
      mallinkService/src/main/java/com/simple/mapper/WxBillRentMapper.java
  5. +4
    -0
      mallinkService/src/main/java/com/simple/mapper/WxShopMapper.java
  6. +48
    -0
      mallinkService/src/main/java/com/simple/service/WxBillRentService.java
  7. +6
    -7
      mallinkService/src/main/java/com/simple/service/WxShopService.java
  8. +55
    -0
      mallinkService/src/main/java/com/simple/service/impl/WxBillRentServiceImpl.java
  9. +21
    -8
      mallinkService/src/main/java/com/simple/service/impl/WxShopServiceImpl.java
  10. +94
    -0
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml
  11. +11
    -0
      mallinkService/src/main/resources/mapper/WxShopMapper.xml

+ 67
- 0
mallinkAdmin/src/main/java/com/simple/controller/WxBillRentController.java Прегледај датотеку

@@ -0,0 +1,67 @@
package com.simple.controller;

import com.github.pagehelper.PageInfo;
import com.simple.common.Result;
import com.simple.common.ResultData;
import com.simple.domain.po.WxBillRent;
import com.simple.service.WxBillRentService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("wxBillRent")
public class WxBillRentController extends BaseController
{
@Autowired
private WxBillRentService wxBillRentService;

private Logger logger = Logger.getLogger(WxBillRentController.class);

@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true),
@ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)})
public ResultData list(@ModelAttribute WxBillRent wxBillRent,Integer pageNum, Integer pageSize) {
if (null == wxBillRent) wxBillRent = new WxBillRent();
wxBillRent.setTenantId(getTenantId());
wxBillRent.setSortColumns(WxBillRent.Field.Id_DESC);
final PageInfo<Map<String, Object>> page = wxBillRentService.listAsPage(wxBillRent, pageNum, pageSize);
return new ResultData(page);
}

@PostMapping("add")
public ResultData add(@RequestBody WxBillRent wxBillRent) {
//Assert.notNull(wxBillRent.getName(), "角色名不能为空");
//Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名");
wxBillRent.setTenantId(getTenantId());
wxBillRentService.saveOrUpdate(wxBillRent);
return new ResultData();
}

@PostMapping("update")
public ResultData update(@RequestBody WxBillRent wxBillRent) {
wxBillRentService.saveOrUpdate(wxBillRent);
return new ResultData();
}

@GetMapping("/del")
@ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true)
public ResultData delete(String id) {
wxBillRentService.deleteById(id);
return new ResultData(Result.SUCCESS, "删除成功", null);
}
@GetMapping("/findById")
@ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true)
public ResultData findById(String id) {
return new ResultData(Result.SUCCESS,"查询成功",wxBillRentService.getById(id));
}
}

+ 15
- 2
mallinkAdmin/src/main/java/com/simple/controller/WxShopController.java Прегледај датотеку

@@ -69,7 +69,20 @@ public class WxShopController extends BaseController
public ResultData findById(Long id) {
return new ResultData(Result.SUCCESS,"查询成功",wxShopService.getById(id));
}

@ApiOperation("获取商铺数据")
@GetMapping("getShopListByShopNumber")
@ApiImplicitParam(name="shopNumber",value="shopNumber",dataType="String", paramType = "query",required=true)
public ResultData getbshoplist(String shopNumber) {
return wxShopService.getbshoplist(getTenantId(),shopNumber);
}

@ApiOperation("获取商户商铺数据")
@GetMapping("getMerchantShopByShopId")
@ApiImplicitParam(name="shopId",value="shopId",dataType="String", paramType = "query",required=true)
public ResultData getMerchantShopByShopId(String shopId) {
return wxShopService.getMerchantShopByShopId(getTenantId(),shopId);
}

}

+ 262
- 0
mallinkService/src/main/java/com/simple/domain/po/WxBillRent.java Прегледај датотеку

@@ -0,0 +1,262 @@
package com.simple.domain.po;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Table(name = "wx_bill_rent")
public class WxBillRent implements Serializable {
private static final long serialVersionUID = 1L;
@Id
protected String id;
@Transient
protected List<String> ids;
@Transient
protected String sortColumns;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSortColumns() {
return sortColumns;
}
public List<String> getIds() {
return ids;
}
public void setIds(List<String> ids) {
this.ids = ids;
}

@Transient
protected WxMerchant wxMerchant;

@Transient
protected WxShop wxShop;


/*商铺ID**/
@io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId")
private Integer shopId;
/*使用面积**/
@io.swagger.annotations.ApiModelProperty(value="使用面积",name="userArea")
private BigDecimal userArea;
/*单价**/
@io.swagger.annotations.ApiModelProperty(value="单价",name="price")
private BigDecimal price;
/*应缴金额**/
@io.swagger.annotations.ApiModelProperty(value="应缴金额",name="needPay")
private BigDecimal needPay;
/*应收金额**/
@io.swagger.annotations.ApiModelProperty(value="应收金额",name="receivePay")
private BigDecimal receivePay;
/*实收金额**/
@io.swagger.annotations.ApiModelProperty(value="实收金额",name="pay")
private BigDecimal pay;
/*缴费周期**/
@io.swagger.annotations.ApiModelProperty(value="缴费周期",name="receivePeriod")
private Integer receivePeriod;
/*收款日期**/
@io.swagger.annotations.ApiModelProperty(value="收款日期",name="receiveDate")
private Date receiveDate;
/*到账日期**/
@io.swagger.annotations.ApiModelProperty(value="到账日期",name="payDate")
private Date payDate;
/*创建时间**/
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime")
private Date createtime;
/*逾期天数**/
@io.swagger.annotations.ApiModelProperty(value="逾期天数",name="expiredDay")
private Integer expiredDay;
/*付款方式:1微信2支付宝3银行4现金**/
@io.swagger.annotations.ApiModelProperty(value="付款方式:1微信2支付宝3银行4现金",name="payWay")
private Integer payWay;
/*单据编号**/
@io.swagger.annotations.ApiModelProperty(value="单据编号",name="receiptNum")
private String receiptNum;

/*租户ID**/
@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
private String tenantId;

public Integer getShopId() {
return shopId;
}
public void setShopId(Integer _shopId) {
shopId = _shopId;
}
public BigDecimal getUserArea() {
return userArea;
}
public void setUserArea(BigDecimal _userArea) {
userArea = _userArea;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal _price) {
price = _price;
}
public BigDecimal getNeedPay() {
return needPay;
}
public void setNeedPay(BigDecimal _needPay) {
needPay = _needPay;
}
public BigDecimal getReceivePay() {
return receivePay;
}
public void setReceivePay(BigDecimal _receivePay) {
receivePay = _receivePay;
}
public BigDecimal getPay() {
return pay;
}
public void setPay(BigDecimal _pay) {
pay = _pay;
}
public Integer getReceivePeriod() {
return receivePeriod;
}
public void setReceivePeriod(Integer _receivePeriod) {
receivePeriod = _receivePeriod;
}
public Date getReceiveDate() {
return receiveDate;
}
public void setReceiveDate(Date _receiveDate) {
receiveDate = _receiveDate;
}
public Date getPayDate() {
return payDate;
}
public void setPayDate(Date _payDate) {
payDate = _payDate;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date _createtime) {
createtime = _createtime;
}
public Integer getExpiredDay() {
return expiredDay;
}
public void setExpiredDay(Integer _expiredDay) {
expiredDay = _expiredDay;
}
public Integer getPayWay() {
return payWay;
}
public void setPayWay(Integer _payWay) {
payWay = _payWay;
}
public String getReceiptNum() {
return receiptNum;
}
public void setReceiptNum(String _receiptNum) {
receiptNum = _receiptNum;
}

public String getTenantId() {
return tenantId;
}

public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}

public WxMerchant getWxMerchant() {
return wxMerchant;
}

public void setWxMerchant(WxMerchant wxMerchant) {
this.wxMerchant = wxMerchant;
}

public WxShop getWxShop() {
return wxShop;
}

public void setWxShop(WxShop wxShop) {
this.wxShop = wxShop;
}

public static enum Field
{
Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
,ShopId_ASC("`shop_id` ASC"),ShopId_DESC("`shop_id` DESC")
,UserArea_ASC("`userArea` ASC"),UserArea_DESC("`userArea` DESC")
,Price_ASC("`price` ASC"),Price_DESC("`price` DESC")
,NeedPay_ASC("`needPay` ASC"),NeedPay_DESC("`needPay` DESC")
,ReceivePay_ASC("`receivePay` ASC"),ReceivePay_DESC("`receivePay` DESC")
,Pay_ASC("`pay` ASC"),Pay_DESC("`pay` DESC")
,ReceivePeriod_ASC("`receive_period` ASC"),ReceivePeriod_DESC("`receive_period` DESC")
,ReceiveDate_ASC("`receiveDate` ASC"),ReceiveDate_DESC("`receiveDate` DESC")
,PayDate_ASC("`payDate` ASC"),PayDate_DESC("`payDate` DESC")
,Createtime_ASC("`createtime` ASC"),Createtime_DESC("`createtime` DESC")
,ExpiredDay_ASC("`expiredDay` ASC"),ExpiredDay_DESC("`expiredDay` DESC")
,PayWay_ASC("`payWay` ASC"),PayWay_DESC("`payWay` DESC")
,ReceiptNum_ASC("`receiptNum` ASC"),ReceiptNum_DESC("`receiptNum` 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(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(",");
List<Field> fList = new 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));
}
}
}

+ 15
- 0
mallinkService/src/main/java/com/simple/mapper/WxBillRentMapper.java Прегледај датотеку

@@ -0,0 +1,15 @@
package com.simple.mapper;

import com.simple.common.CommonMapper;
import com.simple.domain.po.WxBillRent;

import java.util.List;
import java.util.Map;

public interface WxBillRentMapper extends CommonMapper<WxBillRent, String> {

List<WxBillRent> findList(WxBillRent wxBillRent);

List<Map<String,Object>> findListMap(WxBillRent record);

}

+ 4
- 0
mallinkService/src/main/java/com/simple/mapper/WxShopMapper.java Прегледај датотеку

@@ -13,4 +13,8 @@ public interface WxShopMapper extends CommonMapper<WxShop, String> {

List<Map<String,Object>> findListMap(WxShop record);

List<Map<String, Object>> getbshoplist(Map<String, Object> tenantId);

Map<String, Object> getMerchantShopByShopId(Map<String,Object> params);

}

+ 48
- 0
mallinkService/src/main/java/com/simple/service/WxBillRentService.java Прегледај датотеку

@@ -0,0 +1,48 @@
package com.simple.service;

import java.util.*;
import com.github.pagehelper.PageInfo;
import com.simple.domain.po.WxBillRent;

public interface WxBillRentService {

/**
* 根据实体查询分页列表
*
* @param offset
* @param limit
* @param record
* @return
*/
PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize);
/**
* 根据Id获得实体
*
* @param id
* @return
*/
WxBillRent getById(String id);
/**
* 保存或更新实体
*
* @param record
*/
void saveOrUpdate(WxBillRent record);

/**
* 根据Id删除实体
*
* @param id
*/
void deleteById(String id);

}

+ 6
- 7
mallinkService/src/main/java/com/simple/service/WxShopService.java Прегледај датотеку

@@ -2,6 +2,7 @@ package com.simple.service;

import java.util.*;
import com.github.pagehelper.PageInfo;
import com.simple.common.ResultData;
import com.simple.domain.po.WxShop;

public interface WxShopService {
@@ -39,12 +40,10 @@ public interface WxShopService {
* @param id
*/
void deleteById(Long id);


ResultData getbshoplist(String tenantId, String shopNumber);

ResultData getMerchantShopByShopId(String tenantId, String shopId);

}

+ 55
- 0
mallinkService/src/main/java/com/simple/service/impl/WxBillRentServiceImpl.java Прегледај датотеку

@@ -0,0 +1,55 @@
package com.simple.service.impl;

import java.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.simple.domain.po.WxBillRent;
import com.simple.mapper.WxBillRentMapper;
import com.simple.service.WxBillRentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WxBillRentServiceImpl implements WxBillRentService {
@Autowired
WxBillRentMapper wxBillRentMapper;


@Override
public PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) {
PageHelper.startPage(pageIndex, pageSize);
List<Map<String,Object>> shops = wxBillRentMapper.findListMap(record);
PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(shops);
return pageInfo;
//return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentMapper.findList(record));
}

@Override
public WxBillRent getById(String id) {
return wxBillRentMapper.selectByPrimaryKey(id);
}

@Override
public void saveOrUpdate(WxBillRent record) {
if (record.getId() == null) {
record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
wxBillRentMapper.insertSelective(record);
} else {
wxBillRentMapper.updateByPrimaryKeySelective(record);
}
}

@Override
public void deleteById(String id) {
wxBillRentMapper.deleteByPrimaryKey(id);
}
}

+ 21
- 8
mallinkService/src/main/java/com/simple/service/impl/WxShopServiceImpl.java Прегледај датотеку

@@ -3,6 +3,7 @@ package com.simple.service.impl;
import java.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.simple.common.ResultData;
import com.simple.domain.po.WxShop;
import com.simple.mapper.WxShopMapper;
import com.simple.service.WxShopService;
@@ -58,12 +59,24 @@ public class WxShopServiceImpl implements WxShopService {
public void deleteById(Long id) {
wxShopMapper.deleteByPrimaryKey(id);
}

@Override
public ResultData getbshoplist(String tenantId, String shopNumber) {
Map<String,Object> params=new HashMap<>();
params.put("tenantId",tenantId);
params.put("shopNumber",shopNumber);
List<Map<String,Object>> list=wxShopMapper.getbshoplist(params);
return new ResultData(ResultData.SUCCESS,"",list);
}

@Override
public ResultData getMerchantShopByShopId(String tenantId, String shopId) {
Map<String,Object> params=new HashMap<>();
params.put("tenantId",tenantId);
params.put("shopId",shopId);
Map<String,Object> map=wxShopMapper.getMerchantShopByShopId(params);
return new ResultData(ResultData.SUCCESS,"",map);
}


}

+ 94
- 0
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml Прегледај датотеку

@@ -0,0 +1,94 @@
<?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.simple.mapper.WxBillRentMapper">
<resultMap id="BaseResultMap" type="com.simple.domain.po.WxBillRent">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="user_area" jdbcType="DECIMAL" property="userArea" />
<result column="price" jdbcType="DECIMAL" property="price" />
<result column="need_pay" jdbcType="DECIMAL" property="needPay" />
<result column="receive_pay" jdbcType="DECIMAL" property="receivePay" />
<result column="pay" jdbcType="DECIMAL" property="pay" />
<result column="receive_period" jdbcType="INTEGER" property="receivePeriod" />
<result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" />
<result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
<result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
<result column="expired_day" jdbcType="INTEGER" property="expiredDay" />
<result column="pay_way" jdbcType="INTEGER" property="payWay" />
<result column="receipt_num" jdbcType="VARCHAR" property="receiptNum" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
</resultMap>
<sql id="allColumns">
`id`,`shop_id`,`user_area`,`price`,`need_pay`,`receive_pay`,`pay`,`receive_period`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`pay_way`,`receipt_num`,`tenant_id`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != shopId "> and `shop_id` = #{shopId} </if>
<if test=" null != userArea "> and `user_area` = #{userArea} </if>
<if test=" null != price "> and `price` = #{price} </if>
<if test=" null != needPay "> and `need_pay` = #{needPay} </if>
<if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
<if test=" null != pay "> and `pay` = #{pay} </if>
<if test=" null != receivePeriod "> and `receive_period` = #{receivePeriod} </if>
<if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if>
<if test=" null != payDate "> and `pay_date` = #{payDate} </if>
<if test=" null != createtime "> and `createtime` = #{createtime} </if>
<if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if>
<if test=" null != payWay "> and `pay_way` = #{payWay} </if>
<if test=" null != receiptNum "> and `receipt_num` = #{receiptNum} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </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.simple.domain.po.WxBillRent" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_bill_rent
<include refid="dynamicWhereConditions" />
</select>
<select id="findListMap" parameterType="com.simple.domain.po.WxBillRent" resultType="hashmap">
select br.id,br.shop_id shopId,br.user_area userArea,br.price,br.need_pay needPay,br.receive_pay receivePay,
br.pay,br.receive_period receivePeriod,br.receive_date receiveDate,br.pay_date payDate,br.createtime,
br.expired_day expiredDay,br.pay_way payWay,br.receipt_num receiptNum,m.`name` merchantName,
s.build_area buildArea,s.operation_area operationArea,s.shop_number shopNumber
from wx_bill_rent br left join wx_merchant_shop ms on br.shop_id=ms.shop_id and ms.is_del=0
inner join wx_merchant m on ms.merchant_id=m.id
inner join wx_shop s on ms.shop_id=s.id
where 1 = 1
<if test=" null != id "> and br.`id` = #{id} </if>
<if test=" null != shopId "> and br.`shop_id` = #{shopId} </if>
<if test=" null != userArea "> and br.`user_area` = #{userArea} </if>
<if test=" null != price "> and br.`price` = #{price} </if>
<if test=" null != needPay "> and br.`need_pay` = #{needPay} </if>
<if test=" null != receivePay "> and br.`receive_pay` = #{receivePay} </if>
<if test=" null != pay "> and br.`pay` = #{pay} </if>
<if test=" null != receivePeriod "> and br.`receive_period` = #{receivePeriod} </if>
<if test=" null != receiveDate "> and br.`receive_date` = #{receiveDate} </if>
<if test=" null != payDate "> and br.`pay_date` = #{payDate} </if>
<if test=" null != createtime "> and br.`createtime` = #{createtime} </if>
<if test=" null != expiredDay "> and br.`expired_day` = #{expiredDay} </if>
<if test=" null != payWay "> and br.`pay_way` = #{payWay} </if>
<if test=" null != receiptNum "> and br.`receipt_num` = #{receiptNum} </if>
<if test=" null != tenantId "> and br.`tenant_id` = #{tenantId} </if>
<if test=" null != ids ">
and br.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by br.${sortColumns} </if>
</select>
</mapper>

+ 11
- 0
mallinkService/src/main/resources/mapper/WxShopMapper.xml Прегледај датотеку

@@ -224,5 +224,16 @@

</select>

<select id="getbshoplist" resultType="hashmap" parameterType="hashmap">
select id,shop_number shopNumber from wx_shop
where tenant_id=#{tenantId} and shop_number like concat('%', ${shopNumber},'%')
</select>
<select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap">
select m.`name` merchantName,s.build_area buildArea,s.operation_area operationArea
from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id
inner join wx_shop s on ms.shop_id=s.id
where ms.tenant_id=${tenantId} and ms.shop_id=${shopId} and ms.is_del=0
</select>

</mapper>

Loading…
Откажи
Сачувај