Conflicts: mallinkService/src/main/java/com/iformall/service/impl/CUserTokenServiceImpl.javarelease_toaliyun_real
| @@ -29,10 +29,12 @@ public class WxContractBaseController extends BaseController{ | |||
| Map<String,Object> map = new HashMap<String,Object>(); | |||
| map.put("businessType", flowType.getCode()); | |||
| map.put("remark", remark); | |||
| map.put("businessId", String.valueOf(contractId)); | |||
| //租金+物业合同时用到 | |||
| if (null != wholeProperyId) { | |||
| map.put("businessId", String.valueOf(contractId)+"_RP_"+String.valueOf(wholeProperyId)); | |||
| map.put("wholeProperyId", String.valueOf(wholeProperyId)); | |||
| }else { | |||
| map.put("businessId", String.valueOf(contractId)); | |||
| } | |||
| List<Map> variablesList = new ArrayList<Map>(); | |||
| Map contractTypeMap = new HashMap<String,Object>(); | |||
| @@ -42,20 +44,26 @@ public class WxContractBaseController extends BaseController{ | |||
| Map contractNumberMap = new HashMap<String,Object>(); | |||
| contractNumberMap.put("key","contractNumber"); | |||
| contractNumberMap.put("value", String.valueOf(contractId)); | |||
| //租金+物业合同时用到 | |||
| if (null != wholeProperyId) { | |||
| contractNumberMap.put("value", String.valueOf(contractId)+"_RP_"+String.valueOf(wholeProperyId)); | |||
| }else { | |||
| contractNumberMap.put("value", String.valueOf(contractId)); | |||
| } | |||
| variablesList.add(contractNumberMap); | |||
| map.put("variables", variablesList); | |||
| return map; | |||
| } | |||
| protected boolean rentPropertyHasWorkFlow(WxRentPropertyContractVo rpvo) { | |||
| WxFlowModel wxFlowModel = new WxFlowModel(); | |||
| if (rpvo.getRentShopType().intValue() == EnumRentShopType.SHOP.getCode().intValue()) { | |||
| wxFlowModel.setFlowType(EnumFlowKey.NNEW_RENT_CONTRACT.getCode()); | |||
| }else if (rpvo.getRentShopType().intValue() == EnumRentShopType.POINT.getCode().intValue()) { | |||
| wxFlowModel.setFlowType(EnumFlowKey.NEW_RENT_POINT_CONTRACT.getCode()); | |||
| } | |||
| if (rpvo.getRentShopType().intValue() == EnumRentShopType.SHOP.getCode().intValue()) { | |||
| wxFlowModel.setFlowType(EnumFlowKey.NNEW_RENT_CONTRACT.getCode()); | |||
| }else if (rpvo.getRentShopType().intValue() == EnumRentShopType.POINT.getCode().intValue()) { | |||
| wxFlowModel.setFlowType(EnumFlowKey.NEW_RENT_POINT_CONTRACT.getCode()); | |||
| } | |||
| wxFlowModel.updateTenantInfo(rpvo); | |||
| List<WxFlowModel> flows = wxFlowService.getModelBybusiness(wxFlowModel); | |||
| if (null != flows && flows.size() > 0) { | |||
| @@ -67,7 +75,6 @@ public class WxContractBaseController extends BaseController{ | |||
| protected boolean rentContractHasWorkFlow(WxRentContract wxRentContract) { | |||
| WxFlowModel wxFlowModel = new WxFlowModel(); | |||
| if(wxRentContract.getOperationType().intValue() == EnumContractOperationType.PART.getCode().intValue()) { | |||
| if (wxRentContract.getRentShopType().intValue() == EnumRentShopType.SHOP.getCode().intValue()) { | |||
| wxFlowModel.setFlowType(EnumFlowKey.NEW_RENT_CONTRACT.getCode()); | |||
| @@ -456,10 +456,12 @@ public class WxRentContractController extends WxContractBaseController { | |||
| wxRentContractService.updateRentContract(contract); | |||
| if(contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { | |||
| WxPropertyContract propertyContract = wxPropertyContractService.getSimpleDetail(wxRentContract.getPropertyId()); | |||
| propertyContract.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||
| propertyContract.setUpdatetime(new Date()); | |||
| wxPropertyContractService.updatePropertyContract(propertyContract); | |||
| if (null != wxRentContract.getPropertyId()) { | |||
| WxPropertyContract propertyContract = wxPropertyContractService.getSimpleDetail(wxRentContract.getPropertyId()); | |||
| propertyContract.setStatus(EnumRentContractStatus.INVALID.getCode()); | |||
| propertyContract.setUpdatetime(new Date()); | |||
| wxPropertyContractService.updatePropertyContract(propertyContract); | |||
| } | |||
| } | |||
| return new ResultData(); | |||
| }else { | |||
| @@ -770,13 +772,19 @@ public class WxRentContractController extends WxContractBaseController { | |||
| return wxRentContractService.update(rentContract, user.getId(),user.getName(), EnumFromType.SWITCH.getCode(),oldDate,false); | |||
| } | |||
| // @GetMapping("exportContract") | |||
| // @ApiImplicitParams({ | |||
| // @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)}) | |||
| // @SystemControllerLog(description = "租赁合同-导出合同") | |||
| // public void exportContract(Long id,HttpServletRequest request, HttpServletResponse response){ | |||
| // wxRentContractService.exportContract(request,response,id); | |||
| // } | |||
| @GetMapping("exportContract") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "rentId", value = "rentId", dataType = "Long", paramType = "query", required = false), | |||
| @ApiImplicitParam(name = "propertyId", value = "propertyId", dataType = "String", paramType = "query", required = false)}) | |||
| @SystemControllerLog(description = "租赁合同-导出合同") | |||
| public void exportContract(Long rentId,String propertyId,HttpServletRequest request, HttpServletResponse response){ | |||
| Long pid = null; | |||
| try { | |||
| pid = Long.parseLong(propertyId); | |||
| }catch(Exception e) { | |||
| } | |||
| wxRentContractService.exportContract(request,response,rentId,pid); | |||
| } | |||
| // @GetMapping("/getRentContractStatusInfo") | |||
| @@ -142,11 +142,23 @@ public class WxRentPropertyContractController extends WxContractBaseController { | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "rentId", value = "租金合同编号", dataType = "Long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "propertyId", value = "物业合同编号", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData findById(Long rentId,Long propertyId) { | |||
| @ApiImplicitParam(name = "rentId", value = "租金合同编号", dataType = "Long", paramType = "query", required = false), | |||
| @ApiImplicitParam(name = "propertyId", value = "物业合同编号", dataType = "Long", paramType = "query", required = false), | |||
| @ApiImplicitParam(name = "id", value = "租金合同编号(工作流用)", dataType = "String", paramType = "query", required = false)}) | |||
| public ResultData findById(Long rentId,Long propertyId,String id) { | |||
| logger.debug("[" + getIpAddr() + "] wxRentPropertyContract::findById"); | |||
| return wxRentPropertyContractService.getContractInfo(rentId,propertyId); | |||
| if (null != rentId && null != propertyId) { | |||
| return wxRentPropertyContractService.getContractInfo(rentId,propertyId); | |||
| }else if (!StringUtils.isBlank(id)) { | |||
| //租金+物业工作流查询会传此id | |||
| String[] ids = id.split("_RP_"); | |||
| if (ids.length == 2 ) { | |||
| Long rId = Long.parseLong(ids[0]); | |||
| Long pId = Long.parseLong(ids[1]); | |||
| return wxRentPropertyContractService.getContractInfo(rId,pId); | |||
| } | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("合同审批详情") | |||
| @@ -119,10 +119,10 @@ public class WxFlowAbleController extends BaseController { | |||
| @ApiOperation("审批历史") | |||
| @GetMapping(value = "/applyHistory") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "businessId", value = "业务id", dataType = "long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "businessId", value = "业务id", dataType = "String", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "工作流-审批历史") | |||
| public ResultData applyHistory(Long businessId) { | |||
| public ResultData applyHistory(String businessId) { | |||
| logger.debug("[" + getIpAddr() + "] FlowAbleController::applyHistory"); | |||
| return wxFlowService.applyHistory(businessId,getTenantInfo()); | |||
| } | |||
| @@ -133,10 +133,10 @@ public class WxFlowAbleController extends BaseController { | |||
| @ApiOperation("审批历史和代办") | |||
| @GetMapping(value = "/applyHistoryAndAssignee") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "businessId", value = "业务id", dataType = "long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "businessId", value = "业务id", dataType = "String", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "工作流-审批历史和代办") | |||
| public ResultData applyHistoryAndAssignee(Long businessId) { | |||
| public ResultData applyHistoryAndAssignee(String businessId) { | |||
| logger.debug("[" + getIpAddr() + "] FlowAbleController::applyHistoryAndAssignee"); | |||
| return wxFlowService.getTaskStatusList(businessId,getTenantInfo()); | |||
| } | |||
| @@ -54,7 +54,7 @@ spring: | |||
| keysecret: VfWqGb83qIQrS9us45utskl8itd7ry | |||
| bucketname: formall | |||
| filehost: malinkadmin | |||
| filedomain: https://formall.oss-cn-beijing.aliyuncs.com | |||
| filedomain: https://formall.oss-accelerate.aliyuncs.com | |||
| mail: | |||
| host: smtp.exmail.qq.com | |||
| @@ -9,6 +9,7 @@ import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.CUserTokenService; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserService; | |||
| @@ -20,6 +21,7 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.data.redis.core.ValueOperations; | |||
| import org.springframework.web.bind.WebDataBinder; | |||
| import org.springframework.web.bind.annotation.InitBinder; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -31,6 +33,7 @@ import java.beans.PropertyEditorSupport; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.concurrent.TimeUnit; | |||
| @RestController | |||
| public class BaseController { | |||
| @@ -48,11 +51,14 @@ public class BaseController { | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private CUserTokenService cUserTokenService; | |||
| @Autowired | |||
| @Qualifier("baseCUserTokenRedisTemplate") | |||
| RedisTemplate<String, BaseCUserEntity> baseCUserTokenRedisTemplate; | |||
| @InitBinder | |||
| public void InitBinder(WebDataBinder dataBinder) { | |||
| dataBinder.registerCustomEditor(Date.class, new PropertyEditorSupport() { | |||
| @@ -93,11 +99,11 @@ public class BaseController { | |||
| return tenantEntity; | |||
| } | |||
| public Long getUserId() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| Long cUserId = (Long) request.getAttribute(Constant.LOGIN_USER_KEY); | |||
| return cUserId; | |||
| } | |||
| // public Long getUserId() { | |||
| // HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| // Long cUserId = (Long) request.getAttribute(Constant.LOGIN_USER_KEY); | |||
| // return cUserId; | |||
| // } | |||
| public Long getMemberId() throws Exception { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| @@ -113,11 +119,17 @@ public class BaseController { | |||
| * 请尽量多用getTenantId, getUserId | |||
| */ | |||
| public WxCUser getWxCUser() { | |||
| Long cUserId = getUserId(); | |||
| WxCUser user = wxCUserService.getById(cUserId); | |||
| if (user == null) { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| BaseCUserEntity baseuser = (BaseCUserEntity) request.getAttribute(Constant.REQUEST_C_USER_KEY); | |||
| // Long cUserId = getUserId(); | |||
| // WxCUser user = wxCUserService.getById(cUserId); | |||
| if (baseuser == null) { | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| if (baseuser.getRealUser() == null) { | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| WxCUser user = baseuser.getObjectFromMap(WxCUser.class); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| if (user.getTenantId() == null) { | |||
| user.setTenantId(tenantEntity.getTenantId()); | |||
| @@ -127,7 +139,7 @@ public class BaseController { | |||
| } | |||
| return user; | |||
| } | |||
| /** | |||
| * | |||
| */ | |||
| @@ -44,7 +44,6 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true)}) | |||
| public ResultData sendvalidationcode(String phone, Integer type) { | |||
| WxCUser user = getWxCUser(); | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.updateTenantInfo(getTenantInfo()); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| @@ -94,6 +94,9 @@ public class WxUserGrantController extends BaseController { | |||
| @Autowired | |||
| WxMallService mallService; | |||
| @Autowired | |||
| private CUserTokenService cUserTokenService; | |||
| /** | |||
| @@ -401,36 +404,35 @@ public class WxUserGrantController extends BaseController { | |||
| int score = wxCUserService.actionAfterLogin(newUser, null); | |||
| resultMap.put("score", score); | |||
| } | |||
| return new ResultData(resultMap); | |||
| } | |||
| @PostMapping("/selectMall") | |||
| @ApiOperation(value = "用户选中子广场", notes = "{\"tenantId\":\"string\",\"parentTenantId\":\"string\"}") | |||
| public ResultData selectMall(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| String tenantId = map.get("tenantId"); | |||
| String parentTenantId = map.get("parentTenantId"); | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "tenantId不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(parentTenantId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "parentTenantId不能为空"); | |||
| } | |||
| WxCUser user = getWxCUser(); | |||
| if (user.getParentTenantId().equalsIgnoreCase(parentTenantId)) { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| request.setAttribute(Constant.TENANT_ID, tenantId); | |||
| request.setAttribute(Constant.PARENT_TENANT_ID, parentTenantId); | |||
| user.setTenantId(tenantId); | |||
| wxCUserService.saveOrUpdate(user); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| // @PostMapping("/selectMall") | |||
| // @ApiOperation(value = "用户选中子广场", notes = "{\"tenantId\":\"string\",\"parentTenantId\":\"string\"}") | |||
| // public ResultData selectMall(@RequestBody Map<String, String> map) { | |||
| // logger.debug(map.toString()); | |||
| // | |||
| // String tenantId = map.get("tenantId"); | |||
| // String parentTenantId = map.get("parentTenantId"); | |||
| // | |||
| // if (StringUtils.isBlank(tenantId)) { | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "tenantId不能为空"); | |||
| // } | |||
| // if (StringUtils.isBlank(parentTenantId)) { | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "parentTenantId不能为空"); | |||
| // } | |||
| // | |||
| // WxCUser user = getWxCUser(); | |||
| // if (user.getParentTenantId().equalsIgnoreCase(parentTenantId)) { | |||
| // HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| // request.setAttribute(Constant.TENANT_ID, tenantId); | |||
| // request.setAttribute(Constant.PARENT_TENANT_ID, parentTenantId); | |||
| // user.setTenantId(tenantId); | |||
| // wxCUserService.saveOrUpdate(user); | |||
| // } | |||
| // | |||
| // return new ResultData(); | |||
| // } | |||
| @PostMapping("/updateScene") | |||
| @ApiOperation(value = "用户更新scene", notes = "{\"scene\":\"string\"}") | |||
| @@ -67,6 +67,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||
| //设置userId到request里,后续根据userId,获取用户信息 | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, cUser.getId()); | |||
| request.setAttribute(Constant.TENANT_ID, cUser.getTenantId()); | |||
| request.setAttribute(Constant.REQUEST_C_USER_KEY, cUser); | |||
| if (StringUtils.isNotBlank(cUser.getParentTenantId())) { | |||
| request.setAttribute(Constant.PARENT_TENANT_ID, cUser.getParentTenantId()); | |||
| } | |||
| @@ -17,7 +17,7 @@ public class WxFlowRecord extends TenantEntity { | |||
| private Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="业务id",name="businessId") | |||
| private Long businessId; | |||
| private String businessId; | |||
| @io.swagger.annotations.ApiModelProperty(value="业务类型1合同审批2账单审批3合同终止",name="businessType") | |||
| private Integer businessType; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户id",name="userId") | |||
| @@ -67,7 +67,7 @@ public class WxFlowRecord extends TenantEntity { | |||
| private Integer approvalType; | |||
| public WxFlowRecord(){} | |||
| public WxFlowRecord(Long businessId){ | |||
| public WxFlowRecord(String businessId){ | |||
| this.businessId = businessId; | |||
| } | |||
| public WxFlowRecord(String processInstanceId,Integer currStatus){ | |||
| @@ -75,23 +75,23 @@ public class WxFlowRecord extends TenantEntity { | |||
| this.currStatus = currStatus; | |||
| } | |||
| @Deprecated | |||
| public WxFlowRecord(Long businessId,String tenantId){ | |||
| public WxFlowRecord(String businessId,String tenantId){ | |||
| this.businessId = businessId; | |||
| setTenantId(tenantId); | |||
| } | |||
| @Deprecated | |||
| public WxFlowRecord(Long businessId,String tenantId,Integer approvalType){ | |||
| public WxFlowRecord(String businessId,String tenantId,Integer approvalType){ | |||
| this.businessId = businessId; | |||
| setTenantId(tenantId); | |||
| this.approvalType = approvalType; | |||
| } | |||
| public WxFlowRecord(TenantEntity tenantEntity, Long businessId){ | |||
| public WxFlowRecord(TenantEntity tenantEntity, String businessId){ | |||
| updateTenantInfo(tenantEntity); | |||
| this.businessId = businessId; | |||
| } | |||
| public WxFlowRecord(TenantEntity tenantEntity, Long businessId,Integer approvalType){ | |||
| public WxFlowRecord(TenantEntity tenantEntity, String businessId,Integer approvalType){ | |||
| updateTenantInfo(tenantEntity); | |||
| this.businessId = businessId; | |||
| this.approvalType = approvalType; | |||
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.domain.po.base; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.UserUtil; | |||
| import lombok.Data; | |||
| @@ -7,6 +9,8 @@ import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.util.Date; | |||
| import java.util.LinkedHashMap; | |||
| import java.util.Map; | |||
| import java.util.UUID; | |||
| /** | |||
| @@ -27,6 +31,14 @@ public class BaseCUserEntity extends TenantEntity { | |||
| /*用户过期时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | |||
| private Date expireTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="真实对象如wxCUser,因为放到缓存之后,实体会变为map,索性就存map",name="realUser") | |||
| @TableField(exist = false) | |||
| private Map realUser; | |||
| public <T> T getObjectFromMap(Class<T> clazz) { | |||
| return JSONObject.parseObject(JSONObject.toJSONString(realUser), clazz); | |||
| } | |||
| /** | |||
| * 是否是会员 | |||
| @@ -26,4 +26,13 @@ public enum EnumAppPlat { | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public static EnumAppPlat getByCode(Integer code) { | |||
| for (EnumAppPlat e : EnumAppPlat.values()) { | |||
| if (e.getCode().intValue() == code.intValue()) { | |||
| return e; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -62,8 +62,8 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| long findGrowUserCount(@Param("finalTenantId")String finalTenantId); | |||
| long findGrowUserCount1(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId); | |||
| long findImportUserCount(@Param("finalTenantId")String finalTenantId); | |||
| long findImportUserCount1(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId); | |||
| //long findImportUserCount(@Param("finalTenantId")String finalTenantId); | |||
| //long findImportUserCount1(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId); | |||
| void incActRecordById(Long id); | |||
| @@ -17,7 +17,7 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| WxCUser findByUnionId(WxCUser record); | |||
| BaseCUserEntity findByToken(String token); | |||
| WxCUser findByToken(String token); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| @@ -15,7 +15,7 @@ public interface WxMerchantShopMapper extends CommonMapper<WxMerchantShop, Strin | |||
| void delShops(@Param("merchantId") Long merchantId,@Param("shopList") List<Long> shopIds); | |||
| void realDelByMerchantId(@Param("merchantId") Long merchantId); | |||
| void realDelByMerchantId(@Param("merchantId") Long merchantId,@Param("shopList") List<Long> shopIds); | |||
| } | |||
| @@ -11,5 +11,5 @@ public interface CUserTokenService { | |||
| * @return | |||
| */ | |||
| BaseCUserEntity getByToken(String token); | |||
| } | |||
| @@ -32,7 +32,7 @@ public interface WxFlowService { | |||
| */ | |||
| void updateBusinessStatus(Map<String, Object> mapInfo,Integer applyStatus); | |||
| ResultData getTaskStatusList(Long businessId,TenantEntity tenantEntity); | |||
| ResultData getTaskStatusList(String businessId,TenantEntity tenantEntity); | |||
| /** | |||
| * 启动流程 | |||
| @@ -55,7 +55,7 @@ public interface WxFlowService { | |||
| * @param businessId | |||
| * @return | |||
| */ | |||
| ResultData applyHistory(Long businessId,TenantEntity tenantEntity); | |||
| ResultData applyHistory(String businessId,TenantEntity tenantEntity); | |||
| /** | |||
| * 审批 | |||
| @@ -64,7 +64,7 @@ public interface WxRentContractService { | |||
| PageInfo<WxRentContract> getRentContractList(WxRentContract rentContract, Integer pageNum, Integer pageSize); | |||
| //void exportContract(HttpServletRequest request, HttpServletResponse response, Long id); | |||
| void exportContract(HttpServletRequest request, HttpServletResponse response, Long rentId,Long propertyId); | |||
| ResultData updateFile(WxRentContract wxRentContract, Long userId,String userName,Date oldRentStartDate,boolean writeComplate); | |||
| @@ -0,0 +1,12 @@ | |||
| package com.iformall.service.cuser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| /** | |||
| * C端用户操作 | |||
| * @author alascor | |||
| */ | |||
| public interface CUserServiceApapter { | |||
| public BaseCUserEntity getToken(String token); | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.iformall.service.cuser; | |||
| import java.util.Map; | |||
| import java.util.concurrent.ConcurrentHashMap; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.service.cuser.wx.WxCUserServiceAdapter; | |||
| @Service | |||
| public class CUserServiceFactory { | |||
| @Autowired | |||
| WxCUserServiceAdapter wxCuserService; | |||
| private Map<Integer,CUserServiceApapter> serviceMap ; | |||
| public CUserServiceApapter getCUserService(EnumAppPlat plat) { | |||
| return getcUserServiceMap().get(plat.getCode()); | |||
| } | |||
| private Map<Integer,CUserServiceApapter> getcUserServiceMap() { | |||
| if (null != serviceMap ) { | |||
| return serviceMap; | |||
| } | |||
| serviceMap = new ConcurrentHashMap<Integer,CUserServiceApapter>(); | |||
| serviceMap.put(EnumAppPlat.WX.getCode(), wxCuserService); | |||
| return serviceMap; | |||
| } | |||
| } | |||
| @@ -0,0 +1,33 @@ | |||
| package com.iformall.service.cuser.wx; | |||
| import java.util.Map; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.serializer.SerializerFeature; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.mapper.WxCUserMapper; | |||
| import com.iformall.service.cuser.CUserServiceApapter; | |||
| @Service | |||
| public class WxCUserServiceAdapter implements CUserServiceApapter{ | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @Override | |||
| public BaseCUserEntity getToken(String token) { | |||
| WxCUser wxCUser = wxCUserMapper.findByToken(token); | |||
| BaseCUserEntity entity = new BaseCUserEntity(); | |||
| entity.setId(wxCUser.getId()); | |||
| entity.setExpireTime(wxCUser.getExpireTime()); | |||
| entity.setUserId(wxCUser.getUserId()); | |||
| entity.setToken(wxCUser.getToken()); | |||
| entity.setRealUser(JSON.parseObject(JSON.toJSONString(wxCUser, SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteNullNumberAsZero, SerializerFeature.WriteMapNullValue), Map.class)); | |||
| return entity; | |||
| } | |||
| } | |||
| @@ -1,8 +1,10 @@ | |||
| package com.iformall.service.impl; | |||
| import com.iformall.domain.po.base.BaseCUserEntity; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.mapper.WxCUserMapper; | |||
| import com.iformall.service.CUserTokenService; | |||
| import com.iformall.service.cuser.CUserServiceFactory; | |||
| import com.iformall.utils.Constant; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -28,7 +30,7 @@ public class CUserTokenServiceImpl implements CUserTokenService { | |||
| @Override | |||
| public BaseCUserEntity getByToken(String token) { | |||
| BaseCUserEntity user = null; | |||
| BaseCUserEntity baseUser = null; | |||
| logger.info("获取用户信息start ..." + token); | |||
| String key = Constant.tokenPrev + token; | |||
| @@ -38,18 +40,19 @@ public class CUserTokenServiceImpl implements CUserTokenService { | |||
| boolean hasKey = baseCUserTokenRedisTemplate.hasKey(key); | |||
| if(hasKey) { | |||
| // 从缓存获取用户信息 | |||
| user = operations.get(key); | |||
| baseUser = operations.get(key); | |||
| logger.info("缓存中获取用户信息End-" + token); | |||
| return user; | |||
| return baseUser; | |||
| } | |||
| if(token.endsWith(Constant.TOKEN_WXC_END)){ | |||
| user = wxCUserMapper.findByToken(token); | |||
| baseUser = cuserFactory.getCUserService(EnumAppPlat.WX).getToken(token); | |||
| } | |||
| // 插入缓存 | |||
| operations.set(key, user, 7, TimeUnit.DAYS); | |||
| logger.info("DB中获取用户信息End-" + token); | |||
| return user; | |||
| if (null != baseUser) { | |||
| operations.set(key, baseUser, 3600*24*3, TimeUnit.SECONDS); | |||
| } | |||
| //operations.set(key, user, 3600, TimeUnit.SECONDS); | |||
| //logger.info("DB中获取用户信息End-" + token); | |||
| return baseUser; | |||
| } | |||
| } | |||
| @@ -1151,17 +1151,18 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| @Override | |||
| public long findImportUserCount(TenantEntity tenantEntity) { | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findImportUserCount1(tenantEntity.getTenantId(),tenantEntity.getParentTenantId()); | |||
| }else{ | |||
| //直接查询本表 | |||
| String finalTenantId = tenantEntity.getTenantId(); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| finalTenantId = tenantEntity.getParentTenantId(); | |||
| } | |||
| return wxCUserBasicInfoMapper.findImportUserCount(finalTenantId); | |||
| } | |||
| // if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| // //关联微信表查询 | |||
| // return wxCUserBasicInfoMapper.findImportUserCount1(tenantEntity.getTenantId(),tenantEntity.getParentTenantId()); | |||
| // }else{ | |||
| // //直接查询本表 | |||
| // String finalTenantId = tenantEntity.getTenantId(); | |||
| // if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| // finalTenantId = tenantEntity.getParentTenantId(); | |||
| // } | |||
| // return wxCUserBasicInfoMapper.findImportUserCount(finalTenantId); | |||
| // } | |||
| return 0; | |||
| } | |||
| @Override | |||
| @@ -155,7 +155,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| */ | |||
| @Override | |||
| public void updateBusinessStatus(Map<String, Object> mapInfo,Integer applyStatus){ | |||
| Long businessId = Long.parseLong(mapInfo.get("businessId").toString()); | |||
| String businessId = mapInfo.get("businessId").toString(); | |||
| Integer flowType = getIngeter(mapInfo.get("flowType")); | |||
| List<Map<String,Object>> variables = (List)mapInfo.get("variables"); | |||
| Integer contractType = 0; | |||
| @@ -181,11 +181,20 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| EnumFlowContractType.WHOLE_POINT.getCode().equals(contractType)) { | |||
| WxRentContract rent = new WxRentContract(); | |||
| rent.setId(businessId); | |||
| //租金+合同的bussinessId 特殊 | |||
| Long bsId = 0L; | |||
| Long propetyId = 0L; | |||
| if (businessId.contains("_RP_")) { | |||
| bsId = Long.parseLong(businessId.split("_RP_")[0]); | |||
| propetyId = Long.parseLong(businessId.split("_RP_")[1]); | |||
| }else { | |||
| bsId = Long.parseLong(businessId); | |||
| } | |||
| rent.setId(bsId); | |||
| rent.setApplyStatus(applyStatus); | |||
| rent.setBusinessType(flowType); | |||
| WxRentContract record = wxRentContractMapper.selectById(businessId); | |||
| WxRentContract record = wxRentContractMapper.selectById(bsId); | |||
| boolean isrentproperty = false; | |||
| Integer propertyStatus = null; | |||
| @@ -193,7 +202,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| if(record.getOperationType().equals(EnumContractOperationType.WHOLE.getCode())){ | |||
| isrentproperty = true; | |||
| } | |||
| String wholeProperyId = (String)mapInfo.get("wholeProperyId"); | |||
| //String wholeProperyId = (String)mapInfo.get("wholeProperyId"); | |||
| //如果是提交审批 , 审批驳回状态不变 | |||
| if (EnumRentContractAppStatus.APPLYING.getCode().intValue() == applyStatus.intValue()) { | |||
| //如果合同的状态非正常,则不处理 | |||
| @@ -206,15 +215,23 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| //如果审批完成 | |||
| }else if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| wxRentContractService.updateRentContractStatus(businessId); | |||
| wxRentContractService.updateRentContractStatus(bsId); | |||
| if (isrentproperty) { | |||
| wxPropertyContractService.updatePropertyContractStatus(Long.parseLong(wholeProperyId)); | |||
| wxPropertyContractService.updatePropertyContractStatus(propetyId); | |||
| } | |||
| //如果是审批撤回,或者驳回,改回草稿状态 | |||
| }else if (EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue() | |||
| || EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()) { | |||
| rent.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| //如果是租金+物业,则还要更新物业合同的状态 | |||
| if (isrentproperty) { | |||
| propertyStatus = EnumRentContractStatus.DRAFT.getCode(); | |||
| } | |||
| } | |||
| wxRentContractService.updateApplyStatus(rent); | |||
| if (isrentproperty) { | |||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||
| wxPropertyContract.setId(Long.parseLong(wholeProperyId)); | |||
| wxPropertyContract.setId(propetyId); | |||
| wxPropertyContract.setRentContractId(record.getId()); | |||
| wxPropertyContract.setStatus(propertyStatus); | |||
| wxPropertyContract.setApplyStatus(applyStatus); | |||
| @@ -224,7 +241,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| }else if(EnumFlowContractType.PROPERTY.getCode().equals(contractType) || EnumFlowContractType.PROPERTY_POINT.getCode().equals(contractType)){ | |||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||
| wxPropertyContract.setId(businessId); | |||
| wxPropertyContract.setId(Long.parseLong(businessId)); | |||
| wxPropertyContract.setApplyStatus(applyStatus); | |||
| wxPropertyContract.setBusinessType(flowType); | |||
| @@ -233,8 +250,12 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| wxPropertyContract.setStatus(EnumRentContractStatus.PERFORMANCE.getCode()); | |||
| // 审批完成 | |||
| }else if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| wxPropertyContractService.updatePropertyContractStatus(businessId); | |||
| } | |||
| wxPropertyContractService.updatePropertyContractStatus(Long.parseLong(businessId)); | |||
| //如果是审批撤回,或者驳回,改回草稿状态 | |||
| }else if (EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue() | |||
| || EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()) { | |||
| wxPropertyContract.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||
| } | |||
| wxPropertyContractMapper.updateApplyStatus(wxPropertyContract); | |||
| } | |||
| @@ -252,7 +273,17 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| EnumFlowContractType.WHOLE_SHOP.getCode().equals(contractType) || | |||
| EnumFlowContractType.WHOLE_POINT.getCode().equals(contractType)){ | |||
| WxRentContract rent = new WxRentContract(); | |||
| rent.setId(businessId); | |||
| //租金+合同的bussinessId 特殊 | |||
| Long bsId ; | |||
| Long propetyId; | |||
| if (businessId.contains("_RP_")) { | |||
| bsId = Long.parseLong(businessId.split("_RP_")[0]); | |||
| propetyId = Long.parseLong(businessId.split("_RP_")[1]); | |||
| }else { | |||
| bsId = Long.parseLong(businessId); | |||
| } | |||
| rent.setId(bsId); | |||
| rent.setApplyStatus(applyStatus); | |||
| rent.setBusinessType(flowType); | |||
| @@ -267,7 +298,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| wxRentContractService.updateApplyStatus(rent); | |||
| }else if(EnumFlowContractType.PROPERTY.getCode().equals(contractType) || EnumFlowContractType.PROPERTY_POINT.getCode().equals(contractType)){ | |||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | |||
| wxPropertyContract.setId(businessId); | |||
| wxPropertyContract.setId(Long.parseLong(businessId)); | |||
| wxPropertyContract.setApplyStatus(applyStatus); | |||
| wxPropertyContract.setBusinessType(flowType); | |||
| @@ -288,7 +319,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| Long oldPrice = Long.parseLong(getVariableByKey(variables, "oldPrice").toString()); | |||
| Long newPrice = Long.parseLong(getVariableByKey(variables, "newPrice").toString()); | |||
| WxBillAll wxBillAll = new WxBillAll(); | |||
| wxBillAll.setId(businessId); | |||
| wxBillAll.setId(Long.parseLong(businessId)); | |||
| wxBillAll.setBillTypeValue(billType); | |||
| if(EnumBillUpdateType.LATEPAY.getCode().equals(billUpdateType)){ //修改滞纳金 | |||
| wxBillAll.setOldLatePrice(oldPrice); | |||
| @@ -303,7 +334,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| List<WxBillSettleBill> billList = new ArrayList<>(); | |||
| WxBillSettleBill settleBill = new WxBillSettleBill(); | |||
| settleBill.setBillType(billType); | |||
| settleBill.setBillId(businessId); | |||
| settleBill.setBillId(Long.parseLong(businessId)); | |||
| billList.add(settleBill); | |||
| wxBillSettleService.updateFreezeOrStatus(billList,EnumFreezeType.DEF.getCode(),null); | |||
| }else if(EnumRentContractAppStatus.APPLYING.getCode().intValue() == applyStatus.intValue()) { | |||
| @@ -311,7 +342,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| List<WxBillSettleBill> billList = new ArrayList<>(); | |||
| WxBillSettleBill settleBill = new WxBillSettleBill(); | |||
| settleBill.setBillType(billType); | |||
| settleBill.setBillId(businessId); | |||
| settleBill.setBillId(Long.parseLong(businessId)); | |||
| billList.add(settleBill); | |||
| wxBillSettleService.updateFreezeOrStatus(billList,EnumFreezeType.YES.getCode(),null); | |||
| }else if(EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue() || EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()) { | |||
| @@ -319,7 +350,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| List<WxBillSettleBill> billList = new ArrayList<>(); | |||
| WxBillSettleBill settleBill = new WxBillSettleBill(); | |||
| settleBill.setBillType(billType); | |||
| settleBill.setBillId(businessId); | |||
| settleBill.setBillId(Long.parseLong(businessId)); | |||
| billList.add(settleBill); | |||
| wxBillSettleService.updateFreezeOrStatus(billList,EnumFreezeType.DEF.getCode(),null); | |||
| } | |||
| @@ -328,7 +359,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| || EnumFlowKey.NEW_GROUP_UPLINE.getCode().equals(flowType) | |||
| || EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType)) { | |||
| WxCoupon wxCoupon = new WxCoupon(); | |||
| wxCoupon.setId(businessId); | |||
| wxCoupon.setId(Long.parseLong(businessId)); | |||
| wxCoupon.setUpdateDate(new Date()); | |||
| if(EnumCouponAppType.PUT.getCode().equals(operateType)){ | |||
| @@ -380,11 +411,11 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| clearCache(wxCoupon); | |||
| }else if(EnumFlowKey.SETTLE.getCode().equals(flowType)){ | |||
| WxBillSettle wxBillSettle = new WxBillSettle(); | |||
| wxBillSettle.setId(businessId); | |||
| wxBillSettle.setId(Long.parseLong(businessId)); | |||
| wxBillSettle.setApplyStatus(applyStatus); | |||
| //审批完成,账单解冻 | |||
| WxBillSettle settle = wxBillSettleService.getById(businessId, EnumFilterSettle.NO.getCode()); | |||
| WxBillSettle settle = wxBillSettleService.getById(Long.parseLong(businessId), EnumFilterSettle.NO.getCode()); | |||
| if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { | |||
| wxBillSettle.setStatus(EnumSettleStatus.NOT_FINISH.getCode()); | |||
| wxBillSettleService.updateFreezeOrStatus(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); | |||
| @@ -462,7 +493,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class}) | |||
| public ResultData start(Map<String, Object> params,Long userId,String userName,TenantEntity tenantEntity) { | |||
| String remark = (String)params.get("remark"); | |||
| Long businessId = Long.parseLong(params.get("businessId").toString()); | |||
| String businessId = params.get("businessId").toString(); | |||
| Integer flowType = getIngeter(params.get("businessType")); | |||
| List<Map<String,Object>> variables = (List)params.get("variables"); | |||
| @@ -519,7 +550,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| return new ResultData(); | |||
| } | |||
| public void sendAssigneeMsgAndEmail(TenantEntity tenantEntity, String phone, String email, String userName, Long businessId, Integer flowType, List<Map<String, Object>> variables) { | |||
| public void sendAssigneeMsgAndEmail(TenantEntity tenantEntity, String phone, String email, String userName, String businessId, Integer flowType, List<Map<String, Object>> variables) { | |||
| Map<String,String> dynamicContentMap = new HashMap<>(); | |||
| dynamicContentMap.put("userName",userName); | |||
| dynamicContentMap.put("page", Constant.adminPage); | |||
| @@ -740,11 +771,15 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| @Override | |||
| public ResultData applyHistory(Long businessId,TenantEntity tenantEntity) { | |||
| public ResultData applyHistory(String businessId,TenantEntity tenantEntity) { | |||
| List<WxFlowRecord> result; | |||
| WxCoupon query = new WxCoupon(); | |||
| query.updateTenantInfo(tenantEntity); | |||
| query.setId(businessId); | |||
| try { | |||
| query.setId(Long.parseLong(businessId)); | |||
| }catch(Exception e) { | |||
| query.setId(0L); | |||
| } | |||
| List<WxCoupon> couponList = wxCouponMapper.findList(query); | |||
| if(CollectionUtils.isNotEmpty(couponList)) { | |||
| WxCoupon coupon = couponList.get(0); | |||
| @@ -774,7 +809,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| @Override | |||
| public ResultData getTaskStatusList(Long businessId, TenantEntity tenantEntity) { | |||
| public ResultData getTaskStatusList(String businessId, TenantEntity tenantEntity) { | |||
| List<WxFlowRecord> resultList = wxFlowRecordService.findList(new WxFlowRecord(tenantEntity, businessId)); | |||
| if(CollectionUtils.isEmpty(resultList)){ | |||
| return new ResultData(); | |||
| @@ -972,7 +1007,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| taskName = task.getName(); | |||
| taskKey = task.getTaskDefinitionKey(); | |||
| Map<String,Object> mapInfo = taskService.getVariables(task.getId()); | |||
| Long businessId = Long.parseLong(mapInfo.get("businessId").toString()); | |||
| String businessId = mapInfo.get("businessId").toString(); | |||
| Integer flowType = (Integer)mapInfo.get("flowType"); | |||
| List<Map<String,Object>> variables = (List)mapInfo.get("variables"); | |||
| Date startDate = (Date)mapInfo.get("startDate"); | |||
| @@ -1018,7 +1053,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.updateTenantInfo(tenantEntity); | |||
| Map<String,Object> userMap = (Map<String,Object>)mapInfo.get("starter"); | |||
| Long businessId = Long.parseLong(mapInfo.get("businessId").toString()); | |||
| String businessId = mapInfo.get("businessId").toString(); | |||
| String email = (String)userMap.get("email"); | |||
| List<Map<String,Object>> variables = (List)mapInfo.get("variables"); | |||
| Integer flowType = (Integer)mapInfo.get("flowType"); | |||
| @@ -1230,7 +1265,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| return new ResultData(ErrorCode.FLOW_INST_NOT_EXIST.getCode(), "任务不存在"); | |||
| } | |||
| Map<String,Object> mapInfo = taskService.getVariables(taskList.get(0).getId()); | |||
| Long businessId = Long.parseLong(mapInfo.get("businessId").toString()); | |||
| String businessId = mapInfo.get("businessId").toString(); | |||
| Integer flowType = (Integer)mapInfo.get("flowType"); | |||
| Map<String,Object> userMap = (Map<String,Object>)mapInfo.get("starter"); | |||
| String email = (String) userMap.get("email"); | |||
| @@ -1343,7 +1378,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| List<Task> task = taskService.createTaskQuery().processInstanceId(processInstanceId).list(); | |||
| Map<String,Object> mapInfo = taskService.getVariables(task.get(0).getId()); | |||
| Long businessId = Long.parseLong(mapInfo.get("businessId").toString()); | |||
| String businessId = mapInfo.get("businessId").toString(); | |||
| Integer flowType = (Integer)mapInfo.get("flowType"); | |||
| List<Map<String,Object>> variables = (List)mapInfo.get("variables"); | |||
| Date startDate = (Date)mapInfo.get("startDate"); | |||
| @@ -463,48 +463,53 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| List<Long> shopIds = wxMerchant.getShopids(); | |||
| //如果原来店铺在商户里面有有效的合同,则不能操作 | |||
| List<Long> oldShopIds = wxMerchantShopMapper.findShopIds(wxMerchant.getId()); | |||
| List<Long> coldShopIds = new ArrayList<Long>(); | |||
| if (null != oldShopIds && oldShopIds.size() > 0) { | |||
| if(null != shopIds) { | |||
| //去重 | |||
| oldShopIds.removeAll(shopIds); | |||
| } | |||
| for (Long osid : oldShopIds) { | |||
| WxRentContract wrc = new WxRentContract(); | |||
| wrc.setMerchantId(wxMerchant.getId()); | |||
| wrc.setQueryShopId(osid); | |||
| wrc.setStatuss(EnumRentContractStatus.getValidStatus()); | |||
| wrc.updateTenantInfo(wxMerchant); | |||
| List<WxRentContract> clist = wxRentContractService.findList(wrc); | |||
| if (null != clist && clist.size() > 0 ) { | |||
| return new ResultData(ErrorCode.MERCHANT_HASRENTCONTRACT.getCode(),"店铺["+osid+"]存在有效的合同,不能解除绑定."); | |||
| } | |||
| } | |||
| } | |||
| //都验证过了之后,先把之前的商铺释放,删除关系 | |||
| if (null != oldShopIds && oldShopIds.size() > 0 ) { | |||
| wxShopMapper.updateUnRentByIds(oldShopIds); | |||
| wxMerchantShopMapper.realDelByMerchantId(wxMerchant.getId()); | |||
| coldShopIds.addAll(oldShopIds); | |||
| oldShopIds.removeAll(shopIds); | |||
| if (null != oldShopIds && oldShopIds.size() > 0 ) { | |||
| for (Long osid : oldShopIds) { | |||
| WxRentContract wrc = new WxRentContract(); | |||
| wrc.setMerchantId(wxMerchant.getId()); | |||
| wrc.setQueryShopId(osid); | |||
| wrc.setStatuss(EnumRentContractStatus.getValidStatus()); | |||
| wrc.updateTenantInfo(wxMerchant); | |||
| List<WxRentContract> clist = wxRentContractService.findList(wrc); | |||
| if (null != clist && clist.size() > 0 ) { | |||
| return new ResultData(ErrorCode.MERCHANT_HASRENTCONTRACT.getCode(),"店铺["+osid+"]存在有效的合同,不能解除绑定."); | |||
| } | |||
| } | |||
| //都验证过了之后,先把之前的商铺释放,删除关系 | |||
| wxShopMapper.updateUnRentByIds(oldShopIds); | |||
| wxMerchantShopMapper.realDelByMerchantId(wxMerchant.getId(),oldShopIds); | |||
| } | |||
| } | |||
| if (null != shopIds) { | |||
| shopIds.removeAll(coldShopIds); | |||
| List<Long> currSIds = new ArrayList<Long>(); | |||
| for (Long sid: shopIds) { | |||
| WxMerchantShop mcs = new WxMerchantShop(); | |||
| mcs.setMerchantId(wxMerchant.getId()); | |||
| mcs.setShopId(sid); | |||
| mcs.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| mcs.setId(idWorker.nextId()); | |||
| mcs.updateTenantInfo(wxMerchant); | |||
| Date shopdate = new Date(); | |||
| mcs.setUpdateDate(shopdate); | |||
| mcs.setCreateDate(shopdate); | |||
| wxMerchantShopMapper.insert(mcs); | |||
| //更新商铺状态 | |||
| WxShop sh = wxShopMapper.selectById(sid); | |||
| sh.setStatus(EnumShopStatus.RENT.getCode()); | |||
| wxShopMapper.updateById(sh); | |||
| if (!currSIds.contains(sid)) { | |||
| WxMerchantShop mcs = new WxMerchantShop(); | |||
| mcs.setMerchantId(wxMerchant.getId()); | |||
| mcs.setShopId(sid); | |||
| mcs.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| mcs.setId(idWorker.nextId()); | |||
| mcs.updateTenantInfo(wxMerchant); | |||
| Date shopdate = new Date(); | |||
| mcs.setUpdateDate(shopdate); | |||
| mcs.setCreateDate(shopdate); | |||
| wxMerchantShopMapper.insert(mcs); | |||
| //更新商铺状态 | |||
| WxShop sh = wxShopMapper.selectById(sid); | |||
| sh.setStatus(EnumShopStatus.RENT.getCode()); | |||
| wxShopMapper.updateById(sh); | |||
| currSIds.add(sid); | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS, "商户更新成功"); | |||
| } catch (Exception e) { | |||
| logger.error("db failed: 商户更新失败, e:" + e.getMessage()); | |||
| @@ -198,7 +198,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| //发起人备注 | |||
| WxFlowRecord wxFlowRecord = new WxFlowRecord(); | |||
| wxFlowRecord.setBusinessId(id); | |||
| wxFlowRecord.setBusinessId(String.valueOf(id)); | |||
| wxFlowRecord.setStatus(EnumFlowRecordStatus.NEW.getCode()); | |||
| List<WxFlowRecord> flowRecordList = wxFlowRecordService.findList(wxFlowRecord); | |||
| if(!CollectionUtils.isEmpty(flowRecordList)){ | |||
| @@ -1110,8 +1110,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| return new ResultData(Result.ERROR, "编号["+record.getId()+"]租金合同没有绑定商户."); | |||
| } | |||
| if ((EnumRentContractStatus.DRAFT.getCode().intValue() == rentContract.getStatus().intValue() | |||
| && EnumRentContractAppStatus.DEFAULT.getCode().intValue() == rentContract.getApplyStatus().intValue()) | |||
| if ((EnumRentContractStatus.DRAFT.getCode().intValue() == rentContract.getStatus().intValue()) | |||
| || (EnumRentContractStatus.PERFORMANCE.getCode().intValue() == rentContract.getStatus().intValue() | |||
| && (EnumRentContractAppStatus.REJECT.getCode().intValue() == rentContract.getApplyStatus().intValue() || | |||
| EnumRentContractAppStatus.SETBACK.getCode().intValue() == rentContract.getApplyStatus().intValue())) | |||
| @@ -1127,7 +1126,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| wxFlowService.start(rentContract.getFlowParams(), user.getId(), user.getName(), rentContract); | |||
| return new ResultData(Result.SUCCESS,"提交审批成功",rentContract); | |||
| }else { | |||
| return new ResultData(Result.ERROR, "编号["+record.getId()+"]物业合同状态不能提交审批.允许提交的状态为 [草稿+未提交审批],[履约中+审批驳回]"); | |||
| return new ResultData(Result.ERROR, "编号["+record.getId()+"]物业合同状态不能提交审批.允许提交的状态为 [草稿],[履约中+审批驳回]"); | |||
| } | |||
| } | |||
| @@ -246,7 +246,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| //发起人备注 | |||
| WxFlowRecord wxFlowRecord = new WxFlowRecord(); | |||
| wxFlowRecord.setBusinessId(id); | |||
| wxFlowRecord.setBusinessId(String.valueOf(id)); | |||
| wxFlowRecord.setStatus(EnumFlowRecordStatus.NEW.getCode()); | |||
| List<WxFlowRecord> flowRecordList = wxFlowRecordService.findList(wxFlowRecord); | |||
| if(!CollectionUtils.isEmpty(flowRecordList)){ | |||
| @@ -898,7 +898,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //修改flowRecord | |||
| WxFlowRecord fr = new WxFlowRecord(); | |||
| fr.setBusinessId(id); | |||
| fr.setBusinessId(String.valueOf(id)); | |||
| fr.setCurrStatus(EnumRentContractAppStatus.CANCLE.getCode()); | |||
| wxFlowRecordMapper.updateCurrStatus(fr); | |||
| @@ -944,7 +944,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| // 保存审批历史入 | |||
| MallUserInfo mallUserInfo = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||
| WxFlowRecord updateRecord = new WxFlowRecord(); | |||
| updateRecord.setBusinessId(id); | |||
| updateRecord.setBusinessId(String.valueOf(id)); | |||
| updateRecord.setStatus(EnumFlowRecordStatus.CANCLE.getCode()); | |||
| updateRecord.setBusinessType(1); | |||
| updateRecord.setUserId(mallUserInfo.getId()); | |||
| @@ -1593,32 +1593,32 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| // return resultData; | |||
| // } | |||
| // @Override | |||
| // public void exportContract(HttpServletRequest request, HttpServletResponse response, Long id) { | |||
| // String contracType = "0"; | |||
| // String templatePath = null; | |||
| // Map<String, Object> result = null; | |||
| // if (EnumContractType.ALL.getCode().toString().equals(contracType)) { | |||
| // logger.info("获取租赁及物业合同数据"); | |||
| // result = getRentAndPropertyInfo(id); | |||
| // result.put("contractType", EnumContractType.ALL.getMessage()); | |||
| // if (EnumRentContractType.RENT_BY_AREA.getCode().equals(result.get("type"))) { | |||
| // templatePath = "contract-word-template/contract_rent_property.docx"; | |||
| // } else { | |||
| // templatePath = "contract-word-template/contract_rent_property_by_ratio.docx"; | |||
| // } | |||
| // logger.info("租赁及物业合同数据结果:" + result); | |||
| // } | |||
| // | |||
| // if (templatePath == null) { | |||
| // logger.info("没有租赁及物业合同模板"); | |||
| // return; | |||
| // } | |||
| // String filepath = fmUploadDir; | |||
| // String filename = UUID.randomUUID() + ".docx"; | |||
| // String exportFileName = result.get("merchantName").toString() + "合同.docx"; | |||
| // WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,null); | |||
| // } | |||
| @Override | |||
| public void exportContract(HttpServletRequest request, HttpServletResponse response, Long rentId,Long propertyId) { | |||
| String contracType = "0"; | |||
| String templatePath = null; | |||
| Map<String, Object> result = null; | |||
| if (EnumContractType.ALL.getCode().toString().equals(contracType)) { | |||
| logger.info("获取租赁及物业合同数据"); | |||
| result = getRentAndPropertyInfo(rentId,propertyId); | |||
| result.put("contractType", EnumContractType.ALL.getMessage()); | |||
| if (EnumRentContractType.RENT_BY_AREA.getCode().equals(result.get("type"))) { | |||
| templatePath = "contract-word-template/contract_rent_property.docx"; | |||
| } else { | |||
| templatePath = "contract-word-template/contract_rent_property_by_ratio.docx"; | |||
| } | |||
| logger.info("租赁及物业合同数据结果:" + result); | |||
| } | |||
| if (templatePath == null) { | |||
| logger.info("没有租赁及物业合同模板"); | |||
| return; | |||
| } | |||
| String filepath = fmUploadDir; | |||
| String filename = UUID.randomUUID() + ".docx"; | |||
| String exportFileName = result.get("merchantName").toString() + "合同.docx"; | |||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,null); | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @@ -1703,283 +1703,287 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| } | |||
| // public Map<String, Object> getRentAndPropertyInfo(Long id) { | |||
| // logger.info("获取租赁物业合同数据>>>>>>id:" + id); | |||
| // Map<String, Object> result = new HashMap<>(); | |||
| // WxRentContract wxRentContract = wxRentContractMapper.selectById(id); | |||
| // if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| // JSONArray jsonArray = JSONArray.parseArray(wxRentContract.getRentInfo()); | |||
| // StringBuffer shopNumberStr = new StringBuffer(); | |||
| // StringBuffer floorNameStr = new StringBuffer(); | |||
| // StringBuffer buildingNameStr = new StringBuffer(); | |||
| // StringBuffer buildAreaStr = new StringBuffer(); | |||
| // StringBuffer operationAreaStr = new StringBuffer(); | |||
| // for (int i = 0, size = jsonArray.size(); i < size; i++) { | |||
| // JSONObject jsonObject = jsonArray.getJSONObject(i); | |||
| // shopNumberStr.append("[").append(jsonObject.getString("shopNumber")).append("]"); | |||
| // floorNameStr.append("[").append(jsonObject.getString("floor")).append("]"); | |||
| // buildingNameStr.append("[").append(jsonObject.getString("building")).append("]"); | |||
| // buildAreaStr.append("[").append(jsonObject.getString("buildArea")).append("]"); | |||
| // operationAreaStr.append("[").append(jsonObject.getString("operationArea")).append("]"); | |||
| // } | |||
| // result.put("shopNumber", shopNumberStr); | |||
| // result.put("floorName", floorNameStr); | |||
| // result.put("buildingName", buildingNameStr); | |||
| // result.put("buildArea", buildAreaStr); | |||
| // result.put("operationArea", operationAreaStr); | |||
| // } else { | |||
| // //record.setId(wxRentContract.getShopId()); | |||
| // if (wxRentContract.shopIdsByRentInfo().size() == 0) { | |||
| // result.put("shopNumber", " "); | |||
| // result.put("floorName", " "); | |||
| // result.put("buildingName", " "); | |||
| // result.put("buildArea", " "); | |||
| // result.put("operationArea", " "); | |||
| // }else { | |||
| // WxShop record = new WxShop(); | |||
| // record.setIds(wxRentContract.shopIdsByRentInfo()); | |||
| // List<Map<String, Object>> wxShops = wxShopMapper.findListMap(record); | |||
| // if (!wxShops.isEmpty()) { | |||
| // //店铺信息 | |||
| // Map<String, Object> wxShop = wxShops.get(0); | |||
| // result.put("shopNumber", wxShop.get("shopNumber")); | |||
| // result.put("floorName", wxShop.get("floor")); | |||
| // result.put("buildingName", wxShop.get("building")); | |||
| // result.put("buildArea", wxShop.get("buildArea")); | |||
| // result.put("operationArea", wxShop.get("operationArea")); | |||
| // } | |||
| // } | |||
| // } | |||
| // //MALL信息 | |||
| // WxMall wxMall = new WxMall(); | |||
| // wxMall.setTenantInfo(wxRentContract); | |||
| // wxMall = wxMallMapper.findList(wxMall).get(0); | |||
| // result.put("mallName", wxMall.getName()); | |||
| // result.put("province", wxMall.getProvince()); | |||
| // result.put("city", wxMall.getCity()); | |||
| // | |||
| // //商户信息 | |||
| // WxMerchant merchant = wxMerchantService.getById(wxRentContract.getMerchantId()); | |||
| // //经营业态 | |||
| // wxRentContract.getMerchantId(); | |||
| // WxBusiness wxBusiness = wxBusinessMapper.selectById(merchant.getBusinessId()); | |||
| // result.put("business", wxBusiness.getTitle()); | |||
| // | |||
| // if (merchant != null) { | |||
| // result.put("merchantName", merchant.getName()); | |||
| // //法人信息 | |||
| // WxMerchantCorp wxMerchantCorp = merchant.getWxMerchantCorp(); | |||
| // result.put("corpPapersNumber", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersNumber()) ? wxMerchantCorp.getCorpPapersNumber() : " "); | |||
| // result.put("corpPapersType", wxMerchantCorp.getCorpPapersType() != null ? EnumPapersType.getEnum(wxMerchantCorp.getCorpPapersType()).getMessage() : " "); | |||
| // result.put("corpPapersPerson", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersPerson()) ? wxMerchantCorp.getCorpPapersPerson() : " "); | |||
| // //税务信息 | |||
| // WxMerchantTax wxMerchantTax = merchant.getWxMerchantTax(); | |||
| // result.put("taxPapersType", wxMerchantTax.getTaxPapersType() != null ? EnumTaxpayerType.getEnum(wxMerchantTax.getTaxPapersType()).getMessage() : " "); | |||
| // result.put("bankName", StringUtils.isNotEmpty(wxMerchantTax.getBankName()) ? wxMerchantTax.getBankName() : " "); | |||
| // result.put("bankAccount", StringUtils.isNotEmpty(wxMerchantTax.getBankAccount()) ? wxMerchantTax.getBankAccount() : " "); | |||
| // result.put("invoiceAddressPhone", StringUtils.isNotEmpty(wxMerchantTax.getInvoiceAddressPhone()) ? wxMerchantTax.getInvoiceAddressPhone() : " "); | |||
| // } else { | |||
| // result.put("merchantName", ""); | |||
| // //法人信息 | |||
| // result.put("corpPapersNumber", " "); | |||
| // result.put("corpPapersType", " "); | |||
| // result.put("corpPapersPerson", " "); | |||
| // //税务信息 | |||
| // result.put("taxPapersType", " "); | |||
| // result.put("bankName", " "); | |||
| // result.put("bankAccount", " "); | |||
| // result.put("invoiceAddressPhone", " "); | |||
| // } | |||
| // //租赁合同信息 | |||
| // String rentalStartDate = DateUtils.date2String(wxRentContract.getRentalStartDate(), "yyyy-MM-dd"); | |||
| // result.put("rentalStartDate", rentalStartDate); | |||
| // result.put("rentalStartDateYear", rentalStartDate.substring(0, 4)); | |||
| // result.put("rentalStartDateMonth", rentalStartDate.substring(5, 7)); | |||
| // result.put("rentalStartDateDay", rentalStartDate.substring(8)); | |||
| // String rentalEndDate = DateUtils.date2String(wxRentContract.getRentalEndDate(), "yyyy-MM-dd"); | |||
| // result.put("rentalEndDate", rentalEndDate); | |||
| // result.put("rentalEndDateYear", rentalEndDate.substring(0, 4)); | |||
| // result.put("rentalEndDateMonth", rentalEndDate.substring(5, 7)); | |||
| // result.put("rentalEndDateDay", rentalEndDate.substring(8)); | |||
| // result.put("price", wxRentContract.getPrice()); | |||
| // result.put("contractNumber", wxRentContract.getContractNumber()); | |||
| // Integer lease = wxRentContract.getLease(); | |||
| // Integer receivePeriod = wxRentContract.getReceivePeriod(); | |||
| // result.put("lease", lease); | |||
| // result.put("receivePeriod", receivePeriod); | |||
| // String payAccountStr = " "; | |||
| // if(wxRentContract.getPayAccount() != null && !wxRentContract.getPayAccount().equals("")) { | |||
| // payAccountStr = wxRentContract.getPayAccount(); | |||
| // } | |||
| // result.put("payAccount", payAccountStr); | |||
| // result.put("signDate", DateUtils.date2String(wxRentContract.getSignDate(), "yyyy-MM-dd")); | |||
| // //主体名称-乙方 | |||
| // if (StringUtils.isNotEmpty(wxRentContract.getSubjectName())) { | |||
| // result.put("corpPapersPerson", wxRentContract.getSubjectName()); | |||
| // } else { | |||
| // result.put("corpPapersPerson", " "); | |||
| // } | |||
| // | |||
| // //品牌 | |||
| // Long brandId = merchant.getBrand(); | |||
| // String brand = " "; | |||
| // if (brandId != null) { | |||
| // WxBrand wxBrand = WxBrandMapper.selectById(brandId); | |||
| // if (wxBrand != null) { | |||
| // brand = wxBrand.getName(); | |||
| // } | |||
| // } | |||
| // result.put("brand", brand); | |||
| // // TODO | |||
| // //double adjustRatio = wxRentContract.getAdjustRatio() != null ? wxRentContract.getAdjustRatio() / 100.0 : 0; | |||
| // result.put("adjustRatio", 0); | |||
| // double priceRent = new BigDecimal(wxRentContract.getPrice()) | |||
| // .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| // result.put("priceRent", priceRent); | |||
| // if (!wxRentContract.getRentArea().equals("0")) { | |||
| // double unitPrice = new BigDecimal(wxRentContract.getPrice()) | |||
| // .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) | |||
| // .divide(new BigDecimal(100)) | |||
| // .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| // result.put("unitPriceRent", unitPrice); | |||
| // result.put("priceRentUpper", PriceUtil.digitUppercase(priceRent)); | |||
| // result.put("unitPriceRentUpper", PriceUtil.digitUppercase(unitPrice)); | |||
| // } else { | |||
| // result.put("unitPriceRent", 0); | |||
| // result.put("priceRentUpper", PriceUtil.digitUppercase(0)); | |||
| // result.put("unitPriceRentUpper", PriceUtil.digitUppercase(0)); | |||
| // } | |||
| // | |||
| // //租赁保证金 | |||
| // int cashDepositMonthRent = 3; | |||
| // double cashDepositRent = new BigDecimal(wxRentContract.getPrice()).multiply(new BigDecimal(cashDepositMonthRent)) | |||
| // .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| // result.put("cashDepositMonthRent", cashDepositMonthRent); | |||
| // result.put("cashDepositRent", cashDepositRent); | |||
| // result.put("cashDepositRentUpper", PriceUtil.digitUppercase(cashDepositRent)); | |||
| // result.put("type", wxRentContract.getType()); | |||
| // int extralease = lease % 12; | |||
| // int extracount = extralease > 0 ? 1 : 0; | |||
| // int paycount = lease / 12 + extracount; | |||
| // int index = 10 - paycount; | |||
| // int count = paycount - 1; | |||
| // BigDecimal rentPrice = new BigDecimal(priceRent); | |||
| // //保底 | |||
| // if (wxRentContract.getRevenue() != null) { | |||
| // double revenue = new BigDecimal(wxRentContract.getRevenue()) | |||
| // .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| // result.put("revenue", revenue); | |||
| // result.put("revenueUpper", PriceUtil.digitUppercase(revenue)); | |||
| // } else { | |||
| // result.put("revenue", 0); | |||
| // result.put("revenueUpper", PriceUtil.digitUppercase(0)); | |||
| // } | |||
| // if (!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||
| // areaWay(wxRentContract, result, lease, extralease, extracount, paycount, index, count, rentPrice); | |||
| // } else { | |||
| // ratioWay(wxRentContract, result, lease, extralease, extracount, paycount, index, count, rentPrice); | |||
| // } | |||
| // //物业合同信息 | |||
| // WxPropertyContract propertyContract = new WxPropertyContract(); | |||
| // propertyContract.updateTenantInfo(wxRentContract); | |||
| // propertyContract.setRentContractId(wxRentContract.getId()); | |||
| //// Optional<Map<String, Object>> first = wxPropertyContractMapper.queryPropertyContractData(propertyContract) | |||
| //// .stream().filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) | |||
| //// && !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) | |||
| //// && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) | |||
| //// && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) | |||
| //// && !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode())).findFirst(); | |||
| // Optional<Map<String, Object>> first = wxPropertyContractMapper.queryPropertyContractData(propertyContract) | |||
| // .stream().filter(rc -> !rc.get("status").equals(EnumRentContractStatus.TERMINATE.getCode()) | |||
| // && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) | |||
| // && !rc.get("status").equals(EnumRentContractStatus.OUT_DATE.getCode())).findFirst(); | |||
| // Map<String, Object> wxPropertyContract = null; | |||
| // if (first.isPresent()) { | |||
| // wxPropertyContract = first.get(); | |||
| // } | |||
| // if (wxPropertyContract != null) { | |||
| // Integer receivePeriodProperty = (Integer) wxPropertyContract.get("receivePeriod"); | |||
| // result.put("receivePeriodProperty", receivePeriodProperty); | |||
| // double priceProperty = new BigDecimal(wxPropertyContract.get("price").toString()) | |||
| // .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| // result.put("priceProperty", priceProperty); | |||
| // if (!wxRentContract.getRentArea().equals("0")) { | |||
| // double unitPriceProperty = new BigDecimal(wxPropertyContract.get("price").toString()) | |||
| // .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) | |||
| // .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| // result.put("unitPriceProperty", unitPriceProperty); | |||
| // result.put("pricePropertyUpper", PriceUtil.digitUppercase(priceProperty)); | |||
| // result.put("unitPricePropertyUpper", PriceUtil.digitUppercase(unitPriceProperty)); | |||
| // } else { | |||
| // result.put("unitPriceProperty", 0); | |||
| // result.put("pricePropertyUpper", PriceUtil.digitUppercase(0)); | |||
| // result.put("unitPricePropertyUpper", PriceUtil.digitUppercase(0)); | |||
| // } | |||
| // | |||
| // //首期物业费 | |||
| // Calendar instance = Calendar.getInstance(); | |||
| // instance.setTime(wxRentContract.getRentalStartDate()); | |||
| // instance.add(Calendar.MONTH, 0); | |||
| // Date starttime = instance.getTime(); | |||
| // String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); | |||
| // result.put("rentalStartDateProperty", startdate); | |||
| // result.put("rentalStartDateYearProperty", startdate.substring(0, 4)); | |||
| // result.put("rentalStartDateMonthProperty", startdate.substring(5, 7)); | |||
| // result.put("rentalStartDateDayProperty", startdate.substring(8)); | |||
| // //结束时间 | |||
| // instance.clear(); | |||
| // instance.setTime(starttime); | |||
| // instance.add(Calendar.MONTH, receivePeriodProperty); | |||
| // instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| // Date endtime = instance.getTime(); | |||
| // String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); | |||
| // result.put("rentalEndDateProperty", enddate); | |||
| // result.put("rentalEndDateYearProperty", enddate.substring(0, 4)); | |||
| // result.put("rentalEndDateMonthProperty", enddate.substring(5, 7)); | |||
| // result.put("rentalEndDateDayProperty", enddate.substring(8)); | |||
| // double pricePropertyFirst = new BigDecimal(priceProperty) | |||
| // .multiply(new BigDecimal(receivePeriodProperty)) | |||
| // .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| // result.put("pricePropertyFirst", pricePropertyFirst); | |||
| // result.put("pricePropertyFirstUpper", PriceUtil.digitUppercase(pricePropertyFirst)); | |||
| // | |||
| // | |||
| // //物业保证金 | |||
| // int cashDepositMonthProperty = 3; | |||
| // double cashDepositProperty = new BigDecimal(wxPropertyContract.get("price").toString()).multiply(new BigDecimal(cashDepositMonthProperty)) | |||
| // .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| // result.put("cashDepositMonthProperty", cashDepositMonthProperty); | |||
| // result.put("cashDepositProperty", cashDepositProperty); | |||
| // result.put("cashDepositPropertyUpper", PriceUtil.digitUppercase(cashDepositProperty)); | |||
| // | |||
| // | |||
| // } else { | |||
| // result.put("receivePeriodProperty", " "); | |||
| // result.put("priceProperty", " "); | |||
| // result.put("unitPriceProperty", " "); | |||
| // result.put("pricePropertyUpper", " "); | |||
| // result.put("unitPricePropertyUpper", " "); | |||
| // //首期物业费 | |||
| // result.put("rentalStartDateProperty", " "); | |||
| // result.put("rentalStartDateYearProperty", " "); | |||
| // result.put("rentalStartDateMonthProperty", " "); | |||
| // result.put("rentalStartDateDayProperty", " "); | |||
| // //结束时间 | |||
| // result.put("rentalEndDateProperty", " "); | |||
| // result.put("rentalEndDateYearProperty", " "); | |||
| // result.put("rentalEndDateMonthProperty", " "); | |||
| // result.put("rentalEndDateDayProperty", " "); | |||
| // result.put("pricePropertyFirst", " "); | |||
| // result.put("pricePropertyFirstUpper", " "); | |||
| // //物业保证金 | |||
| // result.put("cashDepositMonthProperty", " "); | |||
| // result.put("cashDepositProperty", " "); | |||
| // result.put("cashDepositPropertyUpper", " "); | |||
| // } | |||
| // | |||
| // | |||
| // return result; | |||
| // } | |||
| public Map<String, Object> getRentAndPropertyInfo(Long rentId,Long propertyId) { | |||
| logger.info("获取租赁物业合同数据>>>>>>rentId:" + rentId +" >>>>propertyId:"+propertyId); | |||
| Map<String, Object> result = new HashMap<>(); | |||
| WxRentContract wxRentContract = wxRentContractMapper.selectById(rentId); | |||
| if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| JSONArray jsonArray = JSONArray.parseArray(wxRentContract.getRentInfo()); | |||
| StringBuffer shopNumberStr = new StringBuffer(); | |||
| StringBuffer floorNameStr = new StringBuffer(); | |||
| StringBuffer buildingNameStr = new StringBuffer(); | |||
| StringBuffer buildAreaStr = new StringBuffer(); | |||
| StringBuffer operationAreaStr = new StringBuffer(); | |||
| for (int i = 0, size = jsonArray.size(); i < size; i++) { | |||
| JSONObject jsonObject = jsonArray.getJSONObject(i); | |||
| shopNumberStr.append("[").append(jsonObject.getString("shopNumber")).append("]"); | |||
| floorNameStr.append("[").append(jsonObject.getString("floor")).append("]"); | |||
| buildingNameStr.append("[").append(jsonObject.getString("building")).append("]"); | |||
| buildAreaStr.append("[").append(jsonObject.getString("buildArea")).append("]"); | |||
| operationAreaStr.append("[").append(jsonObject.getString("operationArea")).append("]"); | |||
| } | |||
| result.put("shopNumber", shopNumberStr); | |||
| result.put("floorName", floorNameStr); | |||
| result.put("buildingName", buildingNameStr); | |||
| result.put("buildArea", buildAreaStr); | |||
| result.put("operationArea", operationAreaStr); | |||
| } else { | |||
| //record.setId(wxRentContract.getShopId()); | |||
| if (wxRentContract.shopIdsByRentInfo().size() == 0) { | |||
| result.put("shopNumber", " "); | |||
| result.put("floorName", " "); | |||
| result.put("buildingName", " "); | |||
| result.put("buildArea", " "); | |||
| result.put("operationArea", " "); | |||
| }else { | |||
| WxShop record = new WxShop(); | |||
| record.setIds(wxRentContract.shopIdsByRentInfo()); | |||
| List<Map<String, Object>> wxShops = wxShopMapper.findListMap(record); | |||
| if (!wxShops.isEmpty()) { | |||
| //店铺信息 | |||
| Map<String, Object> wxShop = wxShops.get(0); | |||
| result.put("shopNumber", wxShop.get("shopNumber")); | |||
| result.put("floorName", wxShop.get("floor")); | |||
| result.put("buildingName", wxShop.get("building")); | |||
| result.put("buildArea", wxShop.get("buildArea")); | |||
| result.put("operationArea", wxShop.get("operationArea")); | |||
| } | |||
| } | |||
| } | |||
| //MALL信息 | |||
| WxMall wxMall = new WxMall(); | |||
| wxMall.setTenantInfo(wxRentContract); | |||
| wxMall = wxMallMapper.findList(wxMall).get(0); | |||
| result.put("mallName", wxMall.getName()); | |||
| result.put("province", wxMall.getProvince()); | |||
| result.put("city", wxMall.getCity()); | |||
| //商户信息 | |||
| WxMerchant merchant = wxMerchantService.getById(wxRentContract.getMerchantId()); | |||
| //经营业态 | |||
| wxRentContract.getMerchantId(); | |||
| WxBusiness wxBusiness = wxBusinessMapper.selectById(merchant.getBusinessId()); | |||
| result.put("business", wxBusiness.getTitle()); | |||
| if (merchant != null) { | |||
| result.put("merchantName", merchant.getName()); | |||
| //法人信息 | |||
| WxMerchantCorp wxMerchantCorp = merchant.getWxMerchantCorp(); | |||
| result.put("corpPapersNumber", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersNumber()) ? wxMerchantCorp.getCorpPapersNumber() : " "); | |||
| result.put("corpPapersType", wxMerchantCorp.getCorpPapersType() != null ? EnumPapersType.getEnum(wxMerchantCorp.getCorpPapersType()).getMessage() : " "); | |||
| result.put("corpPapersPerson", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersPerson()) ? wxMerchantCorp.getCorpPapersPerson() : " "); | |||
| //税务信息 | |||
| WxMerchantTax wxMerchantTax = merchant.getWxMerchantTax(); | |||
| result.put("taxPapersType", wxMerchantTax.getTaxPapersType() != null ? EnumTaxpayerType.getEnum(wxMerchantTax.getTaxPapersType()).getMessage() : " "); | |||
| result.put("bankName", StringUtils.isNotEmpty(wxMerchantTax.getBankName()) ? wxMerchantTax.getBankName() : " "); | |||
| result.put("bankAccount", StringUtils.isNotEmpty(wxMerchantTax.getBankAccount()) ? wxMerchantTax.getBankAccount() : " "); | |||
| result.put("invoiceAddressPhone", StringUtils.isNotEmpty(wxMerchantTax.getInvoiceAddressPhone()) ? wxMerchantTax.getInvoiceAddressPhone() : " "); | |||
| } else { | |||
| result.put("merchantName", ""); | |||
| //法人信息 | |||
| result.put("corpPapersNumber", " "); | |||
| result.put("corpPapersType", " "); | |||
| result.put("corpPapersPerson", " "); | |||
| //税务信息 | |||
| result.put("taxPapersType", " "); | |||
| result.put("bankName", " "); | |||
| result.put("bankAccount", " "); | |||
| result.put("invoiceAddressPhone", " "); | |||
| } | |||
| //租赁合同信息 | |||
| String rentalStartDate = DateUtils.date2String(wxRentContract.getRentalStartDate(), "yyyy-MM-dd"); | |||
| result.put("rentalStartDate", rentalStartDate); | |||
| result.put("rentalStartDateYear", rentalStartDate.substring(0, 4)); | |||
| result.put("rentalStartDateMonth", rentalStartDate.substring(5, 7)); | |||
| result.put("rentalStartDateDay", rentalStartDate.substring(8)); | |||
| String rentalEndDate = DateUtils.date2String(wxRentContract.getRentalEndDate(), "yyyy-MM-dd"); | |||
| result.put("rentalEndDate", rentalEndDate); | |||
| result.put("rentalEndDateYear", rentalEndDate.substring(0, 4)); | |||
| result.put("rentalEndDateMonth", rentalEndDate.substring(5, 7)); | |||
| result.put("rentalEndDateDay", rentalEndDate.substring(8)); | |||
| result.put("price", wxRentContract.getPrice()); | |||
| result.put("contractNumber", wxRentContract.getContractNumber()); | |||
| Integer lease = wxRentContract.getLease(); | |||
| Integer receivePeriod = wxRentContract.getReceivePeriod(); | |||
| result.put("lease", lease); | |||
| result.put("receivePeriod", receivePeriod); | |||
| String payAccountStr = " "; | |||
| if(wxRentContract.getPayAccount() != null && !wxRentContract.getPayAccount().equals("")) { | |||
| payAccountStr = wxRentContract.getPayAccount(); | |||
| } | |||
| result.put("payAccount", payAccountStr); | |||
| result.put("signDate", DateUtils.date2String(wxRentContract.getSignDate(), "yyyy-MM-dd")); | |||
| //主体名称-乙方 | |||
| if (StringUtils.isNotEmpty(wxRentContract.getSubjectName())) { | |||
| result.put("corpPapersPerson", wxRentContract.getSubjectName()); | |||
| } else { | |||
| result.put("corpPapersPerson", " "); | |||
| } | |||
| //品牌 | |||
| Long brandId = merchant.getBrand(); | |||
| String brand = " "; | |||
| if (brandId != null) { | |||
| WxBrand wxBrand = WxBrandMapper.selectById(brandId); | |||
| if (wxBrand != null) { | |||
| brand = wxBrand.getName(); | |||
| } | |||
| } | |||
| result.put("brand", brand); | |||
| // TODO | |||
| //double adjustRatio = wxRentContract.getAdjustRatio() != null ? wxRentContract.getAdjustRatio() / 100.0 : 0; | |||
| result.put("adjustRatio", 0); | |||
| double priceRent = new BigDecimal(wxRentContract.getPrice()) | |||
| .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| result.put("priceRent", priceRent); | |||
| if (!wxRentContract.getRentArea().equals("0")) { | |||
| double unitPrice = new BigDecimal(wxRentContract.getPrice()) | |||
| .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) | |||
| .divide(new BigDecimal(100)) | |||
| .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| result.put("unitPriceRent", unitPrice); | |||
| result.put("priceRentUpper", PriceUtil.digitUppercase(priceRent)); | |||
| result.put("unitPriceRentUpper", PriceUtil.digitUppercase(unitPrice)); | |||
| } else { | |||
| result.put("unitPriceRent", 0); | |||
| result.put("priceRentUpper", PriceUtil.digitUppercase(0)); | |||
| result.put("unitPriceRentUpper", PriceUtil.digitUppercase(0)); | |||
| } | |||
| //租赁保证金 | |||
| int cashDepositMonthRent = 3; | |||
| double cashDepositRent = new BigDecimal(wxRentContract.getPrice()).multiply(new BigDecimal(cashDepositMonthRent)) | |||
| .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| result.put("cashDepositMonthRent", cashDepositMonthRent); | |||
| result.put("cashDepositRent", cashDepositRent); | |||
| result.put("cashDepositRentUpper", PriceUtil.digitUppercase(cashDepositRent)); | |||
| result.put("type", wxRentContract.getType()); | |||
| int extralease = lease % 12; | |||
| int extracount = extralease > 0 ? 1 : 0; | |||
| int paycount = lease / 12 + extracount; | |||
| int index = 10 - paycount; | |||
| int count = paycount - 1; | |||
| BigDecimal rentPrice = new BigDecimal(priceRent); | |||
| //保底 | |||
| if (wxRentContract.getRevenue() != null) { | |||
| double revenue = new BigDecimal(wxRentContract.getRevenue()) | |||
| .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| result.put("revenue", revenue); | |||
| result.put("revenueUpper", PriceUtil.digitUppercase(revenue)); | |||
| } else { | |||
| result.put("revenue", 0); | |||
| result.put("revenueUpper", PriceUtil.digitUppercase(0)); | |||
| } | |||
| if (!wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||
| areaWay(wxRentContract, result, lease, extralease, extracount, paycount, index, count, rentPrice); | |||
| } else { | |||
| ratioWay(wxRentContract, result, lease, extralease, extracount, paycount, index, count, rentPrice); | |||
| } | |||
| //物业合同信息 | |||
| //WxPropertyContract propertyContract = new WxPropertyContract(); | |||
| //propertyContract.updateTenantInfo(wxRentContract); | |||
| //propertyContract.setRentContractId(wxRentContract.getId()); | |||
| // Optional<Map<String, Object>> first = wxPropertyContractMapper.queryPropertyContractData(propertyContract) | |||
| // .stream().filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) | |||
| // && !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) | |||
| // && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) | |||
| // && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) | |||
| // && !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode())).findFirst(); | |||
| //Optional<Map<String, Object>> first = wxPropertyContractMapper.queryPropertyContractData(propertyContract) | |||
| //.stream().filter(rc -> !rc.get("status").equals(EnumRentContractStatus.TERMINATE.getCode()) | |||
| // && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) | |||
| // && !rc.get("status").equals(EnumRentContractStatus.OUT_DATE.getCode())).findFirst(); | |||
| // Map<String, Object> wxPropertyContract = null; | |||
| // if (first.isPresent()) { | |||
| // wxPropertyContract = first.get(); | |||
| // } | |||
| WxPropertyContract propertyContract = null; | |||
| if (null != propertyId) { | |||
| propertyContract = wxPropertyContractMapper.selectById(propertyId); | |||
| } | |||
| if (propertyContract != null) { | |||
| Integer receivePeriodProperty = propertyContract.getReceivePeriod(); | |||
| result.put("receivePeriodProperty", receivePeriodProperty); | |||
| double priceProperty = new BigDecimal(propertyContract.getPrice().toString()) | |||
| .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| result.put("priceProperty", priceProperty); | |||
| if (!wxRentContract.getRentArea().equals("0")) { | |||
| double unitPriceProperty = new BigDecimal(propertyContract.getPrice().toString()) | |||
| .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) | |||
| .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| result.put("unitPriceProperty", unitPriceProperty); | |||
| result.put("pricePropertyUpper", PriceUtil.digitUppercase(priceProperty)); | |||
| result.put("unitPricePropertyUpper", PriceUtil.digitUppercase(unitPriceProperty)); | |||
| } else { | |||
| result.put("unitPriceProperty", 0); | |||
| result.put("pricePropertyUpper", PriceUtil.digitUppercase(0)); | |||
| result.put("unitPricePropertyUpper", PriceUtil.digitUppercase(0)); | |||
| } | |||
| //首期物业费 | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(wxRentContract.getRentalStartDate()); | |||
| instance.add(Calendar.MONTH, 0); | |||
| Date starttime = instance.getTime(); | |||
| String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); | |||
| result.put("rentalStartDateProperty", startdate); | |||
| result.put("rentalStartDateYearProperty", startdate.substring(0, 4)); | |||
| result.put("rentalStartDateMonthProperty", startdate.substring(5, 7)); | |||
| result.put("rentalStartDateDayProperty", startdate.substring(8)); | |||
| //结束时间 | |||
| instance.clear(); | |||
| instance.setTime(starttime); | |||
| instance.add(Calendar.MONTH, receivePeriodProperty); | |||
| instance.add(Calendar.DAY_OF_MONTH, -1); | |||
| Date endtime = instance.getTime(); | |||
| String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); | |||
| result.put("rentalEndDateProperty", enddate); | |||
| result.put("rentalEndDateYearProperty", enddate.substring(0, 4)); | |||
| result.put("rentalEndDateMonthProperty", enddate.substring(5, 7)); | |||
| result.put("rentalEndDateDayProperty", enddate.substring(8)); | |||
| double pricePropertyFirst = new BigDecimal(priceProperty) | |||
| .multiply(new BigDecimal(receivePeriodProperty)) | |||
| .setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| result.put("pricePropertyFirst", pricePropertyFirst); | |||
| result.put("pricePropertyFirstUpper", PriceUtil.digitUppercase(pricePropertyFirst)); | |||
| //物业保证金 | |||
| int cashDepositMonthProperty = 3; | |||
| double cashDepositProperty = new BigDecimal(propertyContract.getPrice().toString()).multiply(new BigDecimal(cashDepositMonthProperty)) | |||
| .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); | |||
| result.put("cashDepositMonthProperty", cashDepositMonthProperty); | |||
| result.put("cashDepositProperty", cashDepositProperty); | |||
| result.put("cashDepositPropertyUpper", PriceUtil.digitUppercase(cashDepositProperty)); | |||
| } else { | |||
| result.put("receivePeriodProperty", " "); | |||
| result.put("priceProperty", " "); | |||
| result.put("unitPriceProperty", " "); | |||
| result.put("pricePropertyUpper", " "); | |||
| result.put("unitPricePropertyUpper", " "); | |||
| //首期物业费 | |||
| result.put("rentalStartDateProperty", " "); | |||
| result.put("rentalStartDateYearProperty", " "); | |||
| result.put("rentalStartDateMonthProperty", " "); | |||
| result.put("rentalStartDateDayProperty", " "); | |||
| //结束时间 | |||
| result.put("rentalEndDateProperty", " "); | |||
| result.put("rentalEndDateYearProperty", " "); | |||
| result.put("rentalEndDateMonthProperty", " "); | |||
| result.put("rentalEndDateDayProperty", " "); | |||
| result.put("pricePropertyFirst", " "); | |||
| result.put("pricePropertyFirstUpper", " "); | |||
| //物业保证金 | |||
| result.put("cashDepositMonthProperty", " "); | |||
| result.put("cashDepositProperty", " "); | |||
| result.put("cashDepositPropertyUpper", " "); | |||
| } | |||
| return result; | |||
| } | |||
| public void ratioWay(WxRentContract wxRentContract, Map<String, Object> result, Integer lease, int extralease, int extracount, int paycount, int index, int count, BigDecimal rentPrice) { | |||
| String adjustRatio = wxRentContract.getAdjustRatio(); | |||
| @@ -2462,7 +2466,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wrq.setStatus(EnumRentContractStatus.PERFORMANCE.getCode()); | |||
| List<WxRentContract> clist = wxRentContractMapper.findList(wrq); | |||
| if (null != clist && clist.size() > 0 ) { | |||
| return new ResultData(Result.ERROR, "当前存在其他审批中的合同。请先作完成。"); | |||
| return new ResultData(Result.ERROR, "当前存在其他审批中的租金合同。请先作完成。"); | |||
| } | |||
| //如果该合同是租金+物业合同,则还要判断物业合同 | |||
| if(rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { | |||
| WxPropertyContract wpc = new WxPropertyContract(); | |||
| wpc.updateTenantInfo(user); | |||
| wpc.setStatus(EnumRentContractStatus.PERFORMANCE.getCode()); | |||
| List<WxPropertyContract> plist = wxPropertyContractMapper.findList(wpc); | |||
| if (null != plist && plist.size() > 0 ) { | |||
| return new ResultData(Result.ERROR, "当前存在其他审批中的物业合同。请先作完成。"); | |||
| } | |||
| } | |||
| // Integer count = wxRentContractMapper.getCanApplyCount(rentContract.getId()); | |||
| // if (null != count && count.intValue()>0) { | |||
| @@ -2477,8 +2491,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| return new ResultData(Result.ERROR, "编号["+rentContract.getId()+"]租金合同没有绑定商户."); | |||
| } | |||
| if ((EnumRentContractStatus.DRAFT.getCode().intValue() == rentContract.getStatus().intValue() | |||
| && EnumRentContractAppStatus.DEFAULT.getCode().intValue() == rentContract.getApplyStatus().intValue()) | |||
| if ((EnumRentContractStatus.DRAFT.getCode().intValue() == rentContract.getStatus().intValue()) | |||
| || (EnumRentContractStatus.PERFORMANCE.getCode().intValue() == rentContract.getStatus().intValue() | |||
| && (EnumRentContractAppStatus.REJECT.getCode().intValue() == rentContract.getApplyStatus().intValue() || | |||
| EnumRentContractAppStatus.SETBACK.getCode().intValue() == rentContract.getApplyStatus().intValue())) | |||
| @@ -2491,11 +2504,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| if (null == flowModle) { | |||
| return new ResultData(Result.ERROR, "编号["+rentContract.getId()+"]租金合同配置的流程["+String.valueOf(bussinessType)+"]未找到流程模板."); | |||
| } | |||
| rentContract.getFlowParams().put("businessId", rentContract.getId().toString()); | |||
| //rentContract.getFlowParams().put("businessId", rentContract.getId().toString()); | |||
| wxFlowService.start(rentContract.getFlowParams(), user.getId(), user.getName(), rentContract); | |||
| return new ResultData(Result.SUCCESS,"提交审批成功",rentContract); | |||
| }else { | |||
| return new ResultData(Result.ERROR, "编号["+rentContract.getId()+"]租金合同状态不能提交审批.允许提交的状态为 [草稿+未提交审批],[履约中+审批驳回]"); | |||
| return new ResultData(Result.ERROR, "编号["+rentContract.getId()+"]租金合同状态不能提交审批.允许提交的状态为 [草稿],[履约中+审批驳回]"); | |||
| } | |||
| } | |||
| @@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| @@ -301,18 +302,18 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| String return_code = returnMap.get("return_code"); | |||
| if (!"SUCCESS".equals(return_code)) { | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage() + returnMap.get("return_msg")); | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage() + returnMap.get("return_msg")+":"+JSON.toJSONString(returnMap)); | |||
| return new ShareAccountResult(false, ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), returnMap.get("return_msg"), null); | |||
| } | |||
| String result_code = returnMap.get("result_code"); | |||
| if (!"SUCCESS".equals(result_code)) { | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage() + returnMap.get("err_code_des")); | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage() + returnMap.get("err_code_des")+":"+JSON.toJSONString(returnMap)); | |||
| return new ShareAccountResult(false, ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), returnMap.get("err_code_des"), null); | |||
| } | |||
| if (!WxPayment.verifyNotifyHMAC(returnMap, payAccount.getApiKey())) { | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage() + "verifyNotifyHMAC"); | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage() + "verifyNotifyHMAC"+":"+JSON.toJSONString(returnMap)); | |||
| return new ShareAccountResult(false, ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_ADD_FAILED.getMessage(), null); | |||
| } | |||
| @@ -355,7 +356,7 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||
| String return_code = returnMap.get("return_code"); | |||
| if (!"SUCCESS".equals(return_code)) { | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("return_msg")); | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("return_msg")+":"+JSON.toJSONString(returnMap)); | |||
| return new ShareAccountResult(false, ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("return_msg"), null); | |||
| } | |||
| @@ -367,12 +368,12 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||
| receiver.setUpdateTime(new Date()); | |||
| wxProfitSharingReceiverMapper.updateById(receiver); | |||
| } | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("err_code_des")); | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage() + returnMap.get("err_code_des")+":"+JSON.toJSONString(returnMap)); | |||
| return new ShareAccountResult(false, ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), returnMap.get("err_code_des"), null); | |||
| } | |||
| if (!WxPayment.verifyNotifyHMAC(returnMap, payAccount.getApiKey())) { | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage()); | |||
| log.error(ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getMessage()+":"+JSON.toJSONString(returnMap)); | |||
| return new ShareAccountResult(false, ErrorCode.PROFIT_SHARING_RECEIVER_DEL_FAILED.getCode(), "verifyNotifyHMAC", null); | |||
| } | |||
| @@ -33,6 +33,7 @@ public class Constant { | |||
| public static final String LOGIN_MEMBER_KEY = "LOGIN_MEMBER_KEY"; | |||
| public static final String TENANT_ID = "TENANT_ID"; | |||
| public static final String PARENT_TENANT_ID = "PARENT_TENANT_ID"; | |||
| public static final String REQUEST_C_USER_KEY = "REQUEST_C_USER"; | |||
| public static final String adminPage = "https://admin.malls.iformall.com"; | |||
| @@ -1016,7 +1016,7 @@ | |||
| </select> | |||
| <select id="findImportUserCount" resultType="java.lang.Long"> | |||
| <!-- <select id="findImportUserCount" resultType="java.lang.Long"> | |||
| SELECT count(distinct cubi.id) FROM wx_c_user_basic_info cubi | |||
| left join wx_c_user cu on cubi.id=cu.user_id | |||
| where cu.id is null | |||
| @@ -1035,7 +1035,7 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cu.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| </select> --> | |||
| <select id="findGrowUserCount" resultType="java.lang.Long"> | |||
| SELECT count(distinct cubi.id) FROM wx_c_user_basic_info cubi | |||
| @@ -38,10 +38,13 @@ | |||
| </if> | |||
| <if test=" null != carNumber "> | |||
| <if test=" null != carNumber "> | |||
| and `car_number` = #{carNumber} | |||
| </if> | |||
| <!-- <if test=" null != carNumber "> | |||
| and `car_number` like concat('%', #{carNumber},'%') | |||
| </if> | |||
| </if> --> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| @@ -231,27 +231,17 @@ | |||
| </select> | |||
| <select id="findByOpenId" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap"> | |||
| select * from wx_c_user | |||
| select <include refid="allColumns"/> from wx_c_user | |||
| where `app_id` = #{appId} and `open_id` = #{openId} | |||
| </select> | |||
| <select id="findByUnionId" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap"> | |||
| select * from wx_c_user | |||
| select <include refid="allColumns"/> from wx_c_user | |||
| where `open_app_id` = #{openAppId} and `union_id` = #{unionId} | |||
| </select> | |||
| <resultMap id="BaseCUserResultMap" type="com.iformall.domain.po.base.BaseCUserEntity"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
| <result column="token" jdbcType="VARCHAR" property="token"/> | |||
| <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/> | |||
| </resultMap> | |||
| <select id="findByToken" resultMap="BaseCUserResultMap"> | |||
| select id,user_id,tenant_id,parent_tenant_id,token,expire_time from wx_c_user | |||
| <select id="findByToken" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from wx_c_user | |||
| where `token` = #{token} | |||
| </select> | |||
| @@ -83,8 +83,11 @@ | |||
| </foreach> | |||
| </update> | |||
| <delete id="realDelByMerchantId" parameterType="Long"> | |||
| delete from wx_merchant_shop where merchant_id = #{merchantId} | |||
| <delete id="realDelByMerchantId" parameterType="java.util.Map"> | |||
| delete from wx_merchant_shop where merchant_id = #{merchantId} and shop_id in | |||
| <foreach collection="shopList" index="index" item="shopItem" open="(" separator="," close=")"> | |||
| #{shopItem} | |||
| </foreach> | |||
| </delete> | |||
| @@ -76,6 +76,7 @@ | |||
| </if> | |||
| <if test=" null != filepath ">and `filepath` = #{filepath}</if> | |||
| <if test=" null != status ">and `status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != contractNumber ">and `contract_number` = #{contractNumber}</if> | |||
| <if test=" null != deposit ">and `deposit` = #{deposit}</if> | |||
| <if test=" null != payDate ">and `pay_date` = #{payDate}</if> | |||
| @@ -110,6 +110,7 @@ | |||
| </if> | |||
| <if test=" null != filepath and '' != filepath">and `filepath` = #{filepath}</if> | |||
| <if test=" null != status and '' != status">and `status` = #{status}</if> | |||
| <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if> | |||
| <if test=" null != contractNumber and '' != contractNumber">and `contract_number` = #{contractNumber}</if> | |||
| <if test=" null != deposit and '' != deposit">and `deposit` = #{deposit}</if> | |||
| <if test=" null != payDate and '' != payDate">and `pay_date` = #{payDate}</if> | |||