| | |
| | | private String communityId; |
| | | private String feeId; |
| | | private String bId; |
| | | |
| | | private String payerObjId; |
| | | private String payerObjType; |
| | | |
| | | private Date createTime; |
| | | private Date startTime; |
| | |
| | | public void setbId(String bId) { |
| | | this.bId = bId; |
| | | } |
| | | |
| | | public String getPayerObjId() { |
| | | return payerObjId; |
| | | } |
| | | |
| | | public void setPayerObjId(String payerObjId) { |
| | | this.payerObjId = payerObjId; |
| | | } |
| | | |
| | | public String getPayerObjType() { |
| | | return payerObjType; |
| | | } |
| | | |
| | | public void setPayerObjType(String payerObjType) { |
| | | this.payerObjType = payerObjType; |
| | | } |
| | | } |
| | |
| | | **/ |
| | | public class FeeDiscountDto extends PageDto implements Serializable { |
| | | |
| | | //类型 1001 优惠 2002 违约 |
| | | //类型 1001 优惠 2002 违约 3003 优惠(需要申请) |
| | | public static final String DISCOUNT_TYPE_D = "1001"; //优惠 |
| | | public static final String DISCOUNT_TYPE_V = "2002"; //违约 |
| | | public static final String DISCOUNT_TYPE_DV = "3003"; //优惠(需要申请) |
| | | |
| | | private String discountName; |
| | | private String discountDesc; |
| | |
| | | public static final String SPEC_CD_WECHAT_TEMPLATE = "33003";//欠费推送模板 |
| | | public static final String SPEC_CD_WECHAT_SUCCESS_TEMPLATE = "33004";//业主缴费成功推送模板 |
| | | public static final String SPEC_CD_WECHAT_EXPIRE_TEMPLATE = "33005";//业主费用到期通知推送模板 |
| | | public static final String SPEC_CD_WECHAT_PROCESS_TEMPLATE = "33006";//空置房验房申请流程、审批流程通知模板 |
| | | public static final String SPEC_CD_WECHAT_ROOM_STATE_TEMPLATE = "33007";//空置房验房状态(通过和不通过)、审批状态(通过和不通过)模板 |
| | | public static final String SPEC_CD_WECHAT_WORK_ORDER_REMIND_TEMPLATE = "33008";//报修工单提醒模板 |
| | | public static final String SPEC_CD_WECHAT_DISPATCH_REMIND_TEMPLATE = "33009";//报修工单派单和转单提醒给维修师傅 |
| | | public static final String SPEC_CD_WECHAT_SCHEDULE_TEMPLATE = "33010";//报修工单派单和抢单提醒给业主,安排师傅维修(进度提醒) |
| | | public static final String SPEC_CD_WECHAT_WORK_ORDER_END_TEMPLATE = "33011";//报修工单维修完成提醒给业主 |
| | | |
| | | private String attrId; |
| | | private String wechatId; |
| | |
| | | private Content keyword2; |
| | | private Content keyword3; |
| | | private Content keyword4; |
| | | private Content keyword5; |
| | | private Content remark; |
| | | |
| | | public Content getFirst() { |
| | |
| | | this.keyword4 = keyword4; |
| | | } |
| | | |
| | | public Content getKeyword5() { |
| | | return keyword5; |
| | | } |
| | | |
| | | public void setKeyword5(Content keyword5) { |
| | | this.keyword5 = keyword5; |
| | | } |
| | | |
| | | public Content getRemark() { |
| | | return remark; |
| | | } |
| | |
| | | * <p> |
| | | * add by wuxw 2019-03-19 |
| | | */ |
| | | public interface IPageData { |
| | | public interface IPageData { |
| | | |
| | | /** |
| | | * 获取用户ID |
| | | * |
| | | * @return 用户ID |
| | | */ |
| | | String getUserId(); |
| | | String getUserId(); |
| | | |
| | | /** |
| | | * 获取用户ID |
| | | * |
| | | * @return 用户ID |
| | | */ |
| | | String getUserName(); |
| | | |
| | | String getAppId(); |
| | | String getAppId(); |
| | | |
| | | /** |
| | | * 获取交易流水 |
| | | * |
| | | * @return 交易流水 |
| | | */ |
| | | String getTransactionId(); |
| | | String getTransactionId(); |
| | | |
| | | /** |
| | | * 获取组件编码 |
| | | * |
| | | * @return 组件编码 |
| | | */ |
| | | String getComponentCode(); |
| | | String getComponentCode(); |
| | | |
| | | /** |
| | | * 获取调用的组件方法 |
| | | * |
| | | * @return 组件方法 |
| | | */ |
| | | String getComponentMethod(); |
| | | String getComponentMethod(); |
| | | |
| | | /** |
| | | * 获取token |
| | | * |
| | | * @return token |
| | | */ |
| | | String getToken(); |
| | | String getToken(); |
| | | |
| | | /** |
| | | * 设置token |
| | | * |
| | | * @param token 登录成功时需要设置token |
| | | */ |
| | | void setToken(String token); |
| | | void setToken(String token); |
| | | |
| | | /** |
| | | * 获取sessionID |
| | | * |
| | | * @return sessionID |
| | | */ |
| | | String getSessionId(); |
| | | String getSessionId(); |
| | | |
| | | /** |
| | | * 获取前台请求的数据 |
| | | * |
| | | * @return 前台请求的数据 |
| | | */ |
| | | String getReqData(); |
| | | String getReqData(); |
| | | |
| | | /** |
| | | * 获取返回时间 |
| | | * |
| | | * @return 返回时间 |
| | | */ |
| | | String getResponseTime(); |
| | | String getResponseTime(); |
| | | |
| | | /** |
| | | * 获取请求时间 |
| | | * |
| | | * @return 请求时间 |
| | | */ |
| | | String getRequestTime(); |
| | | String getRequestTime(); |
| | | |
| | | |
| | | /** |
| | | * 获取 ResponseEntity |
| | | * |
| | | * @return ResponseEntity |
| | | */ |
| | | ResponseEntity getResponseEntity(); |
| | | ResponseEntity getResponseEntity(); |
| | | |
| | | |
| | | /** |
| | | * 设置 ResponseEntity |
| | | * |
| | | * @param responseEntity 返回界面时的对象 |
| | | */ |
| | | void setResponseEntity(ResponseEntity responseEntity); |
| | | void setResponseEntity(ResponseEntity responseEntity); |
| | | |
| | | /** |
| | | * 获取调用api 地址 |
| | | * |
| | | * @return |
| | | */ |
| | | public String getApiUrl(); |
| | | |
| | | //设置调用api 服务地址 |
| | | public void setApiUrl(String apiUrl); |
| | | |
| | |
| | | |
| | | public void setMethod(HttpMethod method); |
| | | |
| | | public String getPayerObjId(); |
| | | |
| | | public void setPayerObjId(String payerObjId); |
| | | |
| | | public String getPayerObjType(); |
| | | |
| | | public void setPayerObjType(String payerObjType); |
| | | |
| | | public String getEndTime(); |
| | | |
| | | public void setEndTime(String endTime); |
| | | |
| | | /** |
| | | * 构建 pd 对象 |
| | | * @param userId 用户ID |
| | | * @param token token |
| | | * @param reqData 请求数据 |
| | | * @param componentCode 组件编码 |
| | | * |
| | | * @param userId 用户ID |
| | | * @param token token |
| | | * @param reqData 请求数据 |
| | | * @param componentCode 组件编码 |
| | | * @param componentMethod 组件方法 |
| | | * @param url 请求url |
| | | * @param sessionId 会话ID |
| | | * @param url 请求url |
| | | * @param sessionId 会话ID |
| | | * @return IPageData对象 |
| | | * @throws IllegalArgumentException 参数错误异常 |
| | | */ |
| | | IPageData builder(String userId, |
| | | String userName, |
| | | String token, |
| | | String reqData, |
| | | String componentCode, |
| | | String componentMethod, |
| | | String url, |
| | | String sessionId, |
| | | String appId) |
| | | IPageData builder(String userId, |
| | | String userName, |
| | | String token, |
| | | String reqData, |
| | | String componentCode, |
| | | String componentMethod, |
| | | String url, |
| | | String sessionId, |
| | | String appId) |
| | | throws IllegalArgumentException; |
| | | |
| | | IPageData builder(String userId, |
| | |
| | | String sessionId) |
| | | throws IllegalArgumentException; |
| | | |
| | | IPageData builder(String userId, |
| | | String userName, |
| | | String token, |
| | | String reqData, |
| | | String componentCode, |
| | | String componentMethod, |
| | | String url, |
| | | String sessionId, |
| | | String appId, |
| | | String payerObjId, |
| | | String payerObjType, |
| | | String endTime) |
| | | throws IllegalArgumentException; |
| | | |
| | | } |
| | |
| | | |
| | | private HttpMethod method; |
| | | |
| | | /** |
| | | * 付款方id |
| | | */ |
| | | private String payerObjId; |
| | | |
| | | /** |
| | | * 付款方类型 |
| | | */ |
| | | private String payerObjType; |
| | | |
| | | /** |
| | | * 缴费到期时间 |
| | | */ |
| | | private String endTime; |
| | | |
| | | private ResponseEntity responseEntity; |
| | | |
| | | public String getUserId() { |
| | |
| | | ""); |
| | | } |
| | | |
| | | @Override |
| | | public IPageData builder(String userId, |
| | | String userName, |
| | | String token, |
| | | String reqData, |
| | | String componentCode, |
| | | String componentMethod, |
| | | String url, |
| | | String sessionId, |
| | | String appId, |
| | | String payerObjId, |
| | | String payerObjType, |
| | | String endTime) throws IllegalArgumentException { |
| | | this.setComponentCode(componentCode); |
| | | this.setComponentMethod(componentMethod); |
| | | this.setReqData(reqData); |
| | | this.setRequestTime(DateUtil.getyyyyMMddhhmmssDateString()); |
| | | this.setUserId(userId); |
| | | this.setUserName(userName); |
| | | this.setToken(token); |
| | | this.setUrl(url); |
| | | this.setSessionId(sessionId); |
| | | this.setAppId(appId); |
| | | this.setPayerObjId(payerObjId); |
| | | this.setPayerObjType(payerObjType); |
| | | this.setEndTime(endTime); |
| | | return this; |
| | | } |
| | | |
| | | public IPageData builder(String userId, |
| | | String userName, |
| | | String token, |
| | |
| | | public void setMethod(HttpMethod method) { |
| | | this.method = method; |
| | | } |
| | | |
| | | public String getPayerObjId() { |
| | | return payerObjId; |
| | | } |
| | | |
| | | public void setPayerObjId(String payerObjId) { |
| | | this.payerObjId = payerObjId; |
| | | } |
| | | |
| | | public String getPayerObjType() { |
| | | return payerObjType; |
| | | } |
| | | |
| | | public void setPayerObjType(String payerObjType) { |
| | | this.payerObjType = payerObjType; |
| | | } |
| | | |
| | | public String getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(String endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | } |
| | |
| | | import com.java110.core.event.app.order.Ordered; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.EventListener; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public HttpMethod getHttpMethod(); |
| | | |
| | | public void soService(ServiceDataFlowEvent event); |
| | | public void soService(ServiceDataFlowEvent event) throws ParseException; |
| | | } |
| | |
| | | <!-- 保存属性信息 c_business_attrs --> |
| | | <insert id="saveUserDefaultPrivilege" parameterType="Map"> |
| | | <![CDATA[ |
| | | INSERT INTO p_privilege_user(p_id,privilege_flag,user_id,store_id) VALUES(#{pId},'1',#{userId},#{storeId}) |
| | | |
| | | |
| | | INSERT INTO p_privilege_user(p_id,privilege_flag,user_id,store_id) VALUES(#{pId},'1',#{userId},#{storeId}) |
| | | |
| | | |
| | | ]]> |
| | | </insert> |
| | | |
| | |
| | | <!-- 保存属性信息 c_business_attrs --> |
| | | <insert id="addUserPrivilege" parameterType="Map"> |
| | | <![CDATA[ |
| | | INSERT INTO p_privilege_user(p_id,privilege_flag,user_id,store_id) VALUES(#{pId},#{privilegeFlag},#{userId},#{storeId}) |
| | | |
| | | |
| | | INSERT INTO p_privilege_user(p_id,privilege_flag,user_id,store_id) VALUES(#{pId},#{privilegeFlag},#{userId},#{storeId}) |
| | | |
| | | |
| | | ]]> |
| | | </insert> |
| | | |
| | |
| | | INNER JOIN p_privilege p on t.p_id = p.p_id and p.status_cd = '0' |
| | | where t.privilege_flag = '0' |
| | | and t.status_cd = '0' |
| | | and p.resource = #{resource} |
| | | and t.store_id = #{storeId} |
| | | <if test="resource != null and resource != ''"> |
| | | and p.resource = #{resource} |
| | | </if> |
| | | <if test="storeId != null and storeId != ''"> |
| | | and t.store_id = #{storeId} |
| | | </if> |
| | | union ALL |
| | | select t.user_id userId |
| | | from p_privilege_user t |
| | |
| | | INNER JOIN p_privilege p on pr.p_id = p.p_id and p.status_cd = '0' |
| | | where t.status_cd = '0' |
| | | and t.privilege_flag = '1' |
| | | and p.resource = #{resource} |
| | | and t.store_id = #{storeId} |
| | | <if test="resource != null and resource != ''"> |
| | | and p.resource = #{resource} |
| | | </if> |
| | | <if test="storeId != null and storeId != ''"> |
| | | and t.store_id = #{storeId} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | statusCd,t.check_remark,t.check_remark checkRemark,t.room_id,t.room_id roomId,t.room_name,t.room_name |
| | | roomName,t.review_user_id,t.review_user_id reviewUserId,t.review_remark,t.review_remark |
| | | reviewRemark,t.start_time,t.start_time startTime,t.end_time,t.end_time |
| | | endTime,t.state,td.name stateName,t.community_id,t.community_id communityId,t.discount_id,t.discount_id discountId, |
| | | endTime,t.state,td.name stateName,t.community_id,t.community_id communityId,t.discount_id,t.discount_id |
| | | discountId, |
| | | ardt.type_name applyTypeName |
| | | from apply_room_discount t |
| | | left join t_dict td on t.state = td.status_cd and td.table_name='apply_room_discount' and td.table_columns = 'state' |
| | | left join apply_room_discount_type ardt on t.apply_type = ardt.apply_type and t.community_id = ardt.community_id and ardt.status_cd = '0' |
| | | where 1 =1 |
| | | left join t_dict td on t.state = td.status_cd and td.table_name='apply_room_discount' and td.table_columns = |
| | | 'state' |
| | | left join apply_room_discount_type ardt on t.apply_type = ardt.apply_type and t.community_id = ardt.community_id |
| | | and ardt.status_cd = '0' |
| | | where t.status_cd = '0' |
| | | <if test="applyType !=null and applyType != ''"> |
| | | and t.apply_type= #{applyType} |
| | | </if> |
| | |
| | | and t.review_remark= #{reviewRemark} |
| | | </if> |
| | | <if test="startTime !=null and startTime != ''"> |
| | | and t.start_time= #{startTime} |
| | | and t.start_time <= #{startTime} |
| | | </if> |
| | | <if test="endTime !=null and endTime != ''"> |
| | | and t.end_time= #{endTime} |
| | | and t.end_time >= #{endTime} |
| | | </if> |
| | | <if test="state !=null and state != ''"> |
| | | and t.state= #{state} |
| | |
| | | <if test="page != -1 and page != null "> |
| | | limit #{page}, #{row} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 查询房屋折扣申请信息 add by wuxw 2018-07-03 --> |
| | | <select id="getFirstApplyRoomDiscounts" parameterType="Map" resultType="Map"> |
| | | select t.apply_type,t.apply_type applyType,t.ard_id,t.ard_id ardId,t.create_user_name |
| | | createUserName,t.create_user_tel createUserTel,t.create_remark createRemark,t.check_user_id,t.check_user_id |
| | | checkUserId,t.status_cd,t.status_cd |
| | | statusCd,t.check_remark,t.check_remark checkRemark,t.room_id,t.room_id roomId,t.room_name,t.room_name |
| | | roomName,t.review_user_id,t.review_user_id reviewUserId,t.review_remark,t.review_remark |
| | | reviewRemark,t.start_time,t.start_time startTime,t.end_time,t.end_time |
| | | endTime,t.state,td.name stateName,t.community_id,t.community_id communityId,t.discount_id,t.discount_id |
| | | discountId, |
| | | ardt.type_name applyTypeName, t.create_time createTime |
| | | from apply_room_discount t |
| | | left join t_dict td on t.state = td.status_cd and td.table_name='apply_room_discount' and td.table_columns = |
| | | 'state' |
| | | left join apply_room_discount_type ardt on t.apply_type = ardt.apply_type and t.community_id = ardt.community_id |
| | | and ardt.status_cd = '0' |
| | | where t.status_cd = '0' and t.state != '3' and t.state != '5' |
| | | <if test="applyType !=null and applyType != ''"> |
| | | and t.apply_type= #{applyType} |
| | | </if> |
| | | <if test="ardId !=null and ardId != ''"> |
| | | and t.ard_id= #{ardId} |
| | | </if> |
| | | <if test="createUserName !=null and createUserName != ''"> |
| | | and t.create_user_name= #{createUserName} |
| | | </if> |
| | | <if test="createUserTel !=null and createUserTel != ''"> |
| | | and t.create_user_Tel= #{createUserTel} |
| | | </if> |
| | | <if test="checkUserId !=null and checkUserId != ''"> |
| | | and t.check_user_id= #{checkUserId} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="checkRemark !=null and checkRemark != ''"> |
| | | and t.check_remark= #{checkRemark} |
| | | </if> |
| | | <if test="roomId !=null and roomId != ''"> |
| | | and t.room_id= #{roomId} |
| | | </if> |
| | | <if test="roomName !=null and roomName != ''"> |
| | | and t.room_name= #{roomName} |
| | | </if> |
| | | <if test="reviewUserId !=null and reviewUserId != ''"> |
| | | and t.review_user_id= #{reviewUserId} |
| | | </if> |
| | | <if test="reviewRemark !=null and reviewRemark != ''"> |
| | | and t.review_remark= #{reviewRemark} |
| | | </if> |
| | | <if test="startTime !=null and startTime != ''"> |
| | | and t.start_time <= #{startTime} |
| | | </if> |
| | | <if test="endTime !=null and endTime != ''"> |
| | | and t.end_time >= #{endTime} |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | </if> |
| | | <if test="discountId !=null and discountId != ''"> |
| | | and t.discount_id= #{discountId} |
| | | </if> |
| | | order by t.create_time desc limit 0,1 |
| | | </select> |
| | | |
| | | |
| | |
| | | and t.sex= #{sex} |
| | | </if> |
| | | <if test="name !=null and name != ''"> |
| | | and t.name like concat('%',#{name},'%') |
| | | and t.name = #{name} |
| | | </if> |
| | | <if test="link !=null and link != ''"> |
| | | and t.link= #{link} |
| | |
| | | public int saveApplyRoomDiscount(@RequestBody ApplyRoomDiscountPo applyRoomDiscountPo); |
| | | |
| | | @RequestMapping(value = "/updateApplyRoomDiscount", method = RequestMethod.POST) |
| | | public int updateApplyRoomDiscount(@RequestBody ApplyRoomDiscountPo applyRoomDiscountPo); |
| | | public int updateApplyRoomDiscount(@RequestBody ApplyRoomDiscountPo applyRoomDiscountPo); |
| | | |
| | | @RequestMapping(value = "/deleteApplyRoomDiscount", method = RequestMethod.POST) |
| | | public int deleteApplyRoomDiscount(@RequestBody ApplyRoomDiscountPo applyRoomDiscountPo); |
| | | public int deleteApplyRoomDiscount(@RequestBody ApplyRoomDiscountPo applyRoomDiscountPo); |
| | | |
| | | /** |
| | | * <p>查询小区楼信息</p> |
| | | * |
| | | * |
| | | * @param applyRoomDiscountDto 数据对象分享 |
| | | * @return ApplyRoomDiscountDto 对象数据 |
| | |
| | | List<ApplyRoomDiscountDto> queryApplyRoomDiscounts(@RequestBody ApplyRoomDiscountDto applyRoomDiscountDto); |
| | | |
| | | /** |
| | | * 查询最新添加的符合条件的优惠申请信息 |
| | | * |
| | | * @param applyRoomDiscountDto |
| | | * @return |
| | | * @author fqz |
| | | */ |
| | | @RequestMapping(value = "/queryFirstApplyRoomDiscounts", method = RequestMethod.POST) |
| | | List<ApplyRoomDiscountDto> queryFirstApplyRoomDiscounts(@RequestBody ApplyRoomDiscountDto applyRoomDiscountDto); |
| | | |
| | | /** |
| | | * 查询<p>小区楼</p>总记录数 |
| | | * |
| | | * @param applyRoomDiscountDto 数据对象分享 |
| | |
| | | import org.springframework.web.client.HttpStatusCodeException; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @param event |
| | | */ |
| | | public final void soService(ServiceDataFlowEvent event) { |
| | | public final void soService(ServiceDataFlowEvent event) throws ParseException { |
| | | |
| | | DataFlowContext dataFlowContext = event.getDataFlowContext(); |
| | | //获取请求数据 |
| | |
| | | * @param context 数据上文对象 |
| | | * @param reqJson 请求报文 |
| | | */ |
| | | protected abstract void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson); |
| | | protected abstract void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) throws ParseException; |
| | | |
| | | |
| | | @Override |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void soService(ServiceDataFlowEvent event) { |
| | | public void soService(ServiceDataFlowEvent event) throws ParseException { |
| | | |
| | | logger.debug("ServiceDataFlowEvent : {}", event); |
| | | |
| | |
| | | dataFlowContext.setResponseEntity(responseEntity); |
| | | } |
| | | |
| | | private void judgeDiscount(JSONObject paramObj) { |
| | | private void judgeDiscount(JSONObject paramObj) throws ParseException { |
| | | FeeDetailDto feeDetailDto = new FeeDetailDto(); |
| | | feeDetailDto.setCommunityId(paramObj.getString("communityId")); |
| | | feeDetailDto.setFeeId(paramObj.getString("feeId")); |
| | | feeDetailDto.setCycles(paramObj.getString("cycles")); |
| | | feeDetailDto.setPayerObjId(paramObj.getString("payerObjId")); |
| | | feeDetailDto.setPayerObjType(paramObj.getString("payerObjType")); |
| | | String endTime = paramObj.getString("endTime"); //获取缴费到期时间 |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | feeDetailDto.setStartTime(simpleDateFormat.parse(endTime)); |
| | | |
| | | feeDetailDto.setRow(20); |
| | | feeDetailDto.setPage(1); |
| | | List<ComputeDiscountDto> computeDiscountDtos = feeDiscountInnerServiceSMOImpl.computeDiscount(feeDetailDto); |
| | |
| | | for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) { |
| | | discountPrice = discountPrice.add(new BigDecimal(computeDiscountDto.getDiscountPrice())); |
| | | } |
| | | |
| | | paramObj.put("discountPrice", discountPrice.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | paramObj.put("computeDiscountDtos", computeDiscountDtos); |
| | | } |
| | |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) throws ParseException { |
| | | |
| | | Map<String, String> reqHeader = context.getRequestHeaders(); |
| | | |
| | |
| | | smallWechatAttrPo.setWechatId(wechatId); |
| | | super.insert(context, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR); |
| | | |
| | | //空置房验房申请流程、审批流程通知--模板ID |
| | | smallWechatAttrPo = new SmallWechatAttrPo(); |
| | | smallWechatAttrPo.setAttrId("-3"); |
| | | smallWechatAttrPo.setCommunityId(reqJson.getString("objId")); |
| | | smallWechatAttrPo.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_PROCESS_TEMPLATE); |
| | | smallWechatAttrPo.setValue("这里请填写流程通知模板ID"); |
| | | smallWechatAttrPo.setWechatId(wechatId); |
| | | super.insert(context, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR); |
| | | |
| | | //空置房验房状态(通过和不通过)、审批状态(通过和不通过) 通知--模板ID |
| | | smallWechatAttrPo = new SmallWechatAttrPo(); |
| | | smallWechatAttrPo.setAttrId("-3"); |
| | | smallWechatAttrPo.setCommunityId(reqJson.getString("objId")); |
| | | smallWechatAttrPo.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_ROOM_STATE_TEMPLATE); |
| | | smallWechatAttrPo.setValue("这里请填写空置房状态通知模板ID"); |
| | | smallWechatAttrPo.setWechatId(wechatId); |
| | | super.insert(context, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR); |
| | | |
| | | //报修工单提醒 通知--模板ID |
| | | smallWechatAttrPo = new SmallWechatAttrPo(); |
| | | smallWechatAttrPo.setAttrId("-3"); |
| | | smallWechatAttrPo.setCommunityId(reqJson.getString("objId")); |
| | | smallWechatAttrPo.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_WORK_ORDER_REMIND_TEMPLATE); |
| | | smallWechatAttrPo.setValue("这里请填写报修工单通知模板ID"); |
| | | smallWechatAttrPo.setWechatId(wechatId); |
| | | super.insert(context, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR); |
| | | |
| | | //报修工单派单和转单提醒给维修师傅 通知--模板ID |
| | | smallWechatAttrPo = new SmallWechatAttrPo(); |
| | | smallWechatAttrPo.setAttrId("-3"); |
| | | smallWechatAttrPo.setCommunityId(reqJson.getString("objId")); |
| | | smallWechatAttrPo.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_DISPATCH_REMIND_TEMPLATE); |
| | | smallWechatAttrPo.setValue("这里请填写报修工单派单和转单通知模板ID"); |
| | | smallWechatAttrPo.setWechatId(wechatId); |
| | | super.insert(context, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR); |
| | | |
| | | //报修工单派单和抢单提醒给业主,安排师傅维修(进度提醒) 通知--模板ID |
| | | smallWechatAttrPo = new SmallWechatAttrPo(); |
| | | smallWechatAttrPo.setAttrId("-3"); |
| | | smallWechatAttrPo.setCommunityId(reqJson.getString("objId")); |
| | | smallWechatAttrPo.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_SCHEDULE_TEMPLATE); |
| | | smallWechatAttrPo.setValue("这里请填写报修工单派单和抢单提醒给业主,安排师傅维修(进度提醒)通知模板ID"); |
| | | smallWechatAttrPo.setWechatId(wechatId); |
| | | super.insert(context, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR); |
| | | |
| | | //报修工单维修完成提醒给业主 通知--模板ID |
| | | smallWechatAttrPo = new SmallWechatAttrPo(); |
| | | smallWechatAttrPo.setAttrId("-3"); |
| | | smallWechatAttrPo.setCommunityId(reqJson.getString("objId")); |
| | | smallWechatAttrPo.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_WORK_ORDER_END_TEMPLATE); |
| | | smallWechatAttrPo.setValue("这里请填写报修工单维修完成提醒给业主通知模板ID"); |
| | | smallWechatAttrPo.setWechatId(wechatId); |
| | | super.insert(context, smallWechatAttrPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_SMALL_WECHAT_ATTR); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | import com.java110.fee.bmo.applyRoomDiscountType.IGetApplyRoomDiscountTypeBMO; |
| | | import com.java110.fee.bmo.applyRoomDiscountType.ISaveApplyRoomDiscountTypeBMO; |
| | | import com.java110.fee.bmo.applyRoomDiscountType.IUpdateApplyRoomDiscountTypeBMO; |
| | | import com.java110.intf.fee.IApplyRoomDiscountInnerServiceSMO; |
| | | import com.java110.po.applyRoomDiscount.ApplyRoomDiscountPo; |
| | | import com.java110.po.applyRoomDiscountType.ApplyRoomDiscountTypePo; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping(value = "/applyRoomDiscount") |
| | |
| | | |
| | | @Autowired |
| | | private ISaveApplyRoomDiscountBMO saveApplyRoomDiscountBMOImpl; |
| | | |
| | | @Autowired |
| | | private IUpdateApplyRoomDiscountBMO updateApplyRoomDiscountBMOImpl; |
| | | |
| | | @Autowired |
| | | private IDeleteApplyRoomDiscountBMO deleteApplyRoomDiscountBMOImpl; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ISaveApplyRoomDiscountTypeBMO saveApplyRoomDiscountTypeBMOImpl; |
| | | |
| | | @Autowired |
| | | private IUpdateApplyRoomDiscountTypeBMO updateApplyRoomDiscountTypeBMOImpl; |
| | | |
| | | @Autowired |
| | | private IDeleteApplyRoomDiscountTypeBMO deleteApplyRoomDiscountTypeBMOImpl; |
| | | |
| | | @Autowired |
| | | private IGetApplyRoomDiscountTypeBMO getApplyRoomDiscountTypeBMOImpl; |
| | | |
| | | @Autowired |
| | | private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 优惠申请 |
| | |
| | | * @path /app/applyRoomDiscount/saveApplyRoomDiscount |
| | | */ |
| | | @RequestMapping(value = "/saveApplyRoomDiscount", method = RequestMethod.POST) |
| | | public ResponseEntity<String> saveApplyRoomDiscount(@RequestBody JSONObject reqJson) { |
| | | |
| | | public ResponseEntity<String> saveApplyRoomDiscount(@RequestBody JSONObject reqJson) throws ParseException { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | Assert.hasKeyAndValue(reqJson, "roomId", "请求报文中未包含roomId"); |
| | | Assert.hasKeyAndValue(reqJson, "roomName", "请求报文中未包含roomName"); |
| | | Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含startTime"); |
| | | Assert.hasKeyAndValue(reqJson, "endTime", "请求报文中未包含endTime"); |
| | | Assert.hasKeyAndValue(reqJson, "applyType", "请求报文中未包含applyType"); |
| | | |
| | | |
| | | ApplyRoomDiscountPo applyRoomDiscountPo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountPo.class); |
| | | return saveApplyRoomDiscountBMOImpl.save(applyRoomDiscountPo); |
| | | ApplyRoomDiscountDto applyRoomDiscountDto = new ApplyRoomDiscountDto(); |
| | | applyRoomDiscountDto.setCommunityId(applyRoomDiscountPo.getCommunityId()); |
| | | applyRoomDiscountDto.setRoomId(applyRoomDiscountPo.getRoomId()); |
| | | //查询折扣申请表中该房屋下符合条件的最新的一条数据 |
| | | List<ApplyRoomDiscountDto> applyRoomDiscountDtos = applyRoomDiscountInnerServiceSMOImpl.queryFirstApplyRoomDiscounts(applyRoomDiscountDto); |
| | | //获取本次填写的开始时间 |
| | | Date startDate = simpleDateFormat.parse(applyRoomDiscountPo.getStartTime()); |
| | | if (applyRoomDiscountDtos.size() == 0) { |
| | | return saveApplyRoomDiscountBMOImpl.save(applyRoomDiscountPo); |
| | | } else if (applyRoomDiscountDtos.size() > 0) { |
| | | //取出结束时间 |
| | | String endTime = applyRoomDiscountDtos.get(0).getEndTime(); |
| | | Date finishTime = simpleDateFormat.parse(endTime); |
| | | if (startDate.getTime() - finishTime.getTime() >= 0) { |
| | | return saveApplyRoomDiscountBMOImpl.save(applyRoomDiscountPo); |
| | | } else { |
| | | throw new UnsupportedOperationException("该时间段已经申请过空置房,请重新输入空置房申请开始和结束时间"); |
| | | } |
| | | } else { |
| | | throw new UnsupportedOperationException("信息错误"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @path /app/applyRoomDiscount/updateApplyRoomDiscount |
| | | */ |
| | | @RequestMapping(value = "/updateApplyRoomDiscount", method = RequestMethod.POST) |
| | | public ResponseEntity<String> updateApplyRoomDiscount(@RequestBody JSONObject reqJson) { |
| | | |
| | | public ResponseEntity<String> updateApplyRoomDiscount(@RequestBody JSONObject reqJson,@RequestHeader(value = "user-id") String userId) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含验房状态"); |
| | | Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含开始时间"); |
| | | Assert.hasKeyAndValue(reqJson, "endTime", "请求报文中未包含结束时间"); |
| | | Assert.hasKeyAndValue(reqJson, "checkRemark", "请求报文中未包含验房说明"); |
| | | Assert.hasKeyAndValue(reqJson, "discountId", "请求报文中未包含折扣"); |
| | | Assert.hasKeyAndValue(reqJson, "ardId", "ardId不能为空"); |
| | | reqJson.put("checkUserId", userId); |
| | | ApplyRoomDiscountPo applyRoomDiscountPo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountPo.class); |
| | | return updateApplyRoomDiscountBMOImpl.update(applyRoomDiscountPo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 审批接口 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | * @serviceCode /applyRoomDiscount/updateReviewApplyRoomDiscount |
| | | * @path /app/applyRoomDiscount/updateReviewApplyRoomDiscount |
| | | */ |
| | | @RequestMapping(value = "/updateReviewApplyRoomDiscount", method = RequestMethod.POST) |
| | | public ResponseEntity<String> updateReviewApplyRoomDiscount(@RequestBody JSONObject reqJson, @RequestHeader(value = "user-id") String userId) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含验房状态"); |
| | | Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含开始时间"); |
| | | Assert.hasKeyAndValue(reqJson, "endTime", "请求报文中未包含结束时间"); |
| | | Assert.hasKeyAndValue(reqJson, "reviewRemark", "请求报文中未包含验房说明"); |
| | | // Assert.hasKeyAndValue(reqJson, "discountId", "请求报文中未包含折扣"); |
| | | Assert.hasKeyAndValue(reqJson, "ardId", "ardId不能为空"); |
| | | reqJson.put("reviewUserId", userId); |
| | | ApplyRoomDiscountPo applyRoomDiscountPo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountPo.class); |
| | | return updateApplyRoomDiscountBMOImpl.update(applyRoomDiscountPo); |
| | | } |
| | |
| | | */ |
| | | @RequestMapping(value = "/auditApplyRoomDiscount", method = RequestMethod.POST) |
| | | public ResponseEntity<String> auditApplyRoomDiscount(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息"); |
| | | Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含验房状态"); |
| | | Assert.hasKeyAndValue(reqJson, "reviewRemark", "请求报文中未包含审核说明"); |
| | | Assert.hasKeyAndValue(reqJson, "ardId", "ardId不能为空"); |
| | | |
| | | |
| | | ApplyRoomDiscountPo applyRoomDiscountPo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountPo.class); |
| | | return auditApplyRoomDiscountBMOImpl.audit(applyRoomDiscountPo); |
| | | } |
| | |
| | | @RequestMapping(value = "/deleteApplyRoomDiscount", method = RequestMethod.POST) |
| | | public ResponseEntity<String> deleteApplyRoomDiscount(@RequestBody JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "ardId", "ardId不能为空"); |
| | | |
| | | |
| | | ApplyRoomDiscountPo applyRoomDiscountPo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountPo.class); |
| | | return deleteApplyRoomDiscountBMOImpl.delete(applyRoomDiscountPo); |
| | | } |
| | |
| | | return getApplyRoomDiscountBMOImpl.get(applyRoomDiscountDto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信保存消息模板 |
| | | * |
| | |
| | | */ |
| | | @RequestMapping(value = "/saveApplyRoomDiscountType", method = RequestMethod.POST) |
| | | public ResponseEntity<String> saveApplyRoomDiscountType(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | Assert.hasKeyAndValue(reqJson, "typeName", "请求报文中未包含typeName"); |
| | | |
| | | |
| | | ApplyRoomDiscountTypePo applyRoomDiscountTypePo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountTypePo.class); |
| | | return saveApplyRoomDiscountTypeBMOImpl.save(applyRoomDiscountTypePo); |
| | | } |
| | |
| | | */ |
| | | @RequestMapping(value = "/updateApplyRoomDiscountType", method = RequestMethod.POST) |
| | | public ResponseEntity<String> updateApplyRoomDiscountType(@RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | Assert.hasKeyAndValue(reqJson, "typeName", "请求报文中未包含typeName"); |
| | | Assert.hasKeyAndValue(reqJson, "applyType", "applyType不能为空"); |
| | | |
| | | |
| | | ApplyRoomDiscountTypePo applyRoomDiscountTypePo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountTypePo.class); |
| | | return updateApplyRoomDiscountTypeBMOImpl.update(applyRoomDiscountTypePo); |
| | | } |
| | |
| | | @RequestMapping(value = "/deleteApplyRoomDiscountType", method = RequestMethod.POST) |
| | | public ResponseEntity<String> deleteApplyRoomDiscountType(@RequestBody JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "applyType", "applyType不能为空"); |
| | | |
| | | |
| | | ApplyRoomDiscountTypePo applyRoomDiscountTypePo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountTypePo.class); |
| | | return deleteApplyRoomDiscountTypeBMOImpl.delete(applyRoomDiscountTypePo); |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping(value = "/feeDiscount") |
| | |
| | | public ResponseEntity<String> computeFeeDiscount(@RequestParam(value = "feeId") String feeId, |
| | | @RequestParam(value = "communityId") String communityId, |
| | | @RequestParam(value = "cycles") double cycles, |
| | | @RequestParam(value = "payerObjId") String payerObjId, |
| | | @RequestParam(value = "payerObjType") String payerObjType, |
| | | @RequestParam(value = "endTime") String endTime, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | return computeFeeDiscountBMOImpl.compute(feeId, communityId, cycles, page, row); |
| | | @RequestParam(value = "row") int row) throws ParseException { |
| | | return computeFeeDiscountBMOImpl.compute(feeId, communityId, cycles, payerObjId, payerObjType, endTime, page, row); |
| | | } |
| | | |
| | | |
| | |
| | | package com.java110.fee.bmo.feeDiscountRuleSpec; |
| | | |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | public interface IComputeFeeDiscountBMO { |
| | | |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> compute(String feeId, String communityId, double cycles, int page, int row); |
| | | ResponseEntity<String> compute(String feeId, String communityId, double cycles, String payerObjId, String payerObjType, String endTime, int page, int row) throws ParseException; |
| | | |
| | | } |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | | @Service("computeFeeDiscountBMOImpl") |
| | | public class ComputeFeeDiscountBMOImpl implements IComputeFeeDiscountBMO { |
| | | |
| | | |
| | | @Autowired |
| | | private FeeDiscountInnerServiceSMOImpl feeDiscountInnerServiceSMOImpl; |
| | | |
| | | |
| | | /** |
| | | * 计算折扣 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResponseEntity<String> compute(String feeId, String communityId, double cycles, int page, int row) { |
| | | |
| | | public ResponseEntity<String> compute(String feeId, String communityId, double cycles, String payerObjId, String payerObjType, String endTime, int page, int row) throws ParseException { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | FeeDetailDto feeDetailDto = new FeeDetailDto(); |
| | | feeDetailDto.setCommunityId(communityId); |
| | | feeDetailDto.setFeeId(feeId); |
| | | feeDetailDto.setCycles(cycles + ""); |
| | | feeDetailDto.setPayerObjId(payerObjId); |
| | | feeDetailDto.setPayerObjType(payerObjType); |
| | | //缴费开始时间为上月到期时间 |
| | | feeDetailDto.setStartTime(simpleDateFormat.parse(endTime)); |
| | | feeDetailDto.setRow(row); |
| | | feeDetailDto.setPage(page); |
| | | List<ComputeDiscountDto> computeDiscountDtos = feeDiscountInnerServiceSMOImpl.computeDiscount(feeDetailDto); |
| | | return ResultVo.createResponseEntity(computeDiscountDtos); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | * 房屋折扣申请组件内部之间使用,没有给外围系统提供服务能力 |
| | | * 房屋折扣申请服务接口类,要求全部以字符串传输,方便微服务化 |
| | | * 新建客户,修改客户,删除客户,查询客户等功能 |
| | | * |
| | | * <p> |
| | | * Created by wuxw on 2016/12/27. |
| | | */ |
| | | public interface IApplyRoomDiscountServiceDao { |
| | |
| | | |
| | | /** |
| | | * 保存 房屋折扣申请信息 |
| | | * |
| | | * @param info |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | void saveApplyRoomDiscountInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询房屋折扣申请信息(instance过程) |
| | | * 根据bId 查询房屋折扣申请信息 |
| | | * |
| | | * @param info bId 信息 |
| | | * @return 房屋折扣申请信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | List<Map> getApplyRoomDiscountInfo(Map info) throws DAOException; |
| | | |
| | | |
| | | /** |
| | | * 查询最新的符合条件的优惠申请信息 |
| | | * |
| | | * @param info |
| | | * @return |
| | | */ |
| | | List<Map> queryFirstApplyRoomDiscounts(Map info); |
| | | |
| | | /** |
| | | * 修改房屋折扣申请信息 |
| | | * |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | |
| | | private static Logger logger = LoggerFactory.getLogger(ApplyRoomDiscountServiceDaoImpl.class); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存房屋折扣申请信息 到 instance |
| | | * @param info bId 信息 |
| | | * |
| | | * @param info bId 信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void saveApplyRoomDiscountInfo(Map info) throws DAOException { |
| | | logger.debug("保存房屋折扣申请信息Instance 入参 info : {}",info); |
| | | logger.debug("保存房屋折扣申请信息Instance 入参 info : {}", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("applyRoomDiscountServiceDaoImpl.saveApplyRoomDiscountInfo",info); |
| | | int saveFlag = sqlSessionTemplate.insert("applyRoomDiscountServiceDaoImpl.saveApplyRoomDiscountInfo", info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存房屋折扣申请信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | if (saveFlag < 1) { |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存房屋折扣申请信息Instance数据失败:" + JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询房屋折扣申请信息(instance) |
| | | * |
| | | * @param info bId 信息 |
| | | * @return List<Map> |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public List<Map> getApplyRoomDiscountInfo(Map info) throws DAOException { |
| | | logger.debug("查询房屋折扣申请信息 入参 info : {}",info); |
| | | logger.debug("查询房屋折扣申请信息 入参 info : {}", info); |
| | | |
| | | List<Map> businessApplyRoomDiscountInfos = sqlSessionTemplate.selectList("applyRoomDiscountServiceDaoImpl.getApplyRoomDiscountInfo",info); |
| | | List<Map> businessApplyRoomDiscountInfos = sqlSessionTemplate.selectList("applyRoomDiscountServiceDaoImpl.getApplyRoomDiscountInfo", info); |
| | | |
| | | return businessApplyRoomDiscountInfos; |
| | | } |
| | | |
| | | /** |
| | | * 查询最新的符合条件的优惠申请信息 |
| | | * |
| | | * @param info |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map> queryFirstApplyRoomDiscounts(Map info) { |
| | | logger.debug("查询房屋折扣申请信息 入参 info : {}", info); |
| | | |
| | | List<Map> businessApplyRoomDiscountInfos = sqlSessionTemplate.selectList("applyRoomDiscountServiceDaoImpl.getFirstApplyRoomDiscounts", info); |
| | | |
| | | return businessApplyRoomDiscountInfos; |
| | | } |
| | |
| | | |
| | | /** |
| | | * 修改房屋折扣申请信息 |
| | | * |
| | | * @param info 修改信息 |
| | | * @throws DAOException DAO异常 |
| | | */ |
| | | @Override |
| | | public void updateApplyRoomDiscountInfo(Map info) throws DAOException { |
| | | logger.debug("修改房屋折扣申请信息Instance 入参 info : {}",info); |
| | | logger.debug("修改房屋折扣申请信息Instance 入参 info : {}", info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("applyRoomDiscountServiceDaoImpl.updateApplyRoomDiscountInfo",info); |
| | | int saveFlag = sqlSessionTemplate.update("applyRoomDiscountServiceDaoImpl.updateApplyRoomDiscountInfo", info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改房屋折扣申请信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | if (saveFlag < 1) { |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改房屋折扣申请信息Instance数据失败:" + JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * 查询房屋折扣申请数量 |
| | | * |
| | | * @param info 房屋折扣申请信息 |
| | | * @return 房屋折扣申请数量 |
| | | */ |
| | | @Override |
| | | public int queryApplyRoomDiscountsCount(Map info) { |
| | | logger.debug("查询房屋折扣申请数据 入参 info : {}",info); |
| | | logger.debug("查询房屋折扣申请数据 入参 info : {}", info); |
| | | |
| | | List<Map> businessApplyRoomDiscountInfos = sqlSessionTemplate.selectList("applyRoomDiscountServiceDaoImpl.queryApplyRoomDiscountsCount", info); |
| | | if (businessApplyRoomDiscountInfos.size() < 1) { |
| New file |
| | |
| | | package com.java110.fee.discount.impl; |
| | | |
| | | import com.java110.core.smo.IComputeFeeSMO; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.feeDiscount.ComputeDiscountDto; |
| | | import com.java110.dto.feeDiscount.FeeDiscountDto; |
| | | import com.java110.dto.feeDiscountSpec.FeeDiscountSpecDto; |
| | | import com.java110.fee.discount.IComputeDiscount; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 空置房打折规则 |
| | | * |
| | | * @author fqz |
| | | * @date 2021-01-04 17:00 |
| | | */ |
| | | @Component(value = "roomDiscountManageRule") |
| | | public class VacantHousingDiscountImpl implements IComputeDiscount { |
| | | |
| | | /** |
| | | * 89002020980012 102020007 月份 |
| | | * 89002020980013 102020007 打折率 |
| | | */ |
| | | |
| | | private static final String SPEC_MONTH = "89002020980012"; //月份 |
| | | private static final String SPEC_RATE = "89002020980013"; // 打折率 |
| | | |
| | | @Autowired |
| | | private IFeeInnerServiceSMO feeInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IComputeFeeSMO computeFeeSMOImpl; |
| | | |
| | | /** |
| | | * @param feeDiscountDto 费用优惠 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto) { |
| | | List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountDto.getFeeDiscountSpecs(); |
| | | if (feeDiscountSpecDtos.size() < 1) { |
| | | return null; |
| | | } |
| | | //月份 |
| | | double month = 0.0; |
| | | //打折率 |
| | | double rate = 0.0; |
| | | for (FeeDiscountSpecDto feeDiscountSpecDto : feeDiscountSpecDtos) { |
| | | //取得月份 |
| | | if (SPEC_MONTH.equals(feeDiscountSpecDto.getSpecId())) { |
| | | month = Double.parseDouble(feeDiscountSpecDto.getSpecValue()); |
| | | } |
| | | //取得打折率 |
| | | if (SPEC_RATE.equals(feeDiscountSpecDto.getSpecId())) { |
| | | rate = Double.parseDouble(feeDiscountSpecDto.getSpecValue()); |
| | | } |
| | | } |
| | | //缴费周期小于空置房打折规则至少应缴月份,就不享受打折优惠 |
| | | if (feeDiscountDto.getCycles() < month) { |
| | | ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto(); |
| | | computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId()); |
| | | computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_DV); |
| | | computeDiscountDto.setRuleId(feeDiscountDto.getRuleId()); |
| | | computeDiscountDto.setRuleName(feeDiscountDto.getRuleName()); |
| | | computeDiscountDto.setDiscountName(feeDiscountDto.getDiscountName()); |
| | | computeDiscountDto.setDiscountPrice(0.0); |
| | | computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos); |
| | | return computeDiscountDto; |
| | | } |
| | | //查询费用 |
| | | FeeDto feeDto = new FeeDto(); |
| | | feeDto.setCommunityId(feeDiscountDto.getCommunityId()); |
| | | feeDto.setFeeId(feeDiscountDto.getFeeId()); |
| | | List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto); |
| | | |
| | | double price = computeFeeSMOImpl.getFeePrice(feeDtos.get(0)); |
| | | |
| | | BigDecimal priceDec = new BigDecimal(price); |
| | | |
| | | BigDecimal cycleDec = new BigDecimal(month); |
| | | |
| | | double discountPrice = priceDec.multiply(cycleDec).multiply(new BigDecimal(1.0 - rate)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | |
| | | ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto(); |
| | | computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId()); |
| | | computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_DV); |
| | | computeDiscountDto.setRuleId(feeDiscountDto.getRuleId()); |
| | | computeDiscountDto.setRuleName(feeDiscountDto.getRuleName()); |
| | | computeDiscountDto.setDiscountName(feeDiscountDto.getDiscountName()); |
| | | computeDiscountDto.setDiscountPrice(discountPrice); |
| | | computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos); |
| | | return computeDiscountDto; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.fee.discount.impl; |
| | | |
| | | import com.java110.dto.feeDiscount.ComputeDiscountDto; |
| | | import com.java110.dto.feeDiscount.FeeDiscountDto; |
| | | import com.java110.dto.feeDiscountSpec.FeeDiscountSpecDto; |
| | | import com.java110.fee.discount.IComputeDiscount; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 空置房减免规则 |
| | | * |
| | | * @author fqz |
| | | * @date 2021-01-04 17:00 |
| | | */ |
| | | @Component(value = "roomReductionManageRule") |
| | | public class VacantHousingReductionImpl implements IComputeDiscount { |
| | | |
| | | /** |
| | | * 89002020980010 102020006 月份 |
| | | * 89002020980011 102020006 减免金额 |
| | | */ |
| | | |
| | | private static final String SPEC_MONTH = "89002020980010"; //月份 |
| | | private static final String SPEC_MONEY = "89002020980011"; // 减免金额 |
| | | |
| | | /** |
| | | * @param feeDiscountDto 费用优惠 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto) { |
| | | List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountDto.getFeeDiscountSpecs(); |
| | | if (feeDiscountSpecDtos.size() < 1) { |
| | | return null; |
| | | } |
| | | double month = 0.0; |
| | | double money = 0.0; |
| | | for (FeeDiscountSpecDto feeDiscountSpecDto : feeDiscountSpecDtos) { |
| | | if (SPEC_MONTH.equals(feeDiscountSpecDto.getSpecId())) { |
| | | month = Double.parseDouble(feeDiscountSpecDto.getSpecValue()); |
| | | } |
| | | if (SPEC_MONEY.equals(feeDiscountSpecDto.getSpecId())) { |
| | | money = Double.parseDouble(feeDiscountSpecDto.getSpecValue()); |
| | | } |
| | | } |
| | | //判断缴费周期是否小于空置房减免最低缴费月份 |
| | | if (feeDiscountDto.getCycles() < month) { |
| | | ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto(); |
| | | computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId()); |
| | | computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_DV); |
| | | computeDiscountDto.setRuleId(feeDiscountDto.getRuleId()); |
| | | computeDiscountDto.setRuleName(feeDiscountDto.getRuleName()); |
| | | computeDiscountDto.setDiscountName(feeDiscountDto.getDiscountName()); |
| | | computeDiscountDto.setDiscountPrice(0.0); |
| | | computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos); |
| | | return computeDiscountDto; |
| | | } |
| | | Double cycle = month / month; |
| | | BigDecimal cycleDec = new BigDecimal(cycle.intValue()); |
| | | double discountPrice = cycleDec.multiply(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto(); |
| | | computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId()); |
| | | computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_DV); |
| | | computeDiscountDto.setRuleId(feeDiscountDto.getRuleId()); |
| | | computeDiscountDto.setRuleName(feeDiscountDto.getRuleName()); |
| | | computeDiscountDto.setDiscountName(feeDiscountDto.getDiscountName()); |
| | | computeDiscountDto.setDiscountPrice(discountPrice); |
| | | computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos); |
| | | return computeDiscountDto; |
| | | } |
| | | } |
| | |
| | | return applyRoomDiscounts; |
| | | } |
| | | |
| | | @Override |
| | | public List<ApplyRoomDiscountDto> queryFirstApplyRoomDiscounts(ApplyRoomDiscountDto applyRoomDiscountDto) { |
| | | List<ApplyRoomDiscountDto> applyRoomDiscounts = BeanConvertUtil.covertBeanList(applyRoomDiscountServiceDaoImpl.queryFirstApplyRoomDiscounts(BeanConvertUtil.beanCovertMap(applyRoomDiscountDto)), ApplyRoomDiscountDto.class); |
| | | return applyRoomDiscounts; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int queryApplyRoomDiscountsCount(@RequestBody ApplyRoomDiscountDto applyRoomDiscountDto) { |
| | |
| | | |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.dto.PageDto; |
| | | import com.java110.dto.applyRoomDiscount.ApplyRoomDiscountDto; |
| | | import com.java110.dto.fee.FeeDetailDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.feeDiscount.ComputeDiscountDto; |
| | |
| | | import com.java110.dto.payFeeConfigDiscount.PayFeeConfigDiscountDto; |
| | | import com.java110.fee.dao.IFeeDiscountServiceDao; |
| | | import com.java110.fee.discount.IComputeDiscount; |
| | | import com.java110.intf.fee.IFeeDiscountInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeDiscountSpecInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.fee.IPayFeeConfigDiscountInnerServiceSMO; |
| | | import com.java110.intf.fee.*; |
| | | import com.java110.po.feeDiscount.FeeDiscountPo; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IFeeDiscountSpecInnerServiceSMO feeDiscountSpecInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl; |
| | | |
| | | //域 |
| | | public static final String DOMAIN_COMMON = "DOMAIN.COMMON"; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算折扣 |
| | | * |
| | | * @param feeDetailDto |
| | | * @return |
| | | */ |
| | | |
| | | public List<ComputeDiscountDto> computeDiscount(@RequestBody FeeDetailDto feeDetailDto) { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<ComputeDiscountDto> computeDiscountDtos = new ArrayList<>(); |
| | | FeeDto feeDto = new FeeDto(); |
| | | feeDto.setFeeId(feeDetailDto.getFeeId()); |
| | |
| | | feeDto.setState(FeeDto.STATE_DOING); |
| | | List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto); |
| | | Assert.listOnlyOne(feeDtos, "费用不存在"); |
| | | |
| | | PayFeeConfigDiscountDto payFeeConfigDiscountDto = new PayFeeConfigDiscountDto(); |
| | | payFeeConfigDiscountDto.setConfigId(feeDtos.get(0).getConfigId()); |
| | | payFeeConfigDiscountDto.setRow(feeDetailDto.getRow()); |
| | |
| | | payFeeConfigDiscountDto.setCommunityId(feeDetailDto.getCommunityId()); |
| | | Date currentTime = new Date(); |
| | | payFeeConfigDiscountDto.setCurrentTime(currentTime); |
| | | //根据费用查询折扣 |
| | | List<PayFeeConfigDiscountDto> payFeeConfigDiscountDtos = |
| | | payFeeConfigDiscountInnerServiceSMOImpl.queryPayFeeConfigDiscounts(payFeeConfigDiscountDto); |
| | | |
| | | if (payFeeConfigDiscountDtos == null || payFeeConfigDiscountDtos.size() < 1) { |
| | | return computeDiscountDtos; |
| | | } |
| | | |
| | | for (PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto : payFeeConfigDiscountDtos) { |
| | | doCompute(tmpPayFeeConfigDiscountDto, Double.parseDouble(feeDetailDto.getCycles()), computeDiscountDtos, feeDetailDto.getFeeId()); |
| | | } |
| | | |
| | | if (!StringUtil.isEmpty(feeDetailDto.getPayerObjType()) && feeDetailDto.getPayerObjType().equals("3333")) { |
| | | //根据房屋ID,去折扣申请表查询是否有折扣 |
| | | ApplyRoomDiscountDto applyRoomDiscountDto = new ApplyRoomDiscountDto(); |
| | | //审核已通过 |
| | | applyRoomDiscountDto.setState("4"); |
| | | //小区ID |
| | | applyRoomDiscountDto.setCommunityId(feeDetailDto.getCommunityId()); |
| | | //房屋id |
| | | applyRoomDiscountDto.setRoomId(feeDetailDto.getPayerObjId()); |
| | | //开始时间 |
| | | applyRoomDiscountDto.setStartTime(simpleDateFormat.format(feeDetailDto.getStartTime())); |
| | | //结束时间 |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(feeDetailDto.getStartTime()); |
| | | double month = Double.parseDouble(feeDetailDto.getCycles()); |
| | | c.add(Calendar.MONTH, (int) month); |
| | | Date endTime = c.getTime(); |
| | | applyRoomDiscountDto.setEndTime(simpleDateFormat.format(endTime)); |
| | | //查询折扣申请表 |
| | | List<ApplyRoomDiscountDto> applyRoomDiscountDtos = applyRoomDiscountInnerServiceSMOImpl.queryApplyRoomDiscounts(applyRoomDiscountDto); |
| | | //判断查询的折扣申请表是否有数据 |
| | | if (applyRoomDiscountDtos.size() > 0) { |
| | | //获取优惠id |
| | | String discountId = applyRoomDiscountDtos.get(0).getDiscountId(); |
| | | PayFeeConfigDiscountDto payFeeConfigDiscount = new PayFeeConfigDiscountDto(); |
| | | payFeeConfigDiscount.setCommunityId(applyRoomDiscountDtos.get(0).getCommunityId()); |
| | | payFeeConfigDiscount.setDiscountId(discountId); |
| | | doCompute(payFeeConfigDiscount, Double.parseDouble(feeDetailDto.getCycles()), computeDiscountDtos, feeDetailDto.getFeeId()); |
| | | } |
| | | } |
| | | //取出开关映射的值 |
| | | String value = MappingCache.getValue(DOMAIN_COMMON, DISCOUNT_MODE); |
| | | |
| | | List<ComputeDiscountDto> computeDiscountDtoList = new ArrayList<>(); |
| | | for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) { |
| | | computeDiscountDto.setValue(value); |
| | | computeDiscountDtoList.add(computeDiscountDto); |
| | | } |
| | | |
| | | return computeDiscountDtoList; |
| | | |
| | | } |
| | | |
| | | private void doCompute(PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto, double cycles, List<ComputeDiscountDto> computeDiscountDtos, String feeId) { |
| | | |
| | | FeeDiscountDto feeDiscountDto = new FeeDiscountDto(); |
| | | feeDiscountDto.setCommunityId(tmpPayFeeConfigDiscountDto.getCommunityId()); |
| | | feeDiscountDto.setDiscountId(tmpPayFeeConfigDiscountDto.getDiscountId()); |
| | |
| | | } |
| | | IComputeDiscount computeDiscount = (IComputeDiscount) ApplicationContextFactory.getBean(feeDiscountDtos.get(0).getBeanImpl()); |
| | | ComputeDiscountDto computeDiscountDto = computeDiscount.compute(feeDiscountDtos.get(0)); |
| | | |
| | | if (computeDiscountDto == null) { |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | IPageData newPd = PageData.newInstance().builder(pd.getUserId(), pd.getUserName(), pd.getToken(), postInfo, |
| | | "", "", "", pd.getSessionId(), |
| | | appId); |
| | | "", "", "", pd.getSessionId(), appId, pd.getPayerObjId(), pd.getPayerObjType(), pd.getEndTime()); |
| | | return toPaySMOImpl.toPay(newPd); |
| | | } |
| | | |
| | |
| | | public ResponseEntity<String> oweFeeNotify(@RequestBody String postInfo, HttpServletRequest request) { |
| | | logger.debug("微信支付回调报文" + postInfo); |
| | | |
| | | return oweFeeToNotifySMOImpl.toNotify(postInfo,request); |
| | | return oweFeeToNotifySMOImpl.toNotify(postInfo, request); |
| | | } |
| | | |
| | | /** |
| | | * <p>支付回调Api</p> |
| | | * |
| New file |
| | |
| | | package com.java110.job.adapt.applyRoomDiscount; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.factory.WechatFactory; |
| | | import com.java110.dto.applyRoomDiscount.ApplyRoomDiscountDto; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.owner.OwnerAppUserDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.dto.smallWechatAttr.SmallWechatAttrDto; |
| | | import com.java110.dto.staffAppAuth.StaffAppAuthDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.entity.order.Business; |
| | | import com.java110.entity.wechat.Content; |
| | | import com.java110.entity.wechat.Data; |
| | | import com.java110.entity.wechat.PropertyFeeTemplateMessage; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.fee.IApplyRoomDiscountInnerServiceSMO; |
| | | import com.java110.intf.order.IPrivilegeInnerServiceSMO; |
| | | import com.java110.intf.store.ISmallWeChatInnerServiceSMO; |
| | | import com.java110.intf.store.ISmallWechatAttrInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.intf.user.IStaffAppAuthInnerServiceSMO; |
| | | import com.java110.job.adapt.DatabusAdaptImpl; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 优惠申请通知适配器(验房通知员工和业主) |
| | | * |
| | | * @author fqz |
| | | * @date 2021-1-11 15:53 |
| | | */ |
| | | @Component(value = "machineAdoptApplyRoomDiscountAdapt") |
| | | public class MachineAdoptApplyRoomDiscountAdapt extends DatabusAdaptImpl { |
| | | |
| | | @Autowired |
| | | private ICommunityInnerServiceSMO communityInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ISmallWechatAttrInnerServiceSMO smallWechatAttrInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IPrivilegeInnerServiceSMO privilegeInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IStaffAppAuthInnerServiceSMO staffAppAuthInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private RestTemplate outRestTemplate; |
| | | |
| | | @Autowired |
| | | private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMO; |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(MachineApplyRoomDiscountAdapt.class); |
| | | |
| | | //模板信息推送地址 |
| | | private static String sendMsgUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="; |
| | | |
| | | @Override |
| | | public void execute(Business business, List<Business> businesses) { |
| | | JSONObject data = business.getData(); |
| | | //查询小区信息 |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setCommunityId(data.getString("communityId")); |
| | | List<CommunityDto> communityDtos = communityInnerServiceSMO.queryCommunitys(communityDto); |
| | | ApplyRoomDiscountDto applyRoomDiscountDto = new ApplyRoomDiscountDto(); |
| | | //申请人id |
| | | String ardId = data.getString("ardId"); |
| | | //验房备注 |
| | | String checkRemark = data.getString("checkRemark"); |
| | | //状态 |
| | | String state = data.getString("state"); |
| | | applyRoomDiscountDto.setArdId(ardId); |
| | | applyRoomDiscountDto.setState(state); |
| | | //有效数据 |
| | | applyRoomDiscountDto.setStatusCd("0"); |
| | | //查询折扣申请表 |
| | | List<ApplyRoomDiscountDto> applyRoomDiscountDtos = applyRoomDiscountInnerServiceSMOImpl.queryApplyRoomDiscounts(applyRoomDiscountDto); |
| | | //状态名称 |
| | | String stateName = applyRoomDiscountDtos.get(0).getStateName(); |
| | | //房屋id |
| | | String roomId = applyRoomDiscountDtos.get(0).getRoomId(); |
| | | //申请人 |
| | | String createUserName = applyRoomDiscountDtos.get(0).getCreateUserName(); |
| | | JSONObject paramIn = new JSONObject(); |
| | | paramIn.put("ardId", ardId); |
| | | paramIn.put("stateName", stateName); |
| | | paramIn.put("createUserName", createUserName); |
| | | paramIn.put("state", state); |
| | | paramIn.put("roomId", roomId); |
| | | paramIn.put("checkRemark", checkRemark); |
| | | //验房通过 |
| | | if (state.equals("2")) { |
| | | //给员工推送信息 |
| | | publishMsg(paramIn, communityDtos.get(0)); |
| | | //给业主推送信息 |
| | | sendMessage(paramIn, communityDtos.get(0)); |
| | | } else if (state.equals("3")) { //验房未通过 |
| | | //给业主推送信息 |
| | | sendFailedMessage(paramIn, communityDtos.get(0)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验房通过给审批员工推送信息 |
| | | * |
| | | * @param paramIn |
| | | * @param communityDto |
| | | */ |
| | | private void publishMsg(JSONObject paramIn, CommunityDto communityDto) { |
| | | //查询公众号配置 |
| | | SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); |
| | | smallWeChatDto.setWeChatType("1100"); |
| | | smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY); |
| | | smallWeChatDto.setObjId(communityDto.getCommunityId()); |
| | | List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); |
| | | if (smallWeChatDto == null || smallWeChatDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号信息,定时任务执行结束"); |
| | | return; |
| | | } |
| | | SmallWeChatDto weChatDto = smallWeChatDtos.get(0); |
| | | SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto(); |
| | | smallWechatAttrDto.setCommunityId(communityDto.getCommunityId()); |
| | | smallWechatAttrDto.setWechatId(weChatDto.getWeChatId()); |
| | | smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_PROCESS_TEMPLATE); |
| | | List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto); |
| | | if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号消息模板"); |
| | | return; |
| | | } |
| | | String templateId = smallWechatAttrDtos.get(0).getValue(); |
| | | String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret()); |
| | | if (StringUtil.isEmpty(accessToken)) { |
| | | logger.info("推送微信模板,获取accessToken失败:{}", accessToken); |
| | | return; |
| | | } |
| | | // 根据特定权限查询 有该权限的 员工 |
| | | BasePrivilegeDto basePrivilegeDto = new BasePrivilegeDto(); |
| | | basePrivilegeDto.setResource("/wechatHousingApproval"); |
| | | List<UserDto> userDtos = privilegeInnerServiceSMO.queryPrivilegeUsers(basePrivilegeDto); |
| | | String url = sendMsgUrl + accessToken; |
| | | for (UserDto userDto : userDtos) { |
| | | //根据 userId 查询到openId |
| | | StaffAppAuthDto staffAppAuthDto = new StaffAppAuthDto(); |
| | | staffAppAuthDto.setStaffId(userDto.getUserId()); |
| | | staffAppAuthDto.setAppType("WECHAT"); |
| | | List<StaffAppAuthDto> staffAppAuthDtos = staffAppAuthInnerServiceSMO.queryStaffAppAuths(staffAppAuthDto); |
| | | String openId = staffAppAuthDtos.get(0).getOpenId(); |
| | | Data data = new Data(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.setFirst(new Content("空置房审申请,审批信息如下:")); |
| | | data.setKeyword1(new Content(paramIn.getString("ardId"))); |
| | | data.setKeyword2(new Content("空置房申请-审批")); |
| | | data.setKeyword3(new Content(paramIn.getString("createUserName"))); |
| | | data.setKeyword4(new Content(paramIn.getString("createUserName") + "提交空置房申请需审批")); |
| | | data.setKeyword5(new Content(paramIn.getString("stateName"))); |
| | | data.setRemark(new Content("请及时处理!")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验房通过给业主推送信息 |
| | | * |
| | | * @param paramIn |
| | | * @param communityDto |
| | | */ |
| | | private void sendMessage(JSONObject paramIn, CommunityDto communityDto) { |
| | | //查询公众号配置 |
| | | SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); |
| | | smallWeChatDto.setWeChatType("1100"); |
| | | smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY); |
| | | smallWeChatDto.setObjId(communityDto.getCommunityId()); |
| | | List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); |
| | | if (smallWeChatDto == null || smallWeChatDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号信息,定时任务执行结束"); |
| | | return; |
| | | } |
| | | SmallWeChatDto weChatDto = smallWeChatDtos.get(0); |
| | | SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto(); |
| | | smallWechatAttrDto.setCommunityId(communityDto.getCommunityId()); |
| | | smallWechatAttrDto.setWechatId(weChatDto.getWeChatId()); |
| | | smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_ROOM_STATE_TEMPLATE); |
| | | List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto); |
| | | if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号消息模板"); |
| | | return; |
| | | } |
| | | String templateId = smallWechatAttrDtos.get(0).getValue(); |
| | | String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret()); |
| | | if (StringUtil.isEmpty(accessToken)) { |
| | | logger.info("推送微信模板,获取accessToken失败:{}", accessToken); |
| | | return; |
| | | } |
| | | //获得房屋id |
| | | String roomId = paramIn.getString("roomId"); |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(roomId); |
| | | //查询业主房屋关系表 |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMO.queryOwnerRoomRels(ownerRoomRelDto); |
| | | //取得业主id |
| | | String ownerId = ownerRoomRelDtos.get(0).getOwnerId(); |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setOwnerId(ownerId); |
| | | //1001 业主本人 1002 家庭成员 |
| | | ownerDto.setOwnerTypeCd("1001"); |
| | | //查询业主 |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMO.queryOwners(ownerDto); |
| | | //获得成员id |
| | | String memberId = ownerDtos.get(0).getMemberId(); |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setMemberId(memberId); |
| | | ownerAppUserDto.setAppType("WECHAT"); |
| | | //查询绑定业主 |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMO.queryOwnerAppUsers(ownerAppUserDto); |
| | | if (ownerAppUserDtos.size() > 0) { |
| | | //获取openId |
| | | String openId = ownerAppUserDtos.get(0).getOpenId(); |
| | | String url = sendMsgUrl + accessToken; |
| | | Data data = new Data(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.setFirst(new Content("您提交的空置房申请,验房结果如下:")); |
| | | data.setKeyword1(new Content("空置房申请-验房")); |
| | | data.setKeyword2(new Content(paramIn.getString("stateName"))); |
| | | data.setKeyword3(new Content(paramIn.getString("checkRemark"))); |
| | | data.setRemark(new Content("空置房申请验房已通过,系统已为您安排下一步审核流程,请耐心等待!")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验房未通过给业主推送信息 |
| | | * |
| | | * @param paramIn |
| | | * @param communityDto |
| | | */ |
| | | private void sendFailedMessage(JSONObject paramIn, CommunityDto communityDto) { |
| | | //查询公众号配置 |
| | | SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); |
| | | smallWeChatDto.setWeChatType("1100"); |
| | | smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY); |
| | | smallWeChatDto.setObjId(communityDto.getCommunityId()); |
| | | List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); |
| | | if (smallWeChatDto == null || smallWeChatDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号信息,定时任务执行结束"); |
| | | return; |
| | | } |
| | | SmallWeChatDto weChatDto = smallWeChatDtos.get(0); |
| | | SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto(); |
| | | smallWechatAttrDto.setCommunityId(communityDto.getCommunityId()); |
| | | smallWechatAttrDto.setWechatId(weChatDto.getWeChatId()); |
| | | smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_ROOM_STATE_TEMPLATE); |
| | | List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto); |
| | | if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号消息模板"); |
| | | return; |
| | | } |
| | | String templateId = smallWechatAttrDtos.get(0).getValue(); |
| | | String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret()); |
| | | if (StringUtil.isEmpty(accessToken)) { |
| | | logger.info("推送微信模板,获取accessToken失败:{}", accessToken); |
| | | return; |
| | | } |
| | | //获得房屋id |
| | | String roomId = paramIn.getString("roomId"); |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(roomId); |
| | | //查询业主房屋关系表 |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMO.queryOwnerRoomRels(ownerRoomRelDto); |
| | | //取得业主id |
| | | String ownerId = ownerRoomRelDtos.get(0).getOwnerId(); |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setOwnerId(ownerId); |
| | | //1001 业主本人 1002 家庭成员 |
| | | ownerDto.setOwnerTypeCd("1001"); |
| | | //查询业主 |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMO.queryOwners(ownerDto); |
| | | //获得成员id |
| | | String memberId = ownerDtos.get(0).getMemberId(); |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setMemberId(memberId); |
| | | ownerAppUserDto.setAppType("WECHAT"); |
| | | //查询绑定业主 |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMO.queryOwnerAppUsers(ownerAppUserDto); |
| | | if (ownerAppUserDtos.size() > 0) { |
| | | //获取openId |
| | | String openId = ownerAppUserDtos.get(0).getOpenId(); |
| | | String url = sendMsgUrl + accessToken; |
| | | Data data = new Data(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.setFirst(new Content("您提交的空置房申请,验房结果如下:")); |
| | | data.setKeyword1(new Content("空置房申请-验房")); |
| | | data.setKeyword2(new Content(paramIn.getString("stateName"))); |
| | | data.setKeyword3(new Content(paramIn.getString("checkRemark"))); |
| | | data.setRemark(new Content("感谢您的使用,如有疑问请联系相关物业人员。")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.job.adapt.applyRoomDiscount; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.factory.WechatFactory; |
| | | import com.java110.dto.applyRoomDiscount.ApplyRoomDiscountDto; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.dto.smallWechatAttr.SmallWechatAttrDto; |
| | | import com.java110.dto.staffAppAuth.StaffAppAuthDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.entity.order.Business; |
| | | import com.java110.entity.wechat.Content; |
| | | import com.java110.entity.wechat.Data; |
| | | import com.java110.entity.wechat.PropertyFeeTemplateMessage; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.fee.IApplyRoomDiscountInnerServiceSMO; |
| | | import com.java110.intf.order.IPrivilegeInnerServiceSMO; |
| | | import com.java110.intf.store.ISmallWeChatInnerServiceSMO; |
| | | import com.java110.intf.store.ISmallWechatAttrInnerServiceSMO; |
| | | import com.java110.intf.user.IStaffAppAuthInnerServiceSMO; |
| | | import com.java110.job.adapt.DatabusAdaptImpl; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 优惠申请通知适配器(空置房申请通知有验房权限的员工) |
| | | * |
| | | * @author fqz |
| | | * @date 2021-01-07 17:59 |
| | | */ |
| | | @Component(value = "machineApplyRoomDiscountAdapt") |
| | | public class MachineApplyRoomDiscountAdapt extends DatabusAdaptImpl { |
| | | |
| | | @Autowired |
| | | private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ICommunityInnerServiceSMO communityInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ISmallWechatAttrInnerServiceSMO smallWechatAttrInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IPrivilegeInnerServiceSMO privilegeInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IStaffAppAuthInnerServiceSMO staffAppAuthInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private RestTemplate outRestTemplate; |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(MachineApplyRoomDiscountAdapt.class); |
| | | |
| | | //模板信息推送地址 |
| | | private static String sendMsgUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="; |
| | | |
| | | @Override |
| | | public void execute(Business business, List<Business> businesses) { |
| | | JSONObject data = business.getData(); |
| | | //查询小区信息 |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setCommunityId(data.getString("communityId")); |
| | | List<CommunityDto> communityDtos = communityInnerServiceSMO.queryCommunitys(communityDto); |
| | | ApplyRoomDiscountDto applyRoomDiscountDto = new ApplyRoomDiscountDto(); |
| | | //房屋id |
| | | String roomId = data.getString("roomId"); |
| | | //申请开始时间 |
| | | String startTime = data.getString("startTime"); |
| | | //申请结束时间 |
| | | String endTime = data.getString("endTime"); |
| | | applyRoomDiscountDto.setRoomId(roomId); |
| | | applyRoomDiscountDto.setStartTime(startTime); |
| | | applyRoomDiscountDto.setEndTime(endTime); |
| | | //状态为申请验房 |
| | | applyRoomDiscountDto.setState("1"); |
| | | //有效数据 |
| | | applyRoomDiscountDto.setStatusCd("0"); |
| | | //查询折扣申请表 |
| | | List<ApplyRoomDiscountDto> applyRoomDiscountDtos = applyRoomDiscountInnerServiceSMOImpl.queryApplyRoomDiscounts(applyRoomDiscountDto); |
| | | //获取申请id |
| | | String ardId = applyRoomDiscountDtos.get(0).getArdId(); |
| | | //状态名称 |
| | | String stateName = applyRoomDiscountDtos.get(0).getStateName(); |
| | | //申请人 |
| | | String createUserName = applyRoomDiscountDtos.get(0).getCreateUserName(); |
| | | //状态 |
| | | String state = applyRoomDiscountDtos.get(0).getState(); |
| | | JSONObject paramIn = new JSONObject(); |
| | | paramIn.put("ardId", ardId); |
| | | paramIn.put("stateName", stateName); |
| | | paramIn.put("createUserName", createUserName); |
| | | paramIn.put("state", state); |
| | | publishMsg(paramIn, communityDtos.get(0)); |
| | | } |
| | | |
| | | /** |
| | | * 给验房员工推送信息 |
| | | * |
| | | * @param paramIn |
| | | */ |
| | | private void publishMsg(JSONObject paramIn, CommunityDto communityDto) { |
| | | //查询公众号配置 |
| | | SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); |
| | | smallWeChatDto.setWeChatType("1100"); |
| | | smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY); |
| | | smallWeChatDto.setObjId(communityDto.getCommunityId()); |
| | | List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); |
| | | if (smallWeChatDto == null || smallWeChatDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号信息,定时任务执行结束"); |
| | | return; |
| | | } |
| | | SmallWeChatDto weChatDto = smallWeChatDtos.get(0); |
| | | SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto(); |
| | | smallWechatAttrDto.setCommunityId(communityDto.getCommunityId()); |
| | | smallWechatAttrDto.setWechatId(weChatDto.getWeChatId()); |
| | | smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_PROCESS_TEMPLATE); |
| | | List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto); |
| | | if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号消息模板"); |
| | | return; |
| | | } |
| | | String templateId = smallWechatAttrDtos.get(0).getValue(); |
| | | String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret()); |
| | | if (StringUtil.isEmpty(accessToken)) { |
| | | logger.info("推送微信模板,获取accessToken失败:{}", accessToken); |
| | | return; |
| | | } |
| | | // 根据特定权限查询 有该权限的 员工 |
| | | BasePrivilegeDto basePrivilegeDto = new BasePrivilegeDto(); |
| | | basePrivilegeDto.setResource("/wechatHouseInspection"); |
| | | List<UserDto> userDtos = privilegeInnerServiceSMO.queryPrivilegeUsers(basePrivilegeDto); |
| | | String url = sendMsgUrl + accessToken; |
| | | for (UserDto userDto : userDtos) { |
| | | //根据 userId 查询到openId |
| | | StaffAppAuthDto staffAppAuthDto = new StaffAppAuthDto(); |
| | | staffAppAuthDto.setStaffId(userDto.getUserId()); |
| | | staffAppAuthDto.setAppType("WECHAT"); |
| | | List<StaffAppAuthDto> staffAppAuthDtos = staffAppAuthInnerServiceSMO.queryStaffAppAuths(staffAppAuthDto); |
| | | String openId = staffAppAuthDtos.get(0).getOpenId(); |
| | | Data data = new Data(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.setFirst(new Content("空置房申请,验房信息如下:")); |
| | | data.setKeyword1(new Content(paramIn.getString("ardId"))); |
| | | data.setKeyword2(new Content("空置房申请-验房")); |
| | | data.setKeyword3(new Content(paramIn.getString("createUserName"))); |
| | | data.setKeyword4(new Content(paramIn.getString("createUserName") + "提交空置房申请,需进行现场验房")); |
| | | data.setKeyword5(new Content(paramIn.getString("stateName"))); |
| | | data.setRemark(new Content("请及时处理!")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.job.adapt.applyRoomDiscount; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.factory.WechatFactory; |
| | | import com.java110.dto.applyRoomDiscount.ApplyRoomDiscountDto; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.owner.OwnerAppUserDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.dto.smallWechatAttr.SmallWechatAttrDto; |
| | | import com.java110.entity.order.Business; |
| | | import com.java110.entity.wechat.Content; |
| | | import com.java110.entity.wechat.Data; |
| | | import com.java110.entity.wechat.PropertyFeeTemplateMessage; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.fee.IApplyRoomDiscountInnerServiceSMO; |
| | | import com.java110.intf.store.ISmallWeChatInnerServiceSMO; |
| | | import com.java110.intf.store.ISmallWechatAttrInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.job.adapt.DatabusAdaptImpl; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 优惠申请通知适配器(审批通知业主) |
| | | * |
| | | * @author fqz |
| | | * @date 2021-1-11 15:53 |
| | | */ |
| | | @Component(value = "machineApprovalApplyRoomDiscountAdapt") |
| | | public class MachineApprovalApplyRoomDiscountAdapt extends DatabusAdaptImpl { |
| | | |
| | | @Autowired |
| | | private ICommunityInnerServiceSMO communityInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ISmallWechatAttrInnerServiceSMO smallWechatAttrInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private RestTemplate outRestTemplate; |
| | | |
| | | @Autowired |
| | | private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMO; |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(MachineApplyRoomDiscountAdapt.class); |
| | | |
| | | //模板信息推送地址 |
| | | private static String sendMsgUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="; |
| | | |
| | | @Override |
| | | public void execute(Business business, List<Business> businesses) { |
| | | JSONObject data = business.getData(); |
| | | //查询小区信息 |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setCommunityId(data.getString("communityId")); |
| | | List<CommunityDto> communityDtos = communityInnerServiceSMO.queryCommunitys(communityDto); |
| | | ApplyRoomDiscountDto applyRoomDiscountDto = new ApplyRoomDiscountDto(); |
| | | //申请人id |
| | | String ardId = data.getString("ardId"); |
| | | //审批备注 |
| | | String reviewRemark = data.getString("reviewRemark"); |
| | | //状态 |
| | | String state = data.getString("state"); |
| | | applyRoomDiscountDto.setArdId(ardId); |
| | | applyRoomDiscountDto.setState(state); |
| | | //有效数据 |
| | | applyRoomDiscountDto.setStatusCd("0"); |
| | | //查询折扣申请表 |
| | | List<ApplyRoomDiscountDto> applyRoomDiscountDtos = applyRoomDiscountInnerServiceSMOImpl.queryApplyRoomDiscounts(applyRoomDiscountDto); |
| | | //状态名称 |
| | | String stateName = applyRoomDiscountDtos.get(0).getStateName(); |
| | | //房屋id |
| | | String roomId = applyRoomDiscountDtos.get(0).getRoomId(); |
| | | //申请人 |
| | | String createUserName = applyRoomDiscountDtos.get(0).getCreateUserName(); |
| | | JSONObject paramIn = new JSONObject(); |
| | | paramIn.put("ardId", ardId); |
| | | paramIn.put("stateName", stateName); |
| | | paramIn.put("createUserName", createUserName); |
| | | paramIn.put("state", state); |
| | | paramIn.put("roomId", roomId); |
| | | paramIn.put("reviewRemark", reviewRemark); |
| | | //审批通过 |
| | | if (state.equals("4")) { |
| | | //给业主推送信息 |
| | | sendMessage(paramIn, communityDtos.get(0)); |
| | | } else if (state.equals("5")) { //审批未通过 |
| | | //给业主推送信息 |
| | | sendFailedMessage(paramIn, communityDtos.get(0)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 审批通过给业主推送信息 |
| | | * |
| | | * @param paramIn |
| | | * @param communityDto |
| | | */ |
| | | private void sendMessage(JSONObject paramIn, CommunityDto communityDto) { |
| | | //查询公众号配置 |
| | | SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); |
| | | smallWeChatDto.setWeChatType("1100"); |
| | | smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY); |
| | | smallWeChatDto.setObjId(communityDto.getCommunityId()); |
| | | List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); |
| | | if (smallWeChatDto == null || smallWeChatDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号信息,定时任务执行结束"); |
| | | return; |
| | | } |
| | | SmallWeChatDto weChatDto = smallWeChatDtos.get(0); |
| | | SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto(); |
| | | smallWechatAttrDto.setCommunityId(communityDto.getCommunityId()); |
| | | smallWechatAttrDto.setWechatId(weChatDto.getWeChatId()); |
| | | smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_ROOM_STATE_TEMPLATE); |
| | | List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto); |
| | | if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号消息模板"); |
| | | return; |
| | | } |
| | | String templateId = smallWechatAttrDtos.get(0).getValue(); |
| | | String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret()); |
| | | if (StringUtil.isEmpty(accessToken)) { |
| | | logger.info("推送微信模板,获取accessToken失败:{}", accessToken); |
| | | return; |
| | | } |
| | | //获得房屋id |
| | | String roomId = paramIn.getString("roomId"); |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(roomId); |
| | | //查询业主房屋关系表 |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMO.queryOwnerRoomRels(ownerRoomRelDto); |
| | | //取得业主id |
| | | String ownerId = ownerRoomRelDtos.get(0).getOwnerId(); |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setOwnerId(ownerId); |
| | | //1001 业主本人 1002 家庭成员 |
| | | ownerDto.setOwnerTypeCd("1001"); |
| | | //查询业主 |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMO.queryOwners(ownerDto); |
| | | //获得成员id |
| | | String memberId = ownerDtos.get(0).getMemberId(); |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setMemberId(memberId); |
| | | ownerAppUserDto.setAppType("WECHAT"); |
| | | //查询绑定业主 |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMO.queryOwnerAppUsers(ownerAppUserDto); |
| | | if (ownerAppUserDtos.size() > 0) { |
| | | //获取openId |
| | | String openId = ownerAppUserDtos.get(0).getOpenId(); |
| | | String url = sendMsgUrl + accessToken; |
| | | Data data = new Data(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.setFirst(new Content("您提交的空置房申请,审批结果如下:")); |
| | | data.setKeyword1(new Content("空置房申请-审批")); |
| | | data.setKeyword2(new Content(paramIn.getString("stateName"))); |
| | | data.setKeyword3(new Content(paramIn.getString("reviewRemark"))); |
| | | data.setRemark(new Content("感谢您的使用!")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 审批未通过给业主推送信息 |
| | | * |
| | | * @param paramIn |
| | | * @param communityDto |
| | | */ |
| | | private void sendFailedMessage(JSONObject paramIn, CommunityDto communityDto) { |
| | | //查询公众号配置 |
| | | SmallWeChatDto smallWeChatDto = new SmallWeChatDto(); |
| | | smallWeChatDto.setWeChatType("1100"); |
| | | smallWeChatDto.setObjType(SmallWeChatDto.OBJ_TYPE_COMMUNITY); |
| | | smallWeChatDto.setObjId(communityDto.getCommunityId()); |
| | | List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto); |
| | | if (smallWeChatDto == null || smallWeChatDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号信息,定时任务执行结束"); |
| | | return; |
| | | } |
| | | SmallWeChatDto weChatDto = smallWeChatDtos.get(0); |
| | | SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto(); |
| | | smallWechatAttrDto.setCommunityId(communityDto.getCommunityId()); |
| | | smallWechatAttrDto.setWechatId(weChatDto.getWeChatId()); |
| | | smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_ROOM_STATE_TEMPLATE); |
| | | List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto); |
| | | if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号消息模板"); |
| | | return; |
| | | } |
| | | String templateId = smallWechatAttrDtos.get(0).getValue(); |
| | | String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret()); |
| | | if (StringUtil.isEmpty(accessToken)) { |
| | | logger.info("推送微信模板,获取accessToken失败:{}", accessToken); |
| | | return; |
| | | } |
| | | //获得房屋id |
| | | String roomId = paramIn.getString("roomId"); |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(roomId); |
| | | //查询业主房屋关系表 |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMO.queryOwnerRoomRels(ownerRoomRelDto); |
| | | //取得业主id |
| | | String ownerId = ownerRoomRelDtos.get(0).getOwnerId(); |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setOwnerId(ownerId); |
| | | //1001 业主本人 1002 家庭成员 |
| | | ownerDto.setOwnerTypeCd("1001"); |
| | | //查询业主 |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMO.queryOwners(ownerDto); |
| | | //获得成员id |
| | | String memberId = ownerDtos.get(0).getMemberId(); |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setMemberId(memberId); |
| | | ownerAppUserDto.setAppType("WECHAT"); |
| | | //查询绑定业主 |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMO.queryOwnerAppUsers(ownerAppUserDto); |
| | | if (ownerAppUserDtos.size() > 0) { |
| | | //获取openId |
| | | String openId = ownerAppUserDtos.get(0).getOpenId(); |
| | | String url = sendMsgUrl + accessToken; |
| | | Data data = new Data(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.setFirst(new Content("您提交的空置房申请,审批结果如下:")); |
| | | data.setKeyword1(new Content("空置房申请-审批")); |
| | | data.setKeyword2(new Content(paramIn.getString("stateName"))); |
| | | data.setKeyword3(new Content(paramIn.getString("reviewRemark"))); |
| | | data.setRemark(new Content("感谢您的使用,如有疑问请联系相关物业人员。")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } |
| | | } |
| | | } |
| | |
| | | //滞纳金 |
| | | if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("3")) { |
| | | //获取滞纳金金额 |
| | | Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice()); |
| | | Double discountPrice = (Double.valueOf(reportFeeMonthStatistics.getDiscountPrice()))*(-1); |
| | | totalLateFee = totalLateFee + discountPrice; |
| | | //滞纳金 |
| | | reportFeeMonthStatistics.setLateFee(reportFeeMonthStatistics.getDiscountPrice()); |