Commit f6e51aac authored by 耿迪迪's avatar 耿迪迪

通知公告-交易中心通知

parent 362f2d53
......@@ -113,6 +113,7 @@ public class SysNoticeController extends BaseController
*/
@PostMapping("/sendNotice")
public AjaxResult sendNotice(@RequestBody SysNotice notice){
updateNoticeByRelationId(notice);
notice.setCreateBy(SecurityUtils.getUsername());
notice.setCreateTime(new Date());
if(StringUtils.isNotNull(notice.getUserId())){
......@@ -140,4 +141,19 @@ public class SysNoticeController extends BaseController
}
return AjaxResult.success("消息推送成功!");
}
@PostMapping("/deleteNoticeByRelationId")
public AjaxResult deleteNoticeByRelationId(@RequestBody SysNotice notice){
return toAjax(updateNoticeByRelationId(notice));
}
private int updateNoticeByRelationId(SysNotice notice){
if(StringUtils.isNotEmpty(String.valueOf(notice.getRelationId())) && !notice.isStart()){
SysNotice deleteNotice = new SysNotice();
deleteNotice.setStatus("1");
deleteNotice.setRelationId(notice.getRelationId());
return noticeService.updateNoticeByRelationId(deleteNotice);
}
return 0;
}
}
......@@ -77,7 +77,11 @@ public class TTradeProjectController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody TTradeProject tTradeProject)
{
return toAjax(tTradeProjectService.insertTTradeProject(tTradeProject));
int rows = tTradeProjectService.insertTTradeProject(tTradeProject);
if(rows >0){
return AjaxResult.success(tTradeProject);
}
return AjaxResult.error();
}
/**
......
......@@ -48,6 +48,16 @@ public class SysNotice extends BaseEntity
*/
private String roles;
/** 关联类型:1.项目交易中心 2. 物品采购 3.服务费用 4.借支 5.借贷 */
@Excel(name = "关联类型:1.项目交易中心 2. 物品采购 3.服务费用 4.借支 5.借贷")
private String relationType;
/** 关联主键id */
@Excel(name = "关联主键id")
private Long relationId;
private boolean isStart;
public void setNoticeId(Integer noticeId)
{
this.noticeId = noticeId;
......@@ -119,6 +129,30 @@ public class SysNotice extends BaseEntity
this.roles = roles;
}
public String getRelationType() {
return relationType;
}
public void setRelationType(String relationType) {
this.relationType = relationType;
}
public Long getRelationId() {
return relationId;
}
public void setRelationId(Long relationId) {
this.relationId = relationId;
}
public boolean isStart() {
return isStart;
}
public void setStart(boolean start) {
isStart = start;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -57,4 +57,11 @@ public interface SysNoticeMapper
* @return 结果
*/
public int deleteNoticeByIds(Long[] noticeIds);
/**
* 更新公告
* @param notice 公告信息
* @return
*/
int updateNoticeByRelationId(SysNotice notice);
}
......@@ -57,4 +57,11 @@ public interface ISysNoticeService
* @return 结果
*/
public int deleteNoticeByIds(Long[] noticeIds);
/**
* 更新公告
* @param notice 公告信息
* @return
*/
int updateNoticeByRelationId(SysNotice notice);
}
......@@ -89,4 +89,14 @@ public class SysNoticeServiceImpl implements ISysNoticeService
{
return noticeMapper.deleteNoticeByIds(noticeIds);
}
/**
* 更新公告
* @param notice 公告信息
* @return
*/
@Override
public int updateNoticeByRelationId(SysNotice notice){
return noticeMapper.updateNoticeByRelationId(notice);
}
}
......@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = p.user_id) user_name,
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = p.approved_user_id) approved_user_name,
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = p.purchase_dept_manager_id) purchase_dept_manager_name,
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = t.handled_by_user_id) handled_by_user_name
(SELECT t1.nick_name FROM sys_user t1 WHERE t1.user_id = p.handled_by_user_id) handled_by_user_name
FROM
t_purchase p
</sql>
......
......@@ -11,6 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="noticeContent" column="notice_content" />
<result property="userId" column="user_id" />
<result property="status" column="status" />
<result property="relationType" column="relation_type" />
<result property="relationId" column="relation_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
......@@ -19,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSysNoticeVo">
select notice_id, notice_title, notice_type, notice_content, user_id, status, create_by, create_time, update_by, update_time, remark from sys_notice
select notice_id, notice_title, notice_type, notice_content, user_id, status, relation_type, relation_id, create_by, create_time, update_by, update_time, remark from sys_notice
</sql>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
......@@ -30,6 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="noticeContent != null and noticeContent != ''"> and notice_content = #{noticeContent}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="relationType != null and relationType != ''"> and relation_type = #{relationType}</if>
<if test="relationId != null "> and relation_id = #{relationId}</if>
</where>
ORDER BY create_time DESC
</select>
......@@ -47,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="noticeContent != null">notice_content,</if>
<if test="userId != null">user_id,</if>
<if test="status != null">status,</if>
<if test="relationType != null">relation_type,</if>
<if test="relationId != null">relation_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
......@@ -59,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="noticeContent != null">#{noticeContent},</if>
<if test="userId != null">#{userId},</if>
<if test="status != null">#{status},</if>
<if test="relationType != null">#{relationType},</if>
<if test="relationId != null">#{relationId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
......@@ -75,6 +83,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="noticeContent != null">notice_content = #{noticeContent},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="status != null">status = #{status},</if>
<if test="relationType != null">relation_type = #{relationType},</if>
<if test="relationId != null">relation_id = #{relationId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
......@@ -94,4 +104,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{noticeId}
</foreach>
</delete>
<update id="updateNoticeByRelationId" parameterType="SysNotice">
update sys_notice
<trim prefix="SET" suffixOverrides=",">
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle},</if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType},</if>
<if test="noticeContent != null">notice_content = #{noticeContent},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="status != null">status = #{status},</if>
<if test="relationType != null">relation_type = #{relationType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where relation_id = #{relationId} AND status = '0'
</update>
</mapper>
\ No newline at end of file
......@@ -51,3 +51,11 @@ export function sendNotice(data) {
data: data
})
}
export function deleteNoticeByRelationId(data) {
return request({
url: '/system/notice/deleteNoticeByRelationId',
method: 'post',
data: data
})
}
......@@ -66,7 +66,6 @@
this.toPay();
return;
}
console.log("lalalalalalala----------")
this.getProjectInfo();
},
//去支付
......@@ -116,7 +115,7 @@
this.$emit("getList");
this.$message.success("复核成功!");
if(this.$refs.currentCom.submitSuggestion().tradeStatus == "4"){
sendNotice({noticeTitle:"您有新交易项目被驳回",noticeType:"1",noticeContent:"您有新交易项目被驳回",userId:this.tradeInfo.applyId})
sendNotice({noticeTitle:"您有新交易项目被驳回",noticeType:"1",noticeContent:"您有新交易项目被驳回",userId:this.tradeInfo.applyId,relationType:"1",relationId:this.tradeInfo.tradeId})
}
}else{
this.$message.error("复核失败!");
......@@ -132,12 +131,12 @@
that.$message.success("提交成功!");
if(this.$refs.currentCom.submitSuggestion().tradeStatus == "1"){
sendNotice({noticeTitle:"您有新交易项目待确认",noticeType:"1",noticeContent:"您有新交易项目待确认",
deptId:this.tradeInfo.tradeDeptId,roles:"deptLeader"})
deptId:this.tradeInfo.tradeDeptId,roles:"deptLeader",relationType:"1",relationId:this.tradeInfo.tradeId})
}
if(this.$refs.currentCom.submitSuggestion().tradeStatus == "2"){
sendNotice({noticeTitle:"您有新交易项目待确认",noticeType:"1",noticeContent:"您有新交易项目待确认",
deptId:this.tradeInfo.applyDeptId,roles:"deptLeader"})
deptId:this.tradeInfo.applyDeptId,roles:"deptLeader",relationType:"1",relationId:this.tradeInfo.tradeId})
}
}else{
......
......@@ -356,7 +356,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import FileUpload from "@/components/MultipleFileUpload";
import uploadfile from "@/assets/uploadfile.png";
import TableList from "./components/TableList";
import { sendNotice } from "@/api/system/notice";
import { sendNotice, deleteNoticeByRelationId } from "@/api/system/notice";
export default {
name: "Project",
components: {
......@@ -577,11 +577,11 @@ export default {
this.getList();
});
} else {
addProject(this.form).then((response) => {
addProject(this.form).then((res) => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
sendNotice({noticeTitle:"您有新交易项目待评价",noticeType:"1",noticeContent:"您有新交易项目待评价",userId:this.form.tradeTransactor})
sendNotice({noticeTitle:"您有新交易项目待评价",noticeType:"1",noticeContent:"您有新交易项目待评价",userId:this.form.tradeTransactor,relationType:"1",relationId:res.data.tradeId,isStart:true})
});
}
}
......@@ -600,6 +600,7 @@ export default {
}
)
.then(function () {
deleteNoticeByRelationId({relationId:tradeIds});
return delProject(tradeIds);
})
.then(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment