| @@ -2,6 +2,7 @@ package com.iformall.controller.rent; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.Result; | |||||
| 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.BaseEntity; | import com.iformall.domain.po.BaseEntity; | ||||
| @@ -49,6 +50,15 @@ public class WxBillSettleController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @ApiOperation("账单管理-结算单-id查找") | |||||
| @SystemControllerLog(description = "账单管理-结算单-id查找") | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBillSettleController::findById"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillSettleService.getById(id)); | |||||
| } | |||||
| @PostMapping("addOrUpdate") | @PostMapping("addOrUpdate") | ||||
| @ApiOperation("账单管理-结算单-新增或编辑") | @ApiOperation("账单管理-结算单-新增或编辑") | ||||
| @SystemControllerLog(description = "账单管理-结算单-新增或编辑") | @SystemControllerLog(description = "账单管理-结算单-新增或编辑") | ||||
| @@ -37,5 +37,10 @@ public class WxBillSettleBill extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | ||||
| private Date updatetime; | private Date updatetime; | ||||
| @Transient | |||||
| private String billName; | |||||
| @Transient | |||||
| private String receivePay; | |||||
| } | } | ||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumSettleBillType { | |||||
| // 0收款1承付 | |||||
| R(0, "收款"), | |||||
| P(1, "承付"), | |||||
| ; | |||||
| public static EnumSettleBillType getEnum(Integer code) { | |||||
| for (EnumSettleBillType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumSettleBillType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -10,7 +10,7 @@ import java.util.List; | |||||
| */ | */ | ||||
| public interface WxBillSettleBillMapper extends CommonMapper<WxBillSettleBill, Long> { | public interface WxBillSettleBillMapper extends CommonMapper<WxBillSettleBill, Long> { | ||||
| List<WxBillSettleBill> findList(WxBillSettleBill wxBillSettleBill); | |||||
| List<WxBillSettleBill> findBySettleId(WxBillSettleBill wxBillSettleBill); | |||||
| void update(WxBillSettleBill record); | void update(WxBillSettleBill record); | ||||
| @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.EnumBillRentStatus; | import com.iformall.enums.EnumBillRentStatus; | ||||
| import com.iformall.enums.EnumBillType; | import com.iformall.enums.EnumBillType; | ||||
| import com.iformall.enums.EnumSettleBillType; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxBillSettleService; | import com.iformall.service.WxBillSettleService; | ||||
| import com.iformall.service.WxFlowService; | import com.iformall.service.WxFlowService; | ||||
| @@ -51,10 +52,19 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxBillSettle getById(Long id) { | |||||
| public WxBillSettle getById(Long id){ | |||||
| WxBillSettle billSettle = wxBillSettleMapper.selectByPrimaryKey(id); | WxBillSettle billSettle = wxBillSettleMapper.selectByPrimaryKey(id); | ||||
| if(billSettle != null) { | |||||
| WxBillSettleBill wxBillSettleBill = new WxBillSettleBill(); | |||||
| wxBillSettleBill.setTenantId(billSettle.getTenantId()); | |||||
| wxBillSettleBill.setSettleId(billSettle.getId()); | |||||
| wxBillSettleBill.setType(EnumSettleBillType.R.getCode()); | |||||
| billSettle.setReceiveBillIds(wxBillSettleBillMapper.findBySettleId(wxBillSettleBill)); | |||||
| wxBillSettleBill.setType(EnumSettleBillType.P.getCode()); | |||||
| billSettle.setPayBillIds(wxBillSettleBillMapper.findBySettleId(wxBillSettleBill)); | |||||
| } | |||||
| return billSettle; | return billSettle; | ||||
| } | } | ||||
| @@ -12,6 +12,8 @@ | |||||
| <result column="createtime" property="createtime"/> | <result column="createtime" property="createtime"/> | ||||
| <result column="updatetime" property="updatetime"/> | <result column="updatetime" property="updatetime"/> | ||||
| <result column="billName" property="billName"/> | |||||
| <result column="receivePay" property="receivePay"/> | |||||
| </resultMap> | </resultMap> | ||||
| @@ -41,6 +43,47 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findBySettleId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap"> | |||||
| select bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.receive_pay,0) receivePay from wx_bill_settle_bill bl left join | |||||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 | |||||
| union all | |||||
| select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_rent_deposit | |||||
| union all | |||||
| select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_property where is_preview = 0 | |||||
| union all | |||||
| select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金' | |||||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from | |||||
| wx_bill_property_deposit | |||||
| union all | |||||
| select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||||
| type=1 | |||||
| union all | |||||
| select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||||
| type=2 | |||||
| union all | |||||
| select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where | |||||
| type=3 | |||||
| union all | |||||
| select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他费用' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other | |||||
| union all | |||||
| select id,merchant_id,shop_id,tenant_id,8 bill_type_value,'其他押金' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit | |||||
| ) bill | |||||
| on(bl.bill_id = bill.id) | |||||
| <if test=" null != tenantId ">and bl.`tenant_id` = #{tenantId}</if> | |||||
| <if test=" null != settleId ">and bl.`settle_id` = #{settleId}</if> | |||||
| <if test=" null != type ">and bl.`type` = #{type}</if> | |||||
| </select> | |||||
| <update id="delBySettleId" parameterType="com.iformall.domain.po.WxBillSettle"> | <update id="delBySettleId" parameterType="com.iformall.domain.po.WxBillSettle"> | ||||
| delete from wx_bill_settle_bill where settle_id = #{id} | delete from wx_bill_settle_bill where settle_id = #{id} | ||||
| </update> | </update> | ||||