Просмотр исходного кода

[账单管理][添加][业务逻辑]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
772e0691e6
6 измененных файлов: 67 добавлений и 29 удалений
  1. +5
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/WxBillRentController.java
  2. +4
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java
  3. +4
    -3
      mallinkService/src/main/java/com/iformall/service/WxBillRentService.java
  4. +31
    -16
      mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java
  5. +21
    -1
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml
  6. +2
    -2
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 5
- 6
mallinkAdmin/src/main/java/com/iformall/controller/WxBillRentController.java Просмотреть файл

@@ -14,6 +14,9 @@ import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
* @author gongbiao
*/
@RestController
@RequestMapping("wxBillRent")
public class WxBillRentController extends BaseController {
@@ -36,17 +39,13 @@ public class WxBillRentController extends BaseController {

@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(ResultData.SUCCESS, "操作成功");
return wxBillRentService.saveOrUpdate(wxBillRent);
}

@PostMapping("update")
public ResultData update(@RequestBody WxBillRent wxBillRent) {
wxBillRentService.saveOrUpdate(wxBillRent);
return new ResultData(ResultData.SUCCESS, "操作成功");
return wxBillRentService.saveOrUpdate(wxBillRent);
}

@GetMapping("/del")


+ 4
- 1
mallinkService/src/main/java/com/iformall/mapper/WxBillRentMapper.java Просмотреть файл

@@ -6,11 +6,14 @@ import com.iformall.domain.po.WxBillRent;
import java.util.List;
import java.util.Map;

/**
* @author gongbiao
*/
public interface WxBillRentMapper extends CommonMapper<WxBillRent, String> {

List<WxBillRent> findList(WxBillRent wxBillRent);

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

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



+ 4
- 3
mallinkService/src/main/java/com/iformall/service/WxBillRentService.java Просмотреть файл

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

import java.util.*;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxBillRent;

public interface WxBillRentService {
@@ -27,9 +28,9 @@ public interface WxBillRentService {
/**
* 保存或更新实体
*
* @param record
*/
void saveOrUpdate(WxBillRent record);
* @param record
*/
ResultData saveOrUpdate(WxBillRent record);

/**
* 根据Id删除实体


+ 31
- 16
mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java Просмотреть файл

@@ -2,8 +2,12 @@ package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxBillRent;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxBillRentMapper;
import com.iformall.service.WxBillRentService;
import org.slf4j.Logger;
@@ -15,19 +19,22 @@ import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author gongbiao
*/
@Service
public class WxBillRentServiceImpl implements WxBillRentService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
@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);
List<Map<String, Object>> shops = wxBillRentMapper.queryBillRentList(record);
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(shops);
return pageInfo;
//return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillRentMapper.findList(record));
}
@@ -36,21 +43,35 @@ public class WxBillRentServiceImpl implements WxBillRentService {
public Map<String, Object> getById(Long id) {
WxBillRent record = new WxBillRent();
record.setId(id);
return wxBillRentMapper.findListMap(record).get(0);
return wxBillRentMapper.queryBillRentList(record).get(0);
}

@Override
public void saveOrUpdate(WxBillRent record) {
public ResultData saveOrUpdate(WxBillRent record) {
if (record.getId() == null) {
logger.info("新增租赁账单");
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
Date date = new Date();
record.setCreatetime(date);
record.setUpdatetime(date);
wxBillRentMapper.insertSelective(record);
try {
wxBillRentMapper.insertSelective(record);
} catch (Exception e) {
logger.error("保存租赁账单失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
}
return new ResultData(Result.SUCCESS, "保存租赁账单成功");
} else {
logger.info("更新租赁账单");
record.setUpdatetime(new Date());
wxBillRentMapper.updateByPrimaryKeySelective(record);
try {
wxBillRentMapper.updateByPrimaryKeySelective(record);
} catch (Exception e) {
logger.error("更新租赁账单失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
}
return new ResultData(Result.SUCCESS, "更新租赁账单成功");
}
}

@@ -58,12 +79,6 @@ public class WxBillRentServiceImpl implements WxBillRentService {
public void deleteById(Long id) {
wxBillRentMapper.deleteByPrimaryKey(id);
}


}

+ 21
- 1
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml Просмотреть файл

@@ -63,8 +63,28 @@
</select>
<select id="queryBillRentList" parameterType="com.iformall.domain.po.WxRentContract" resultType="hashmap">
select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate,
br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`,
br.`need_pay` needPay,m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`
from wx_bill_rent br left join wx_merchant m on br.merchant_id=m.id
left join wx_shop s on br.shop_id=s.id
<where>
<if test=" null != id "> and br.`id` = #{id} </if>
<if test=" null != merchantId "> and br.`merchant_id` = #{merchantId} </if>
<if test=" null != tenantId "> and br.`tenant_id` = #{tenantId} </if>
<if test=" null != status "> and br.`status` = #{status} </if>
<if test=" null != isDel "> and br.`is_del` = #{isDel} </if>
</where>
order by id
</select>
<select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
select sum(receive_pay) receivepay,sum(pay) pay,tenant_id from wx_bill_rent
where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate}
group by tenant_id
</select>
</mapper>

+ 2
- 2
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml Просмотреть файл

@@ -77,8 +77,8 @@
</select>
<select id="queryRentContractData" resultType="hashmap" parameterType="com.iformall.domain.po.WxRentContract">
select rc.id,rc.merchant_name,rc.rental_start_date,rc.rental_end_date,rc.`status`,
rc.price,rc.contract_number,s.shop_number,f.floor_name,b.building_name
select rc.id,rc.merchant_name merchantName,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.`status`,
rc.price,rc.contract_number contractNumber,s.shop_number shopNumber,f.floor_name floorName,b.building_name buildingName
from wx_rent_contract rc
left join wx_shop s on rc.shop_id=s.id
left join wx_mall_floor f on s.floor=f.id


Загрузка…
Отмена
Сохранить