| @@ -45,14 +45,14 @@ public class WxPropertyContractController extends BaseController | |||||
| public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { | public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); | ||||
| wxPropertyContract.setTenantId(getTenantId()); | wxPropertyContract.setTenantId(getTenantId()); | ||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId()); | |||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId(),getUser().getName()); | |||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { | public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); | ||||
| wxPropertyContract.setTenantId(getTenantId()); | wxPropertyContract.setTenantId(getTenantId()); | ||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId()); | |||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId(),getUser().getName()); | |||||
| } | } | ||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @@ -7,6 +7,7 @@ import java.io.Serializable; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| @@ -159,6 +160,18 @@ public class WxPropertyContract implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "计租周期", name = "计租周期") | @io.swagger.annotations.ApiModelProperty(value = "计租周期", name = "计租周期") | ||||
| private Integer adjustPeriod; | private Integer adjustPeriod; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | |||||
| private Map<String, Object> flowParams; | |||||
| public Map<String, Object> getFlowParams() { | |||||
| return flowParams; | |||||
| } | |||||
| public void setFlowParams(Map<String, Object> flowParams) { | |||||
| this.flowParams = flowParams; | |||||
| } | |||||
| public Integer getApplyStatus() { | public Integer getApplyStatus() { | ||||
| return applyStatus; | return applyStatus; | ||||
| } | } | ||||
| @@ -191,6 +191,7 @@ public class WxRentContract implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | @io.swagger.annotations.ApiModelProperty(value = "租赁商铺类型", name = "rentShopType") | ||||
| private Integer rentShopType; | private Integer rentShopType; | ||||
| @Transient | |||||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | ||||
| private Map<String, Object> flowParams; | private Map<String, Object> flowParams; | ||||
| @@ -37,6 +37,6 @@ public interface WxPropertyContractMapper extends CommonMapper<WxPropertyContrac | |||||
| List<WxRentContract> getRentContractList(Map<String, Object> params); | List<WxRentContract> getRentContractList(Map<String, Object> params); | ||||
| void updateApplyStatus(WxPropertyContract wxPropertyContract); | void updateApplyStatus(WxPropertyContract wxPropertyContract); | ||||
| void updateStatus(WxPropertyContract wxPropertyContract); | |||||
| } | } | ||||
| @@ -29,13 +29,14 @@ public interface WxPropertyContractService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData getById(Long id); | ResultData getById(Long id); | ||||
| /** | |||||
| /** | |||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | |||||
| * @param record | |||||
| */ | |||||
| ResultData saveOrUpdate(WxPropertyContract record, Long userId); | |||||
| * @param record | |||||
| * @param userId | |||||
| * @return | |||||
| */ | |||||
| ResultData saveOrUpdate(WxPropertyContract record, Long userId,String userName); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxFlowService; | |||||
| import com.iformall.service.WxPropertyContractService; | import com.iformall.service.WxPropertyContractService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -50,6 +51,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| @Autowired | @Autowired | ||||
| WxRentContractMapper wxRentContractMapper; | WxRentContractMapper wxRentContractMapper; | ||||
| @Autowired | |||||
| WxFlowService wxFlowService; | |||||
| @Override | @Override | ||||
| public Map<String, Object> listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) { | public Map<String, Object> listAsPage(WxPropertyContract record, Integer pageIndex, Integer pageSize) { | ||||
| Object rentContractStatusInfo = getRentContractStatusInfo(record); | Object rentContractStatusInfo = getRentContractStatusInfo(record); | ||||
| @@ -96,7 +100,8 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData saveOrUpdate(WxPropertyContract record, Long userId) { | |||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| public ResultData saveOrUpdate(WxPropertyContract record, Long userId,String userName) { | |||||
| if (null == record.getShopId()) { | if (null == record.getShopId()) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "shopId不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "shopId不能为空"); | ||||
| @@ -149,6 +154,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| //保存物业合同信息 | //保存物业合同信息 | ||||
| String message = ""; | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| @@ -177,7 +183,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| logger.error("保存物业合同信息失败,e:" + e.getMessage()); | logger.error("保存物业合同信息失败,e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "保存物业合同信息成功", record); | |||||
| message = "保存物业合同信息成功"; | |||||
| } else {//更新物业合同信息 | } else {//更新物业合同信息 | ||||
| WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(record.getId()); | WxPropertyContract wxPropertyContract = wxPropertyContractMapper.selectByPrimaryKey(record.getId()); | ||||
| if (wxPropertyContract == null) { | if (wxPropertyContract == null) { | ||||
| @@ -207,8 +213,24 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| logger.error("更新物业合同信息失败,e:" + e.getMessage()); | logger.error("更新物业合同信息失败,e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "更新物业合同信息成功", record); | |||||
| message = "更新物业合同信息成功"; | |||||
| } | |||||
| try { | |||||
| record.getFlowParams().put("businessId",record.getId().toString()); | |||||
| record.getFlowParams().put("supplement",false); | |||||
| wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); | |||||
| // 合同状态改成待签约 | |||||
| WxPropertyContract updateRentContract = new WxPropertyContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxPropertyContractMapper.updateStatus(updateRentContract); | |||||
| } catch (Exception e) { | |||||
| logger.error("启动审批流失败,e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.FLOW_FAIL.getCode(), "FLOW FAILD " + e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, message, record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -185,4 +185,8 @@ | |||||
| <update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxPropertyContract"> | <update id="updateApplyStatus" parameterType="com.iformall.domain.po.WxPropertyContract"> | ||||
| update wx_property_contract set apply_status=#{applyStatus} where id=#{id} | update wx_property_contract set apply_status=#{applyStatus} where id=#{id} | ||||
| </update> | </update> | ||||
| <update id="updateStatus" parameterType="com.iformall.domain.po.WxPropertyContract"> | |||||
| update wx_property_contract set status=#{status} where id=#{id} | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||