| @@ -20,9 +20,13 @@ | |||||
| </dependency> | </dependency> | ||||
| <dependency> | <dependency> | ||||
| <groupId>com.sie.irradiator</groupId> | <groupId>com.sie.irradiator</groupId> | ||||
| <artifactId>2069-siedemo-comm-api</artifactId> | |||||
| <artifactId>2068-yexiu-read-api</artifactId> | |||||
| <version>2.0.3</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>com.sie.irradiator</groupId> | |||||
| <artifactId>5002-sieiot-eventual-consistency-component</artifactId> | |||||
| </dependency> | </dependency> | ||||
| <!--<dependency>--> | <!--<dependency>--> | ||||
| <!--<groupId>org.springframework.boot</groupId>--> | <!--<groupId>org.springframework.boot</groupId>--> | ||||
| <!--<artifactId>spring-boot-starter-data-mongodb</artifactId>--> | <!--<artifactId>spring-boot-starter-data-mongodb</artifactId>--> | ||||
| @@ -0,0 +1,13 @@ | |||||
| package com.yuexiu.secp.read.model.dao; | |||||
| import com.sie.iot.common.model.dao.BaseCommonDAO_HI; | |||||
| import com.yuexiu.secp.read.model.entities.AdvertEntity; | |||||
| import org.springframework.stereotype.Component; | |||||
| /** | |||||
| * 广告维护Dao | |||||
| */ | |||||
| @Component("AdvertDao") | |||||
| public interface AdvertDao extends BaseCommonDAO_HI<AdvertEntity> { | |||||
| } | |||||
| @@ -0,0 +1,11 @@ | |||||
| package com.yuexiu.secp.read.model.dao.readonly; | |||||
| import com.siefw.hibernate.core.dao.DynamicViewObjectImpl; | |||||
| import com.yuexiu.secp.read.model.entities.readonly.AdvertEntityRo; | |||||
| import org.springframework.stereotype.Component; | |||||
| @Component("advertDaoRO") | |||||
| public interface AdvertDaoRO extends DynamicViewObjectImpl<AdvertEntityRo> { | |||||
| } | |||||
| @@ -0,0 +1,57 @@ | |||||
| package com.yuexiu.secp.read.model.entities; | |||||
| import com.alibaba.fastjson.annotation.JSONField; | |||||
| import com.baomidou.mybatisplus.annotation.IdType; | |||||
| import com.baomidou.mybatisplus.annotation.TableId; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.sie.iot.common.idgenerate.GeneratedKeyValue; | |||||
| import com.sie.iot.common.model.entity.BaseEntity; | |||||
| import com.yuexiu.secp.read.model.entities.readonly.AdvertEntityRo; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import io.swagger.annotations.ApiModelProperty; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| @Data | |||||
| @TableName("yxh_advert") | |||||
| @GeneratedKeyValue | |||||
| @ApiModel(value = "广告维护表") | |||||
| public class AdvertEntity implements Serializable { | |||||
| @TableId(value = "advert_id", type = IdType.ASSIGN_ID) | |||||
| @ApiModelProperty(value = "主键id") | |||||
| private Long advertId; | |||||
| @ApiModelProperty(value = "排列方式") | |||||
| private Integer arrangementMode; | |||||
| @ApiModelProperty(value = "投放位置") | |||||
| private Integer putLocation; | |||||
| @ApiModelProperty(value = "显示顺序") | |||||
| private Integer accordingOrder; | |||||
| @ApiModelProperty(value = "开始时间") | |||||
| @JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date beginTime; | |||||
| @ApiModelProperty(value = "结束时间") | |||||
| @JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date endTime; | |||||
| @ApiModelProperty(value = "广告状态") | |||||
| private Integer advertState; | |||||
| @ApiModelProperty(value = "跳转路径") | |||||
| private String skipUrl; | |||||
| @ApiModelProperty(value = "图片路径") | |||||
| private String pictureUrl; | |||||
| @ApiModelProperty(value = "广告说明") | |||||
| private String advertExplain; | |||||
| @ApiModelProperty(value = "租户id") | |||||
| private Long tenantId; | |||||
| private Long createdBy; | |||||
| @JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date creationDate; | |||||
| private Long lastUpdatedBy; | |||||
| @JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date lastUpdateDate; | |||||
| private Long lastUpdateLogin; | |||||
| private Integer deleteFlag; | |||||
| private Integer versionNum; | |||||
| } | |||||
| @@ -0,0 +1,61 @@ | |||||
| package com.yuexiu.secp.read.model.entities; | |||||
| import lombok.Data; | |||||
| /** | |||||
| * 流程回调接收实体 | |||||
| */ | |||||
| @Data | |||||
| public class FlowProcessCallbackEntity { | |||||
| /** | |||||
| * 流程实例id | |||||
| */ | |||||
| private String processInstanceId ; | |||||
| /** | |||||
| * 回调时间 | |||||
| */ | |||||
| private String completeTime; | |||||
| /** | |||||
| * 业务id | |||||
| */ | |||||
| private Long id ; | |||||
| /** | |||||
| * 用户id | |||||
| */ | |||||
| private Long userId; | |||||
| /** | |||||
| * url | |||||
| */ | |||||
| private String url ; | |||||
| /** | |||||
| * 任务id | |||||
| */ | |||||
| private String taskId; | |||||
| /** | |||||
| * 状态 | |||||
| */ | |||||
| private String status ; | |||||
| /** | |||||
| * | |||||
| */ | |||||
| private String processDefinitionKey; | |||||
| private String procDefKey; | |||||
| /** | |||||
| * 当前节点key | |||||
| */ | |||||
| private String taskDefinitionKey; | |||||
| /** | |||||
| * 当前节点名称 | |||||
| */ | |||||
| private String taskName ; | |||||
| /** | |||||
| * 下一个节点信息 | |||||
| */ | |||||
| private String nextTasks; | |||||
| /** | |||||
| * 下一个节点信息key | |||||
| */ | |||||
| private String nextTaskId; | |||||
| } | |||||
| @@ -0,0 +1,67 @@ | |||||
| package com.yuexiu.secp.read.model.entities.readonly; | |||||
| import cn.hutool.core.date.DateTime; | |||||
| import com.alibaba.fastjson.annotation.JSONField; | |||||
| import com.sie.iot.common.model.entity.BaseEntity; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import io.swagger.annotations.ApiModelProperty; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| @Data | |||||
| @ApiModel(value = "广告") | |||||
| public class AdvertEntityRo implements Serializable { | |||||
| public static final String QUERY= "SELECT\n" + | |||||
| "ya.advert_id AS advertId,\n" + | |||||
| "ya.arrangement_mode AS arrangementMode,\n" + | |||||
| "ya.put_location AS putLocation,\n" + | |||||
| "ya.according_order AS accordingOrder,\n" + | |||||
| "ya.begin_time AS beginTime,\n" + | |||||
| "ya.end_time AS endTime,\n" + | |||||
| "ya.advert_state AS advertState,\n" + | |||||
| "ya.skip_url AS skipUrl,\n" + | |||||
| "ya.picture_url AS pictureUrl,\n" + | |||||
| "ya.advert_explain AS advertExplain,\n" + | |||||
| "ya.tenant_id AS tenantId,\n" + | |||||
| "ya.created_by AS createdBy,\n" + | |||||
| "ya.creation_date AS creationDate,\n" + | |||||
| "ya.last_updated_by AS lastUpdatedBy,\n" + | |||||
| "ya.last_update_date AS lastUpdateDate,\n" + | |||||
| "ya.last_update_login AS lastUpdateLogin,\n" + | |||||
| "ya.delete_flag AS deleteFlag,\n" + | |||||
| "ya.version_num AS versionNum\n" + | |||||
| "FROM\n" + | |||||
| "yxh_advert ya\n" + | |||||
| "where 1=1 \n"; | |||||
| @ApiModelProperty(value = "主键id") | |||||
| private Long advertId; | |||||
| @ApiModelProperty(value = "排列方式") | |||||
| private Integer arrangementMode; | |||||
| @ApiModelProperty(value = "投放位置") | |||||
| private Integer putLocation; | |||||
| @ApiModelProperty(value = "显示顺序") | |||||
| private Integer accordingOrder; | |||||
| @ApiModelProperty(value = "开始时间") | |||||
| @JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date beginTime; | |||||
| @ApiModelProperty(value = "结束时间") | |||||
| @JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date endTime; | |||||
| @ApiModelProperty(value = "广告状态") | |||||
| private Integer advertState; | |||||
| @ApiModelProperty(value = "跳转路径") | |||||
| private String skipUrl; | |||||
| @ApiModelProperty(value = "图片路径") | |||||
| private String pictureUrl; | |||||
| @ApiModelProperty(value = "广告说明") | |||||
| private String advertExplain; | |||||
| @ApiModelProperty(value = "租户id") | |||||
| private Long tenantId; | |||||
| } | |||||
| @@ -0,0 +1,40 @@ | |||||
| package com.yuexiu.secp.read.dto; | |||||
| import com.alibaba.fastjson.annotation.JSONField; | |||||
| import com.sie.iot.common.bean.ReqeustCommonDataBean; | |||||
| import io.swagger.annotations.ApiModel; | |||||
| import io.swagger.annotations.ApiModelProperty; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.util.Date; | |||||
| @Data | |||||
| @ApiModel(value = "广告维护Dto") | |||||
| public class AdvertDto extends ReqeustCommonDataBean { | |||||
| @ApiModelProperty(value = "主键id") | |||||
| private Long advertId; | |||||
| @ApiModelProperty(value = "排列方式") | |||||
| private Integer arrangementMode; | |||||
| @ApiModelProperty(value = "投放位置") | |||||
| private Integer putLocation; | |||||
| @ApiModelProperty(value = "显示顺序") | |||||
| private Integer accordingOrder; | |||||
| @ApiModelProperty(value = "开始时间") | |||||
| @JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date beginTime; | |||||
| @ApiModelProperty(value = "结束时间") | |||||
| @JSONField(format = "yyyy-MM-dd HH:mm:ss") | |||||
| private Date endTime; | |||||
| @ApiModelProperty(value = "广告状态") | |||||
| private Integer advertState; | |||||
| @ApiModelProperty(value = "跳转路径") | |||||
| private String skipUrl; | |||||
| @ApiModelProperty(value = "图片路径") | |||||
| private String pictureUrl; | |||||
| @ApiModelProperty(value = "广告说明") | |||||
| private String advertExplain; | |||||
| @ApiModelProperty(value = "租户id") | |||||
| private Long tenantId; | |||||
| } | |||||
| @@ -0,0 +1,102 @@ | |||||
| package com.yuexiu.secp.read.controller; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.sie.iot.common.bean.PaginationRequestData; | |||||
| import com.sie.iot.common.bean.ResponseData; | |||||
| import com.sie.iot.common.iotenum.ResponseMsgCode; | |||||
| import com.sie.iot.common.model.inter.IBaseCommon; | |||||
| import com.sie.iot.common.services.CommonAbstractService; | |||||
| import com.sie.iot.component.exception.GushenRuntimeException; | |||||
| import com.siefw.hibernate.core.paging.Pagination; | |||||
| import com.yuexiu.secp.read.dto.AdvertDto; | |||||
| import com.yuexiu.secp.read.model.entities.AdvertEntity; | |||||
| import com.yuexiu.secp.read.model.entities.readonly.AdvertEntityRo; | |||||
| import com.yuexiu.secp.read.model.service.IAdvertServer; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import lombok.extern.slf4j.Slf4j; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.validation.annotation.Validated; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @Validated | |||||
| @Api(value = "测试", tags = "测试-用户") | |||||
| @RestController | |||||
| @Slf4j | |||||
| @RequestMapping("/advert/advertMaintenance") | |||||
| public class AdvertController extends CommonAbstractService { | |||||
| private static final Logger LOGGER = LoggerFactory.getLogger(AdvertController.class); | |||||
| @Autowired | |||||
| private IAdvertServer iAdvertServer; | |||||
| @Override | |||||
| public IBaseCommon<?> getBaseCommonServer() { | |||||
| return this.iAdvertServer; | |||||
| } | |||||
| @ApiOperation("获取广告维护表分页列表") | |||||
| @PostMapping(value = "/findAdvertInfo") | |||||
| public ResponseData<Pagination<AdvertEntityRo>> findTestUsersPagination(@RequestBody PaginationRequestData<AdvertDto> paginationRequestData) { | |||||
| Integer pageIndex = paginationRequestData.getPageIndex(); | |||||
| Integer pageRows = paginationRequestData.getPageRows(); | |||||
| AdvertDto advertDto = paginationRequestData.getParams(); | |||||
| JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(advertDto)); | |||||
| try { | |||||
| log.info("分页查询广告列表 参数:query:{}",advertDto); | |||||
| Pagination<AdvertEntityRo> pagination = iAdvertServer.findAdvertPagination(jsonObject, pageIndex, pageRows, paginationRequestData.getOrderByBean()); | |||||
| return ResponseData.data(pagination); | |||||
| } catch (Exception e) { | |||||
| LOGGER.error(" find - AdvertInfo error:"+e); | |||||
| throw new GushenRuntimeException(ResponseMsgCode.ERROR.msgCode, e); | |||||
| } | |||||
| } | |||||
| @ApiOperation(value = "保存或者更新广告列表") | |||||
| @PostMapping(value = "/saveOrUpdateAdvertInfo") | |||||
| public ResponseData saveOrUpdateAdvertInfo(@RequestBody AdvertEntity advertEntity) { | |||||
| log.info("保存 参数:{}",advertEntity); | |||||
| iAdvertServer.saveOrUpdateAdvertInfo(advertEntity); | |||||
| return ResponseData.success(); | |||||
| } | |||||
| @ApiOperation(value = "根据广告表 advertId 查询详细") | |||||
| @PostMapping(value = "/findById") | |||||
| public ResponseData findById(@RequestParam Long advertId){ | |||||
| try { | |||||
| log.info("根据 primaryKey 查询广告详细 id:{}", advertId); | |||||
| AdvertEntity entity = iAdvertServer.findById(advertId); | |||||
| return ResponseData.data(entity); | |||||
| }catch (Exception e){ | |||||
| throw new GushenRuntimeException(ResponseMsgCode.ERROR.msgCode, e); | |||||
| } | |||||
| } | |||||
| @ApiOperation(value = "根据广告表 advertId 删除") | |||||
| @PostMapping(value = "/delete") | |||||
| public ResponseData deleteById(@RequestParam Long advertId){ | |||||
| log.info("根据 id 删除 参数:{}",advertId); | |||||
| AdvertEntity advertEntity = iAdvertServer.findById(advertId); | |||||
| if (advertEntity != null) { | |||||
| advertEntity.setDeleteFlag(1); | |||||
| } | |||||
| iAdvertServer.update(advertEntity); | |||||
| return ResponseData.success(); | |||||
| } | |||||
| // @ApiOperation(value = "广告申请流程使用") | |||||
| // @PostMapping(value = "/setCommit") | |||||
| // public ResponseData setCommit(@RequestBody AdvertEntity advertEntity,@RequestParam String processDefinitionKey) { | |||||
| // log.info("广告维护申请流程 参数:{}", advertEntity); | |||||
| // iAdvertServer.doCommit(advertEntity,processDefinitionKey); | |||||
| // return ResponseData.success(); | |||||
| // } | |||||
| // @ApiOperation(value = "广告流程回调使用") | |||||
| // @PostMapping(value = "/updateAdvertState") | |||||
| // public ResponseData updateAdvertState(@DistrTransMessageParam Long msgId, RedisMessageContentBean redisMessageContentBean) { | |||||
| // log.info("广告维护申请流程回调 参数:{}", redisMessageContentBean); | |||||
| // iAdvertServer.updateAdvertState(msgId,redisMessageContentBean); | |||||
| // return ResponseData.success(); | |||||
| // } | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| package com.yuexiu.secp.read.infra.config; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.sie.iot.base.bean.RedisMessageContentBean; | |||||
| import com.sie.iot.distribute.transation.invoke.RemoteServiceInvoke; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Component; | |||||
| import java.util.Map; | |||||
| @Component | |||||
| public class BpmProcessingUtil { | |||||
| private static final Logger LOGGER = LoggerFactory.getLogger(BpmProcessingUtil.class); | |||||
| @Autowired | |||||
| private RemoteServiceInvoke remoteServiceInvoke; | |||||
| private static final String imSynchronizationKafkaTopic = "message.queue.bpm.asynchronous2"; | |||||
| //提交流程 加入对应的group group不存在的时候会自动创建 | |||||
| public void asynchronousToBpm(Map<String,Object> params){ | |||||
| LOGGER.info("流程提交参数:"+ JSONObject.toJSONString(params)); | |||||
| try { | |||||
| RedisMessageContentBean redisMessageContentBean=new RedisMessageContentBean(); | |||||
| redisMessageContentBean.setMessageBody(JSONObject.toJSONString(params)); | |||||
| redisMessageContentBean.setQueueName(imSynchronizationKafkaTopic); | |||||
| remoteServiceInvoke.sendMessageBody2Redis(redisMessageContentBean); | |||||
| }catch (Exception e){ | |||||
| LOGGER.error("流程提交异常,错误信息:"+e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.yuexiu.secp.read.infra.config; | |||||
| /** | |||||
| * 审批流程状态 | |||||
| */ | |||||
| public enum WorkflowApprovalStatus { | |||||
| DRAFT("DRAFT", "草稿"), | |||||
| APPROVAL("APPROVAL", "审批中"), | |||||
| ALLOW("ALLOW", "审批通过"), | |||||
| REFUSAL("REFUSAL", "审批驳回"), | |||||
| CLOSED("CLOSED", "已关闭"); | |||||
| private String index; | |||||
| private String name; | |||||
| WorkflowApprovalStatus(String index, String name) { | |||||
| this.index = index; | |||||
| this.name = name; | |||||
| } | |||||
| public static WorkflowApprovalStatus convert(String index){ | |||||
| WorkflowApprovalStatus[] statuses = WorkflowApprovalStatus.values(); | |||||
| for (int i = 0; i < statuses.length; i++) { | |||||
| if (statuses[i].index.equals(index)){ | |||||
| return statuses[i]; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public String getIndex() { | |||||
| return index; | |||||
| } | |||||
| private void setIndex(String index) { | |||||
| this.index = index; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| private void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,52 @@ | |||||
| package com.yuexiu.secp.read.model.service; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.sie.iot.base.bean.RedisMessageContentBean; | |||||
| import com.sie.iot.common.bean.OrderByBean; | |||||
| import com.sie.iot.common.model.inter.IBaseCommon; | |||||
| import com.sie.iot.distribute.transation.annotation.DistrTransMessageParam; | |||||
| import com.siefw.hibernate.core.paging.Pagination; | |||||
| import com.yuexiu.secp.read.model.entities.AdvertEntity; | |||||
| import com.yuexiu.secp.read.model.entities.readonly.AdvertEntityRo; | |||||
| import com.yuexiu.secp.read.model.service.impl.AdvertServer; | |||||
| public interface IAdvertServer extends IBaseCommon<AdvertEntity> { | |||||
| /** | |||||
| * 分页查询列表 | |||||
| * @param jsonObject | |||||
| * @return | |||||
| */ | |||||
| Pagination<AdvertEntityRo> findAdvertPagination(JSONObject jsonObject, Integer pageIndex, Integer pageRows, OrderByBean orderByBean); | |||||
| /** | |||||
| * 根据 id 查询详细 | |||||
| * @param * | |||||
| * @return | |||||
| */ | |||||
| AdvertEntity findById(Long id); | |||||
| /** | |||||
| * 新增或者更新 | |||||
| * @param testUsers | |||||
| * @return | |||||
| */ | |||||
| AdvertEntity saveOrUpdateAdvertInfo(AdvertEntity testUsers); | |||||
| /** | |||||
| * 提交流程 | |||||
| * @param advertEntity | |||||
| * * @param processDefinitionKey | |||||
| * @return | |||||
| */ | |||||
| void doCommit(AdvertEntity advertEntity,String processDefinitionKey); | |||||
| /** | |||||
| * 流程回调方法 | |||||
| * @param msgId | |||||
| * * @param processDefinitionKey | |||||
| * @return | |||||
| */ | |||||
| void updateAdvertState(@DistrTransMessageParam Long msgId, RedisMessageContentBean redisMessageContentBean); | |||||
| } | |||||
| @@ -0,0 +1,132 @@ | |||||
| package com.yuexiu.secp.read.model.service.impl; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.sie.iot.base.bean.RedisMessageContentBean; | |||||
| import com.sie.iot.common.bean.OrderByBean; | |||||
| import com.sie.iot.common.model.inter.server.BaseCommonServer; | |||||
| import com.sie.iot.common.util.SaafToolUtils; | |||||
| import com.sie.iot.distribute.transation.annotation.DistrTransMessageConsumer; | |||||
| import com.sie.iot.distribute.transation.annotation.DistrTransMessageParam; | |||||
| import com.sie.iot.distribute.transation.annotation.DistrTransMessageProvider; | |||||
| import com.siefw.hibernate.core.dao.ViewObject; | |||||
| import com.siefw.hibernate.core.paging.Pagination; | |||||
| import com.yuexiu.secp.read.infra.config.BpmProcessingUtil; | |||||
| import com.yuexiu.secp.read.infra.config.WorkflowApprovalStatus; | |||||
| import com.yuexiu.secp.read.model.dao.readonly.AdvertDaoRO; | |||||
| import com.yuexiu.secp.read.model.entities.AdvertEntity; | |||||
| import com.yuexiu.secp.read.model.entities.FlowProcessCallbackEntity; | |||||
| import com.yuexiu.secp.read.model.entities.readonly.AdvertEntityRo; | |||||
| import com.yuexiu.secp.read.model.service.IAdvertServer; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Component; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| @Component("advertServer") | |||||
| public class AdvertServer extends BaseCommonServer<AdvertEntity> implements IAdvertServer { | |||||
| @Autowired | |||||
| private ViewObject<AdvertEntity> advertDao; | |||||
| @Autowired | |||||
| private AdvertDaoRO advertDaoRO; | |||||
| @Autowired | |||||
| private BpmProcessingUtil bpmProcessingUtil; | |||||
| /***********流程标识***********/ | |||||
| /** | |||||
| * 请假 | |||||
| */ | |||||
| public final static String QJSQD = "OABUS.QINGJ"; | |||||
| @Override | |||||
| public Pagination<AdvertEntityRo> findAdvertPagination(JSONObject jsonObject, Integer pageIndex, Integer pageRows, OrderByBean orderByBean) { | |||||
| StringBuffer sql = new StringBuffer(AdvertEntityRo.QUERY); | |||||
| Map<String,Object> map = new HashMap<String,Object>(); | |||||
| //拼接查询参数 | |||||
| SaafToolUtils.parperHbmParam(AdvertEntityRo.class,jsonObject,sql,map); | |||||
| SaafToolUtils.changeQuerySort(jsonObject, sql, "ya.LAST_UPDATE_DATE desc", false); //排序 | |||||
| Pagination<AdvertEntityRo> findListResult = advertDaoRO.findPagination(sql,map,pageIndex,pageRows); | |||||
| return findListResult; | |||||
| } | |||||
| @Override | |||||
| public AdvertEntity findById(Long id) { | |||||
| AdvertEntity advertEntity = advertDao.getById(id); | |||||
| return advertEntity; | |||||
| } | |||||
| @Override | |||||
| public AdvertEntity saveOrUpdateAdvertInfo(AdvertEntity advertEntity) { | |||||
| try { | |||||
| //判断更新还是保存 | |||||
| if(advertEntity.getAdvertId() != null ){ | |||||
| advertDao.update(advertEntity); | |||||
| }else { | |||||
| advertDao.save(advertEntity); | |||||
| } | |||||
| } catch (Exception e){ | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return advertEntity; | |||||
| } | |||||
| @Override | |||||
| @DistrTransMessageProvider(desc = "leaveProvider") | |||||
| public void doCommit(AdvertEntity advertEntity,String processDefinitionKey) { | |||||
| //提交之前先进行保存 | |||||
| this.saveOrUpdateAdvertInfo(advertEntity); | |||||
| //封装流程参数 | |||||
| Map<String,Object> map = new HashMap<>(); | |||||
| map.put("processDefinitionKey",processDefinitionKey);//必传 流程定义Key 指定启动哪个流程 | |||||
| map.put("saveonly",false);//saveonly : 为true提交流程,流程不会走到下一个节点,为false流程会走到下一个节点 | |||||
| map.put("businessKey", advertEntity.getAdvertId());//必传 传入业务主键 | |||||
| map.put("title","广告维护申请流程:"+ advertEntity.getAdvertId()); | |||||
| map.put("orgId", advertEntity.getTenantId());//旧版传 记录租户id | |||||
| map.put("companyId", advertEntity.getTenantId());//必传 记录租户id | |||||
| //map.put("systemType","demo");//非必要 | |||||
| map.put("applyPersonId", advertEntity.getCreatedBy());//必传 申请人id | |||||
| // //非必传 ,这种是表单参数 流程变量中有用到表单字段需要在此传入 | |||||
| // List<Map<String,Object>> variablesList = new ArrayList<>(); | |||||
| // Map<String,Object> startUserId = new HashMap<>(); | |||||
| // startUserId.put("name","id"); | |||||
| // startUserId.put("type","Long"); | |||||
| // startUserId.put("value", advertEntity.getAdvertId()); | |||||
| // map.put("variables",variablesList);// 非必传 ,流程变量中用到的变量需要在此传入 | |||||
| if ("草稿".equals(advertEntity.getAdvertState())){ | |||||
| //提交流程 | |||||
| bpmProcessingUtil.asynchronousToBpm(map); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * 工作流每走一步都会在这里有一条消息 判断不同的状态 更新不同的业务表 | |||||
| * @param msgId | |||||
| * @param redisMessageContentBean | |||||
| */ | |||||
| @Override | |||||
| @DistrTransMessageConsumer(desc = "updateAdvertState") | |||||
| public void updateAdvertState(@DistrTransMessageParam Long msgId, RedisMessageContentBean redisMessageContentBean) { | |||||
| String payload = redisMessageContentBean.getMessageBody(); | |||||
| FlowProcessCallbackEntity callbackEntity = JSONObject.parseObject(payload, FlowProcessCallbackEntity.class); | |||||
| //看下是不是 请假的流程标识 | |||||
| if (QJSQD.equals(callbackEntity.getProcDefKey())){ | |||||
| AdvertEntity entity = advertDao.getById(callbackEntity.getId()); | |||||
| //审批通过 | |||||
| if (WorkflowApprovalStatus.ALLOW.getIndex().equals(callbackEntity.getStatus())){ | |||||
| entity.setAdvertState(001); | |||||
| //处理其他业务 发邮件 什么的 | |||||
| advertDao.update(entity); | |||||
| //驳回 | |||||
| } else if (WorkflowApprovalStatus.REFUSAL.getIndex().equals(callbackEntity.getStatus())){ | |||||
| entity.setAdvertState(002); | |||||
| advertDao.update(entity); | |||||
| //审批中 | |||||
| }else if (WorkflowApprovalStatus.APPROVAL.getIndex().equals(callbackEntity.getStatus())){ | |||||
| entity.setAdvertState(003); | |||||
| advertDao.update(entity); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -125,7 +125,8 @@ | |||||
| --> | --> | ||||
| <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> | <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> | ||||
| <property name="basePackage" | <property name="basePackage" | ||||
| value="com.yuexiu.secp.read.model.dao"></property> | |||||
| value="com.yuexiu.secp.read.model.dao,com.sie.iot.base.model.dao"></property> | |||||
| </bean> | </bean> | ||||
| <!-- 配置事务的传播特性 --> | <!-- 配置事务的传播特性 --> | ||||
| @@ -149,7 +150,8 @@ | |||||
| <!-- 那些类的哪些方法参与事务 --> | <!-- 那些类的哪些方法参与事务 --> | ||||
| <aop:config><!--|| execution(* com.sie.saaf.*.model.dao.readonly.*.*(..))--> | <aop:config><!--|| execution(* com.sie.saaf.*.model.dao.readonly.*.*(..))--> | ||||
| <aop:pointcut id="businessService" expression="execution(* com.yuexiu.secp.read.model.service.impl.*.*(..)) | <aop:pointcut id="businessService" expression="execution(* com.yuexiu.secp.read.model.service.impl.*.*(..)) | ||||
| || execution(* com.sie.iot.common.model.inter.server.*.*(..))"/> | |||||
| || execution(* com.sie.iot.common.model.inter.server.*.*(..)) | |||||
| || execution(* com.sie.iot.base.model.inter.server.*.*(..))"/> | |||||
| <aop:advisor advice-ref="txAdvice" pointcut-ref="businessService" order="0"/> | <aop:advisor advice-ref="txAdvice" pointcut-ref="businessService" order="0"/> | ||||
| </aop:config> | </aop:config> | ||||