| @@ -5,17 +5,21 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.app.WxAppinfoController; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.WxCouponChannelDto; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.vo.WxCouponChannelAddVo; | |||
| import com.iformall.domain.vo.WxCouponChannelVo; | |||
| import com.iformall.mapper.WxCouponChannelMapper; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxCouponService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -23,6 +27,7 @@ import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -35,8 +40,9 @@ public class WxCouponChannelController extends BaseController { | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| private WxAppinfoController wxAppinfoController; | |||
| @Autowired | |||
| private WxCouponChannelMapper wxCouponChannelMapper; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -64,7 +70,19 @@ public class WxCouponChannelController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::update"); | |||
| wxCouponChannel.setTenantId(getTenantId()); | |||
| return wxCouponChannelService.saveOrUpdate(wxCouponChannel); | |||
| ResultData resultData = wxCouponChannelService.saveOrUpdate(wxCouponChannel); | |||
| WxCouponChannel couponChannel = (WxCouponChannel)resultData.data; | |||
| //生成二维码 | |||
| if(couponChannel!=null){ | |||
| String pageUrl = "pages/index/index"; | |||
| String param = couponChannel.getWeappScene(); | |||
| ResultData resultDataQ = wxAppinfoController.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); | |||
| Map<String,String> map = (Map)resultDataQ.data; | |||
| String url = map.get("url"); | |||
| couponChannel.setQrCode(url); | |||
| wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); | |||
| } | |||
| return resultData; | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @@ -93,7 +111,30 @@ public class WxCouponChannelController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::addbatch"); | |||
| String[] ids = wxCouponChannelDto.getCouponIds().split(","); | |||
| String[] channelId = wxCouponChannelDto.getChannelId().split(","); | |||
| return wxCouponChannelService.addBatch(ids, channelId, getTenantId(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime()); | |||
| ResultData resultData = wxCouponChannelService.addBatch(ids, channelId, getTenantId(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime()); | |||
| List<WxCouponChannelAddVo> list = (List<WxCouponChannelAddVo>)resultData.data; | |||
| //生成二维码 | |||
| if(CollectionUtils.isNotEmpty(list)){ | |||
| String pageUrl = "pages/index/index"; | |||
| for (WxCouponChannelAddVo vo:list) { | |||
| WxCouponChannel couponChannel = new WxCouponChannel(); | |||
| couponChannel.setId(vo.getId()); | |||
| couponChannel.setType(vo.getType()); | |||
| String param = couponChannel.getWeappScene(); | |||
| ResultData resultDataQ = wxAppinfoController.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); | |||
| Map<String,String> map = (Map)resultDataQ.data; | |||
| String url = map.get("url"); | |||
| couponChannel.setQrCode(url); | |||
| wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); | |||
| } | |||
| resultData.data = null; | |||
| } | |||
| return resultData; | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @@ -37,6 +37,10 @@ public class MarkingCouponDataReportDto extends BaseEntity { | |||
| @Transient | |||
| private Integer uv; | |||
| @Transient | |||
| @SortColumn(column = "xTime") | |||
| private String xtime; | |||
| @Override | |||
| public String getSortColumns() { | |||
| super.setSortColumns(this.sortColumns); | |||
| @@ -7,7 +7,6 @@ import lombok.ToString; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.text.DecimalFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -168,4 +167,22 @@ public class WxCouponOrder extends BaseEntity{ | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| public Long getcUserId() { | |||
| return cUserId; | |||
| } | |||
| public void setcUserId(Long cUserId) { | |||
| this.cUserId = cUserId; | |||
| } | |||
| public Long getCUserId() { | |||
| return cUserId; | |||
| } | |||
| public void setCUserId(Long cUserId) { | |||
| this.cUserId = cUserId; | |||
| } | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import lombok.Data; | |||
| import java.beans.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| @@ -19,6 +20,10 @@ public class WxCouponChannelAddVo implements Serializable { | |||
| private Date validEndDate; | |||
| private String errorMsg; | |||
| private boolean suc = false; | |||
| private Long id; | |||
| private Integer type; | |||
| public WxCouponChannelAddVo toCouponChannnelVo(WxCoupon wxCoupon, Integer channelId){ | |||
| if ( wxCoupon != null ) { | |||
| this.couponId = wxCoupon.getId(); | |||
| @@ -29,4 +34,5 @@ public class WxCouponChannelAddVo implements Serializable { | |||
| this.channelId = channelId; | |||
| return this; | |||
| } | |||
| } | |||
| @@ -33,6 +33,9 @@ public class WxOrderQueryVo extends BaseEntity { | |||
| @Transient | |||
| private Integer orderStatus; | |||
| @Transient | |||
| private Date createDate; | |||
| @Override | |||
| public String getSortColumns() { | |||
| super.setSortColumns(this.sortColumns); | |||
| @@ -43,6 +43,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| WxScreenAdService wxScreenAdService; | |||
| @Autowired | |||
| WxOrderService wxOrderService; | |||
| /** | |||
| * B端业务端 | |||
| * @param record | |||
| @@ -67,6 +68,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxCouponChannelMapper.insertSelective(record); | |||
| return new ResultData(record); | |||
| } else { | |||
| if (record.getCouponId() != null && record.getStatus() != null) { | |||
| WxCouponChannel orignal = getById(record.getId()); | |||
| @@ -115,20 +117,24 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| public ResultData addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime, Date endTime) { | |||
| List<WxCouponChannelAddVo> errorList = new ArrayList<>(); | |||
| List<WxCouponChannelAddVo> sucList = new ArrayList<>(); | |||
| for (String targetIdstr:channelId) { | |||
| Integer targetId = Integer.parseInt(targetIdstr); | |||
| for (String couponidstr:ids) { | |||
| Long couponid = Long.parseLong(couponidstr); | |||
| WxCouponChannelAddVo vo = addCouponChannel(couponid,targetId,tanantId,beginTime,endTime); | |||
| if(vo != null){ | |||
| if(!vo.isSuc()){ | |||
| errorList.add(vo); | |||
| }else{ | |||
| sucList.add(vo); | |||
| } | |||
| } | |||
| } | |||
| if(errorList.size()>0) { | |||
| return new ResultData(errorList); | |||
| }else { | |||
| return new ResultData(); | |||
| return new ResultData(sucList); | |||
| } | |||
| } | |||
| @@ -224,8 +230,12 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| wxCouponChannel.setBusiness(wxCoupon.getBusiness()); | |||
| wxCouponChannel.setSubBusiness(wxCoupon.getSubBusiness()); | |||
| wxCouponChannel.setTitle(wxCoupon.getTitle()); | |||
| saveOrUpdate(wxCouponChannel); | |||
| return null; | |||
| ResultData resultData = saveOrUpdate(wxCouponChannel); | |||
| WxCouponChannel channel = (WxCouponChannel)resultData.data; | |||
| vo.setId(channel.getId()); | |||
| vo.setType(channel.getType()); | |||
| vo.setSuc(true); | |||
| return vo; | |||
| } | |||
| /** | |||
| @@ -470,22 +470,28 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| } | |||
| msgReplaceMap.put("taskList", taskListHtml); | |||
| MailMsg mailMsg = new MailMsg(); | |||
| mailMsg.setSubject("待办通知"); | |||
| mailMsg.setHtml(true); | |||
| mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); | |||
| mailMsg.setModelType(EnumMailMsgModel.MAIL_ASSIGNEE_NODIFY.getCode()); | |||
| mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); | |||
| mailMsg.setTo(new String[]{email}); | |||
| mailMsg.setTenantId(tenantId); | |||
| if(1 == flowType.intValue() || 3 == flowType.intValue()){ | |||
| msgReplaceMap.put("bustype","合同"); | |||
| }else if(2 == flowType.intValue()){ | |||
| msgReplaceMap.put("bustype","账单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| if(StringUtils.isBlank(email)){ | |||
| logger.info("phone:{},userName:{}邮件地址为空,不发送代办邮件",phone,userName); | |||
| }else{ | |||
| MailMsg mailMsg = new MailMsg(); | |||
| mailMsg.setSubject("待办通知"); | |||
| mailMsg.setHtml(true); | |||
| mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); | |||
| mailMsg.setModelType(EnumMailMsgModel.MAIL_ASSIGNEE_NODIFY.getCode()); | |||
| mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); | |||
| mailMsg.setTo(new String[]{email}); | |||
| mailMsg.setTenantId(tenantId); | |||
| if(1 == flowType.intValue() || 3 == flowType.intValue()){ | |||
| msgReplaceMap.put("bustype","合同"); | |||
| }else if(2 == flowType.intValue()){ | |||
| msgReplaceMap.put("bustype","账单"); | |||
| msgReplaceMap.put("contract", businessId.toString()); | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| public String variablesToJson(List<Map<String,Object>> variables){ | |||
| @@ -765,6 +771,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| }else{ | |||
| logger.info("邮件地址为空,不发送审批通知邮件"); | |||
| } | |||
| return false; | |||
| }else{ | |||
| @@ -811,6 +819,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| }else{ | |||
| logger.info("邮件地址为空,不发送通过邮件"); | |||
| } | |||
| return true; | |||
| } | |||
| @@ -931,6 +941,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| mailMsg.setDynamicContentMap(msgReplaceMap); | |||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| }else{ | |||
| logger.info("邮件地址为空,不发送驳回邮件"); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -95,10 +95,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||
| //init dateDiff | |||
| if(wxPropertyContract.getRentalStartDate() != null && wxPropertyContract.getRentalEndDate() != null){ | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(wxPropertyContract.getRentalEndDate()); | |||
| instance.add(Calendar.DATE, 1); | |||
| int[] array = DateUtils.getDiff(wxPropertyContract.getRentalStartDate(),instance.getTime()); | |||
| int[] array = DateUtils.getDiff(wxPropertyContract.getRentalStartDate(),wxPropertyContract.getRentalEndDate()); | |||
| result.put("totalPeriodMonth",array[0]); | |||
| result.put("totalPeriodDay",array[1]); | |||
| } | |||
| @@ -118,10 +118,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| //init dateDiff | |||
| if(wxRentContract.getRentalStartDate() != null && wxRentContract.getRentalEndDate() != null){ | |||
| Calendar instance = Calendar.getInstance(); | |||
| instance.setTime(wxRentContract.getRentalEndDate()); | |||
| instance.add(Calendar.DATE, 1); | |||
| int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),instance.getTime()); | |||
| int[] array = DateUtils.getDiff(wxRentContract.getRentalStartDate(),wxRentContract.getRentalEndDate()); | |||
| result.put("totalPeriodMonth",array[0]); | |||
| result.put("totalPeriodDay",array[1]); | |||
| } | |||
| @@ -381,8 +378,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| if(CollectionUtils.isEmpty(record.getPreviewBillRentList())) { | |||
| if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null | |||
| && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0l)) { | |||
| if (record.getReceivePeriod() != null && record.getLease() != null | |||
| && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0)) { | |||
| //删除预账单,重新生成 | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); | |||
| @@ -659,6 +656,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| Long id = record.getId(); | |||
| //审核流程中止 | |||
| try { | |||
| // 修改合同审核状态 | |||
| WxRentContract rentContract = record; | |||
| rentContract.setId(id); | |||
| rentContract.setApplyStatus(EnumRentContractAppStatus.CANCLE.getCode()); | |||
| updateApplyStatus(rentContract); | |||
| logger.info("合同id:{},开始停止...", id); | |||
| //结束审批流 by luozukai | |||
| List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(WxFlowServiceImpl.getFlowKeyByType(1)) | |||
| @@ -668,12 +671,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| logger.info("合同id:{},taskid:{}", id, task.getId()); | |||
| runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "合同作废"); | |||
| // 修改合同审核状态 | |||
| WxRentContract rentContract = record; | |||
| rentContract.setId(id); | |||
| rentContract.setApplyStatus(EnumRentContractAppStatus.CANCLE.getCode()); | |||
| updateApplyStatus(rentContract); | |||
| // 保存审批历史入 | |||
| MallUserInfo mallUserInfo = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||
| WxFlowRecord updateRecord = new WxFlowRecord(); | |||
| @@ -316,7 +316,7 @@ | |||
| <select id="getWaitPayBill" resultType="hashmap"> | |||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.receive_date receiveDate, | |||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,m.name merchantName,bill.receive_date receiveDate, | |||
| bill.need_pay needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType from ( | |||
| select bill.bill_type,bill.tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | |||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | |||
| @@ -579,7 +579,7 @@ | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,(need_pay-pay),DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property where is_preview = 0 and tenant_id = #{tenantId} | |||
| <include refid="getOweBillAsPageConditions"/> | |||
| union | |||
| @@ -79,7 +79,9 @@ | |||
| </select> | |||
| <select id="queryBillPropertyList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="hashmap"> | |||
| select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate, | |||
| select br.`id`,br.`receive_pay` receivePay, | |||
| case when br.status=1 then br.`pay` else 0 end pay | |||
| ,br.`receive_date` receiveDate, | |||
| br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay, | |||
| case when br.status=1 then br.owe else 0 end owe | |||
| ,br.`status`, | |||
| @@ -92,7 +94,7 @@ | |||
| else br.late_pay_price end latePayPrice, | |||
| (select max(period) from wx_bill_property where property_contract_id=br.property_contract_id) | |||
| allPeriod,d.`status` depositStatus,br.`shop_info` shopInfo,br.pay_way payWay,br.late_pay_status latePayStatus, | |||
| br.`comments` | |||
| br.`comments`,br.starttime,br.endtime | |||
| from wx_bill_property br left join wx_merchant m on br.merchant_id=m.id | |||
| left join wx_shop s on br.shop_id=s.id | |||
| left join wx_bill_property_deposit d on br.property_contract_id=d.property_contract_id | |||
| @@ -98,7 +98,7 @@ | |||
| else br.late_pay_price end latePayPrice, | |||
| (select max(period) from wx_bill_rent where rent_contract_id=br.rent_contract_id) allPeriod,d.`status` | |||
| depositStatus,br.shop_info shopInfo,br.pay_way payWay,br.late_pay_status latePayStatus, | |||
| br.`comments` | |||
| br.`comments`,br.starttime,br.endtime | |||
| from wx_bill_rent br left join wx_merchant m on br.merchant_id=m.id | |||
| left join wx_shop s on br.shop_id=s.id | |||
| left join wx_rent_contract r on br.rent_contract_id=r.id | |||
| @@ -24,7 +24,7 @@ | |||
| <sql id="allColumns"> | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | |||
| `create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time` | |||
| ,(select level from wx_level_config where discount_enable=1 and poins >= points order by points desc limit 1 ) level | |||
| ,(select level from wx_level_config where poins >= points order by points desc limit 1 ) level | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||