| @@ -71,13 +71,14 @@ public class WxRentContractController extends WxContractBaseController { | |||||
| */ | */ | ||||
| @GetMapping("depositType") | @GetMapping("depositType") | ||||
| public ResultData billTypes() { | public ResultData billTypes() { | ||||
| Map<Integer,String> tmap = new HashMap<Integer,String>(); | |||||
| for (EnumRentContractDepositType t : EnumRentContractDepositType.values()) { | |||||
| tmap.put(t.getCode(), t.getMessage()); | |||||
| } | |||||
| return new ResultData(tmap); | |||||
| WxRentContractDepositType dt = new WxRentContractDepositType(); | |||||
| dt.updateTenantInfo(getTenantInfo()); | |||||
| dt.setIsDel(EnumYesOrNo.NO.getCode()); | |||||
| List<WxRentContractDepositType> types = wxRentContractService.findDepositTypes(dt); | |||||
| return new ResultData(types); | |||||
| } | } | ||||
| @GetMapping("/list") | @GetMapping("/list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @@ -0,0 +1,45 @@ | |||||
| package com.iformall.controller.contract; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.service.*; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.*; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("wxRentContractDepositType") | |||||
| public class WxRentContractDepositTypeController extends WxContractBaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxRentContractService wxRentContractService; | |||||
| /** | |||||
| * 押金类型 | |||||
| * @return | |||||
| */ | |||||
| @GetMapping("list") | |||||
| public ResultData billTypes() { | |||||
| WxRentContractDepositType dt = new WxRentContractDepositType(); | |||||
| dt.updateTenantInfo(getTenantInfo()); | |||||
| dt.setIsDel(EnumYesOrNo.NO.getCode()); | |||||
| List<WxRentContractDepositType> types = wxRentContractService.findDepositTypes(dt); | |||||
| return new ResultData(types); | |||||
| } | |||||
| @PostMapping("save") | |||||
| public ResultData add(@RequestBody WxRentContractDepositType wxRentContract) { | |||||
| wxRentContractService.saveOrUpdateDepositType(wxRentContract); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | |||||
| @@ -8,7 +8,6 @@ import com.iformall.common.SortColumn; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumPriceUnit; | import com.iformall.enums.EnumPriceUnit; | ||||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | import com.iformall.enums.EnumRentContractAdjustPeriod; | ||||
| import com.iformall.enums.EnumRentContractDepositType; | |||||
| import com.iformall.enums.EnumRentContractType; | import com.iformall.enums.EnumRentContractType; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| @@ -247,8 +246,8 @@ public class WxRentContract extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit") | @io.swagger.annotations.ApiModelProperty(value = "押金", name = "deposit") | ||||
| private String deposit; | private String deposit; | ||||
| // @io.swagger.annotations.ApiModelProperty(value = "押金详细", name = "depositInfo") | |||||
| // private String depositInfo; | |||||
| //// @io.swagger.annotations.ApiModelProperty(value = "押金详细", name = "depositInfo") | |||||
| //// private String depositInfo; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "押金详细EnumRentContractDepositType", name = "cashtypeContentLsit") | @io.swagger.annotations.ApiModelProperty(value = "押金详细EnumRentContractDepositType", name = "cashtypeContentLsit") | ||||
| private String cashtypeContentLsit; | private String cashtypeContentLsit; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "押金详细", name = "cashtypeLsit") | @io.swagger.annotations.ApiModelProperty(value = "押金详细", name = "cashtypeLsit") | ||||
| @@ -515,22 +514,21 @@ public class WxRentContract extends TenantEntity { | |||||
| return sb.toString(); | return sb.toString(); | ||||
| } | } | ||||
| public String getDepositDetail() { | |||||
| public String getDepositDetail(Map<Long,WxRentContractDepositType> typeMap) { | |||||
| StringBuffer sb = new StringBuffer(""); | StringBuffer sb = new StringBuffer(""); | ||||
| String dsdstr = this.getCashtypeContentLsit(); | String dsdstr = this.getCashtypeContentLsit(); | ||||
| if (!StringUtils.isBlank(dsdstr)) { | |||||
| if (!StringUtils.isBlank(dsdstr) && null != typeMap) { | |||||
| JSONArray rentInfoArray = JSONArray.parseArray(dsdstr); | JSONArray rentInfoArray = JSONArray.parseArray(dsdstr); | ||||
| int size = rentInfoArray.size(); | int size = rentInfoArray.size(); | ||||
| for (int i = 0; i < size; i++) { | for (int i = 0; i < size; i++) { | ||||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | ||||
| String depositType = rentInfoObject.getString("value"); | String depositType = rentInfoObject.getString("value"); | ||||
| String deposit = rentInfoObject.getString("deposit"); | String deposit = rentInfoObject.getString("deposit"); | ||||
| Integer dt = Integer.parseInt(depositType); | |||||
| EnumRentContractDepositType de = EnumRentContractDepositType.getEnum(dt); | |||||
| if (null != dt && StringUtils.isNotBlank(deposit)) { | |||||
| sb.append(de.getMessage()).append(":").append(deposit).append(","); | |||||
| Long dt = Long.parseLong(depositType); | |||||
| WxRentContractDepositType dtt = typeMap.get(dt); | |||||
| if (null != dtt) { | |||||
| sb.append(dtt.getName()).append(":").append(deposit).append(","); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return sb.toString(); | return sb.toString(); | ||||
| @@ -0,0 +1,33 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @TableName(value = "wx_rent_contract_deposit_type") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxRentContractDepositType extends TenantEntity { | |||||
| private static final long serialVersionUID = -2034956838395479510L; | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") | |||||
| private Integer isDel; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") | |||||
| private Date updateTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createtime") | |||||
| private Date createTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "名称", name = "createtime") | |||||
| private String name; | |||||
| } | |||||
| @@ -1,35 +0,0 @@ | |||||
| package com.iformall.enums; | |||||
| public enum EnumRentContractDepositType { | |||||
| COMMON(0,"一般押金"), | |||||
| CONTRACT_DEPOSIT(1,"合同保证金"), | |||||
| QUALITY_DEPOSIT(2,"质量保证金") | |||||
| ; | |||||
| public static EnumRentContractDepositType getEnum(Integer code) { | |||||
| for (EnumRentContractDepositType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumRentContractDepositType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxRentContractDepositType; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxRentContractDepositTypeMapper extends CommonMapper<WxRentContractDepositType, Long> { | |||||
| List<WxRentContractDepositType> findList(WxRentContractDepositType wxRentContract); | |||||
| } | |||||
| @@ -6,6 +6,7 @@ import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxBillRent; | import com.iformall.domain.po.WxBillRent; | ||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| import com.iformall.domain.po.WxRentContract; | import com.iformall.domain.po.WxRentContract; | ||||
| import com.iformall.domain.po.WxRentContractDepositType; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| @@ -144,4 +145,9 @@ public interface WxRentContractService { | |||||
| List<WxRentContract> findToEndContractList(WxRentContract record); | List<WxRentContract> findToEndContractList(WxRentContract record); | ||||
| void calcuteByTradeDaily(WxRentContract wxRentContract); | void calcuteByTradeDaily(WxRentContract wxRentContract); | ||||
| List<WxRentContractDepositType> findDepositTypes(WxRentContractDepositType rentContract); | |||||
| void saveOrUpdateDepositType(WxRentContractDepositType rentContract); | |||||
| } | } | ||||
| @@ -130,6 +130,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Autowired | @Autowired | ||||
| WxMerchantTradeDailyMapper wxMerchantTradeDailyMapper; | WxMerchantTradeDailyMapper wxMerchantTradeDailyMapper; | ||||
| @Autowired | |||||
| WxRentContractDepositTypeMapper wxRentContractDepositTypeMapper; | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| WxBillAllHelper wxBillAllHelper; | WxBillAllHelper wxBillAllHelper; | ||||
| @@ -922,11 +925,16 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); | WxRentContract wxRentContract = wxRentContractMapper.selectById(rentContractId); | ||||
| if (wxRentContract != null && StringUtils.isNotBlank(wxRentContract.getDeposit()) | if (wxRentContract != null && StringUtils.isNotBlank(wxRentContract.getDeposit()) | ||||
| && new BigDecimal(wxRentContract.getDeposit()).compareTo(new BigDecimal(0)) > 0 ) { | && new BigDecimal(wxRentContract.getDeposit()).compareTo(new BigDecimal(0)) > 0 ) { | ||||
| WxRentContractDepositType dt = new WxRentContractDepositType(); | |||||
| dt.updateTenantInfo(wxRentContract); | |||||
| Map<Long,WxRentContractDepositType> typeMap = findDepositTypesMap(dt); | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| WxBillDeposit wxBillDeposit = new WxBillDeposit(); | WxBillDeposit wxBillDeposit = new WxBillDeposit(); | ||||
| wxBillDeposit.setId(idWorker.nextId()); | wxBillDeposit.setId(idWorker.nextId()); | ||||
| wxBillDeposit.setRentContractId(wxRentContract.getId()); | wxBillDeposit.setRentContractId(wxRentContract.getId()); | ||||
| wxBillDeposit.setContractDepoistDetail(wxRentContract.getDepositDetail()); | |||||
| wxBillDeposit.setContractDepoistDetail(wxRentContract.getDepositDetail(typeMap)); | |||||
| wxBillDeposit.setPay("0"); | wxBillDeposit.setPay("0"); | ||||
| String needpay = wxRentContract.getDeposit(); | String needpay = wxRentContract.getDeposit(); | ||||
| wxBillDeposit.setReceivePay(needpay); | wxBillDeposit.setReceivePay(needpay); | ||||
| @@ -3416,4 +3424,36 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return new BigDecimal(sumMoney); | return new BigDecimal(sumMoney); | ||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public List<WxRentContractDepositType> findDepositTypes(WxRentContractDepositType rentContract) { | |||||
| return wxRentContractDepositTypeMapper.findList(rentContract); | |||||
| } | |||||
| private Map<Long,WxRentContractDepositType> findDepositTypesMap(WxRentContractDepositType rentContract) { | |||||
| List<WxRentContractDepositType> types = findDepositTypes(rentContract); | |||||
| if (null != types && types.size() > 0 ) { | |||||
| Map<Long,WxRentContractDepositType> tmap = new HashMap<Long,WxRentContractDepositType>(); | |||||
| for (int i = 0 ; i < types.size(); i++ ) { | |||||
| WxRentContractDepositType dt = types.get(i); | |||||
| tmap.put(dt.getId(), dt); | |||||
| } | |||||
| return tmap; | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdateDepositType(WxRentContractDepositType rentContract) { | |||||
| if (null == rentContract.getId()) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| rentContract.setId(idWorker.nextId()); | |||||
| rentContract.setCreateTime(new Date()); | |||||
| rentContract.setUpdateTime(new Date()); | |||||
| wxRentContractDepositTypeMapper.insert(rentContract); | |||||
| }else { | |||||
| rentContract.setUpdateTime(new Date()); | |||||
| wxRentContractDepositTypeMapper.updateById(rentContract); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,42 @@ | |||||
| <?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.WxRentContractDepositTypeMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContractDepositType"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`is_del`,`name`,`update_time`,`create_time` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id ">and `id` = #{id}</if> | |||||
| <if test=" null != tenantId and '' != tenantId"> and `tenant_id` = #{tenantId} </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> and `parent_tenant_id` = #{parentTenantId} </if> | |||||
| <if test=" null != isDel and '' != isDel">and `is_del` = #{isDel}</if> | |||||
| <if test=" null != name and '' != name">and `name` like concat('%', #{name},'%') </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.WxRentContractDepositType" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_rent_contract_deposit_type | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||