Sfoglia il codice sorgente

添加年度评级设置

shaohao521 1 anno fa
parent
commit
4e9ab16187

+ 16 - 6
fangchan_manager/src/main/java/com/mw/platform/controller/ScoreController.java

@@ -1,14 +1,12 @@
 package com.mw.platform.controller;
 
 
-import com.mw.platform.business.mysql.entity.JgXwjl;
-import com.mw.platform.business.mysql.entity.Organization;
-import com.mw.platform.business.mysql.entity.Score;
-import com.mw.platform.business.mysql.entity.ScoreMx;
+import com.mw.platform.business.mysql.entity.*;
 import com.mw.platform.business.mysql.service.*;
 import com.mw.platform.core.BaseController;
 import com.mw.platform.core.Example;
 import com.mw.platform.core.ListView;
+import com.mw.platform.system.mysql.entity.SysUserInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +38,8 @@ public class ScoreController extends BaseController {
     private IJgXwjlService jgXwjlService;
     @Autowired
     private IJgXwjlFjService jgXwjlFjService;
+    @Autowired
+    private IScoreSetService scoreSetService;
     /**
      * 评级类型 1自动评级 2手动评级
      */
@@ -74,7 +74,13 @@ public class ScoreController extends BaseController {
     @GetMapping("/list")
     public ModelAndView list() {
         ModelAndView view = new ModelAndView(getPagePath() + "/list");
-        view.addObject("type",type);
+        ScoreSet scoreSet = scoreSetService.selectByPrimaryKey(1);
+        SysUserInfo userInfo = getSysUserInfo();
+        if ((userInfo.getFranId() == 0 || userInfo.getFranId() == 4 || userInfo.getFranId() == 5) && scoreSet.getPjkg() == 1){
+            view.addObject("ndpj",1);
+        }else {
+            view.addObject("ndpj",0);
+        }
         view.addObject("pjsz",getSysUserInfo().getRoleId() == 1 ? 1 : 0);
         getMenuButtonList();
         return view;
@@ -90,7 +96,11 @@ public class ScoreController extends BaseController {
             score.setOrgid(getSysUserInfo().getGroupId());
         }
 
-        if (score.getNd() == null && score.getJgmc() == null){ //没有按照年度查询 就查询当前年度
+        /**
+         * 年度为空或年度为null 且 机构名称为空或机构名称为null 只是查询zt=1的
+         */
+
+        if (score.getNd() == null && (score.getJgmc() == null || score.getJgmc().equals(""))){ //没有按照年度查询 就查询当前年度
             score.setZt(1);
         }
         Example<Score> example = new Example<>(score);

+ 67 - 0
fangchan_manager/src/main/java/com/mw/platform/controller/ScoreSetController.java

@@ -0,0 +1,67 @@
+package com.mw.platform.controller;
+
+
+import com.mw.platform.aspect.Log;
+import com.mw.platform.business.mysql.entity.ScoreSet;
+import com.mw.platform.business.mysql.service.IScoreSetService;
+import com.mw.platform.core.BaseConstant;
+import com.mw.platform.core.BaseController;
+import com.mw.platform.core.BaseParameter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+* 年度评级设置
+* @author ShaoHao
+* @since 2023-03-20
+*/
+@RestController
+@RequestMapping("/sys/scoreSet")
+public class ScoreSetController extends BaseController {
+
+    @Autowired
+    private IScoreSetService scoreSetService;
+
+    /**
+    * 转到修改
+    */
+    @GetMapping("/edit")
+    public ModelAndView toUpdate() {
+        ModelAndView view = new ModelAndView(getPagePath() + "/scoreSet");
+        view.addObject("scoreSet",scoreSetService.selectByPrimaryKey(1));
+        return view;
+    }
+
+    /**
+    * 修改
+    */
+    @Log
+    @PostMapping("/edit")
+    public String update(ScoreSet scoreSet){
+        BaseParameter result = new BaseParameter();
+        try{
+            int i = scoreSetService.updateByPrimaryKeySelective(scoreSet);
+            if( i <= 0){
+                result.setErrorMsg(BaseConstant.UPDATE_ERROR);
+                result.getContext();
+            }
+            result.setMessage(BaseConstant.UPDATE_OK);
+            result.commit();
+        }catch (Exception e) {
+            result.setErrorMsg(BaseConstant.UPDATE_ERROR);
+            printError(BaseConstant.UPDATE_ERROR, ScoreSet.class , e);
+        }
+
+        return result.getContext();
+    }
+
+    @Override
+    public String getPagePath() {
+        return "business/score";
+    }
+
+}

+ 14 - 5
fangchan_manager/src/main/resources/templates/business/score/list.html

@@ -39,14 +39,14 @@
 					<button id="btn_detail" class="layui-btn layui-btn-sm" >
 						<i class="layui-icon">&#xe6b2;</i>详情
 					</button>
-					<#if type?? && type == 2>
+					<#if ndpj?? && ndpj == 1>
 						<button id="btn_ndpj" class="layui-btn layui-btn-sm" >
 							<i class="layui-icon">&#xe628;</i>年度评级
 						</button>
 					</#if>
-					<#if type?? && type == 2>
-						<button id="btn_ndpj" class="layui-btn layui-btn-sm" >
-							<i class="layui-icon">&#xe628;</i>年度评级
+					<#if pjsz?? && pjsz == 1>
+						<button id="btn_score_set" class="layui-btn layui-btn-sm" >
+							<i class="layui-icon">&#xe628;</i>评级设置
 						</button>
 					</#if>
 				</div>
@@ -102,7 +102,7 @@
 					title : '评分年度',
 					align : 'center'
 				}, {
-					field : 'q',
+					field : 'qx',
 					title : '评分期限',
 					align : 'center',
 					templet : function(d){
@@ -153,6 +153,15 @@
 				type: 'year'
 			});
 
+			$('#btn_score_set').on('click', function() {
+				var index = layer.open({
+					title : '机构评级设置',
+					type : 2,
+					area : ['400px','350px'],
+					content : parent.appBaseUri + '/sys/scoreSet/edit'
+				});
+			});
+
 			$('#btn_detail').on('click', function() {
 				var table = layui.table;
 				var $ = layui.$;

+ 5 - 13
fangchan_manager/src/main/resources/templates/business/score/ndpj.html

@@ -168,10 +168,7 @@
 				width : 100,
 				align : 'center',
 				templet : function(d){
-					return '<div id="zt'+d.id+'">' +
-							'待评级'+
-						   // '<i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop" style="display: inline-block"></i>' +
-						   '</div>';
+					return '<div id="zt'+d.id+'">待评级</div>';
 				}
 			}, {
 				field : 'pjjg',
@@ -179,14 +176,7 @@
 				width : 136,
 				align : 'center',
 				templet : function(d){
-					return '<div id="jg'+d.id+'">' +
-							'-'+
-							// '<select id="jglx">'+
-							// '<option value="1" >房地产经纪机构</option>'+
-							// '<option value="2">房地产评估机构</option>'+
-							// '<option value="3" selected>房地产开发企业</option>'+
-							// '</select>' +
-							'</div>';
+					return '<div id="jg'+d.id+'">-</div>';
 
 				}
 			}] ],
@@ -231,6 +221,7 @@
 				arr.push(obj);
 			}
 			var data = {"scoreList":arr};
+			var loading = layer.msg('玩命加载中,请稍候...',{icon: 16,time:false,shade:0.4});
 			$.ajax({
 				url : '${request.contextPath}/sys/score/ndpj',
 				type : 'post',
@@ -238,7 +229,7 @@
 				contentType: 'application/json',
 				dataType : 'json',
 				success : function(data) {
-					console.log(data)
+					layer.close(loading);
 					if (data.code) {
 						layer.msg(data.msg, {
 							icon : 1
@@ -250,6 +241,7 @@
 					}
 				},
 				error : function(data, status, e) {
+					layer.close(loading);
 					layer.alert("操作失败", {
 						icon : 2
 					});

+ 107 - 0
fangchan_manager/src/main/resources/templates/business/score/scoreSet.html

@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>layui</title>
+<meta name="renderer" content="webkit">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport"
+	content="width=device-width, initial-scale=1, maximum-scale=1">
+<link rel="stylesheet" href="${request.contextPath }/css/layui.css" media="all">
+<style type="text/css">
+.layui-layout-admin .layui-footer {
+	left: 0px;
+	padding: 4px 10px;
+	text-align: right;
+}
+
+form input.layui-input[disabled] {
+    background: #f2f2f2;
+    color: #595963!important;
+}
+
+.layui-form-label{
+	width: 80px;
+}
+.layui-input{
+	width: 45%;
+}
+</style>
+</head>
+<body class="layui-layout-body">
+	<div class="layui-layout layui-layout-admin">
+		<form class="layui-form" style="margin-top: 10px; margin-right: 10px;">
+			<div class="layui-form-item">
+				<label class="layui-form-label">评级开关:</label>
+				<div class="layui-input-inline" style="width: 500px">
+					<input type="checkbox" name="pjkg" lay-skin="switch" <#if scoreSet.pjkg?? && scoreSet.pjkg == 1> checked="true"</#if> lay-text="开启|关闭" value="1">
+				</div>
+			</div>
+			<div class="layui-form-item">
+				<label class="layui-form-label">评级日期:</label>
+				<div class="layui-input-inline" style="width: 500px">
+					<input type="text" name="pjrq"  lay-verify="required"
+						   placeholder="请点击选择评级日期" autocomplete="off" class="layui-input">
+				</div>
+			</div>
+
+			<div class="layui-footer">
+				<button class="layui-btn" id="btn_save" lay-submit=""
+					lay-filter="baocun">保 存</button>
+			</div>
+		</form>
+
+	</div>
+	<script src="${request.contextPath }/layui.js" charset="utf-8"></script>
+	<script>
+		//Demo
+		layui.use(['form','laydate'], function() {
+			var form = layui.form;
+			var laydate = layui.laydate;
+			var $ = layui.$;
+
+			//日期
+			laydate.render({
+				elem:'[name=pjrq]',
+				type:'date',
+				trigger: 'click',
+				showBottom: false
+			});
+
+			form.on('submit(baocun)', function(data) {
+				$.ajax({
+					type : 'post',
+					url : parent.parent.appBaseUri + '/sys/scoreSet/edit',
+					data : {
+						id: 1,
+						pjkg : (data.field["pjkg"] != null && data.field["pjkg"] == 1) ? 1 : 0,
+						pjrq : data.field["pjrq"]
+					},
+					dataType : 'json',
+					success : function(data) {
+						if (data.code) {
+							layer.alert(data.msg, {
+								icon : 1
+							}, function(index) {
+								var index = parent.layer
+										.getFrameIndex(window.name);
+								parent.layer.close(index);
+							});
+						}else{
+							layer.alert(data.errorMsg, {
+								icon : 2
+							});
+						}
+					},
+					error : function(data, status, e) {
+						layer.alert(data.errorMsg, {
+							icon : 2
+						});
+					}
+				});
+				return false;
+			});
+		});
+	</script>
+</body>
+</html>

+ 14 - 0
fangchan_mybatis/src/main/java/com/mw/platform/business/mysql/dao/ScoreSetMapper.java

@@ -0,0 +1,14 @@
+package com.mw.platform.business.mysql.dao;
+
+import com.mw.platform.business.mysql.entity.ScoreSet;
+import com.mw.platform.core.IBaseDao;
+
+/**
+ *  Mapper 接口
+ *
+ * @author ShaoHao
+ * @since 2023-03-20
+ */
+public interface ScoreSetMapper extends IBaseDao<ScoreSet> {
+
+}

+ 35 - 0
fangchan_mybatis/src/main/java/com/mw/platform/business/mysql/entity/ScoreSet.java

@@ -0,0 +1,35 @@
+package com.mw.platform.business.mysql.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ *  Entity
+ *
+ * @author ShaoHao
+ * @since 2023-03-20
+ */
+@Setter
+@Getter
+@TableName("t_score_set")
+public class ScoreSet implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    /**
+     * 评级开关 0:关闭评级 1:开启评级
+     */
+    private Integer pjkg;
+
+    /**
+     * 评级日期
+     */
+    private String pjrq;
+
+
+}

+ 14 - 0
fangchan_mybatis/src/main/java/com/mw/platform/business/mysql/service/IScoreSetService.java

@@ -0,0 +1,14 @@
+package com.mw.platform.business.mysql.service;
+
+import com.mw.platform.business.mysql.entity.ScoreSet;
+import com.mw.platform.core.IService;
+
+/**
+ *  服务类
+ *
+ * @author ShaoHao
+ * @since 2023-03-20
+ */
+public interface IScoreSetService extends IService<ScoreSet> {
+
+}

+ 20 - 0
fangchan_mybatis/src/main/java/com/mw/platform/business/mysql/service/impl/ScoreSetServiceImpl.java

@@ -0,0 +1,20 @@
+package com.mw.platform.business.mysql.service.impl;
+
+import com.mw.platform.business.mysql.entity.ScoreSet;
+import com.mw.platform.business.mysql.dao.ScoreSetMapper;
+import com.mw.platform.business.mysql.service.IScoreSetService;
+import com.mw.platform.core.ServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ *  服务实现类
+ *
+ * @author ShaoHao
+ * @since 2023-03-20
+ */
+@Service
+@Transactional
+public class ScoreSetServiceImpl extends ServiceImpl<ScoreSetMapper, ScoreSet> implements IScoreSetService {
+
+}

+ 1 - 0
fangchan_mybatis/src/main/resources/BusinessMybatisConfigMysql.xml

@@ -44,5 +44,6 @@
 		<mapper resource="mapper/business/mysql/RyXwjlSplcMapper.xml"/>
 		<mapper resource="mapper/business/mysql/BaOrgFjMapper.xml"/>
 		<mapper resource="mapper/business/mysql/RyHemdSplcMapper.xml"/>
+		<mapper resource="mapper/business/mysql/ScoreSetMapper.xml"/>
 	</mappers>
 </configuration>

+ 30 - 56
fangchan_mybatis/src/main/java/com/mw/platform/business/mysql/mapper/xml/BaOrgFjMapper.xml → fangchan_mybatis/src/main/resources/mapper/business/mysql/ScoreSetMapper.xml

@@ -1,19 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.mw.platform.business.mysql.dao.BaOrgFjMapper">
+<mapper namespace="com.mw.platform.business.mysql.dao.ScoreSetMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.mw.platform.business.mysql.entity.BaOrgFj">
+    <resultMap id="BaseResultMap" type="com.mw.platform.business.mysql.entity.ScoreSet">
         <id column="id" property="id" jdbcType="INTEGER" />
-        <result column="ba_org_id" property="baOrgId" jdbcType="INTEGER" />
-        <result column="wjmc" property="wjmc" jdbcType="VARCHAR" />
-        <result column="url" property="url" jdbcType="VARCHAR" />
-        <result column="state" property="state" jdbcType="INTEGER" />
+        <result column="pjkg" property="pjkg" jdbcType="INTEGER" />
+        <result column="pjrq" property="pjrq" jdbcType="VARCHAR" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-    id, ba_org_id, wjmc, url, state
+    id, pjkg, pjrq
     </sql>
 
     <!-- 通用条件查询 -->
@@ -23,17 +21,11 @@
                 <if test="record.id != null">
                     AND id = #{record.id}
                 </if>
-                <if test="record.baOrgId != null">
-                    AND ba_org_id = #{record.baOrgId}
+                <if test="record.pjkg != null">
+                    AND pjkg = #{record.pjkg}
                 </if>
-                <if test="record.wjmc != null and record.wjmc != ''">
-                    AND wjmc = #{record.wjmc}
-                </if>
-                <if test="record.url != null and record.url != ''">
-                    AND url = #{record.url}
-                </if>
-                <if test="record.state != null">
-                    AND state = #{record.state}
+                <if test="record.pjrq != null and record.pjrq != ''">
+                    AND pjrq = #{record.pjrq}
                 </if>
             </if>
             <if test=" custom != null " />
@@ -56,59 +48,41 @@
     </sql>
 
     <!-- 插入 -->
-    <insert id="insertSelective" parameterType="com.mw.platform.business.mysql.entity.BaOrgFj">
-        INSERT INTO t_ba_org_fj
+    <insert id="insertSelective" parameterType="com.mw.platform.business.mysql.entity.ScoreSet">
+        INSERT INTO t_score_set
         <trim prefix="(" suffix=")" suffixOverrides="," >
             <if test="id != null" >
                 id,
             </if>
-            <if test="baOrgId != null" >
-                ba_org_id,
-            </if>
-            <if test="wjmc != null and wjmc != ''" >
-                wjmc,
-            </if>
-            <if test="url != null and url != ''" >
-                url,
+            <if test="pjkg != null" >
+                pjkg,
             </if>
-            <if test="state != null" >
-                state,
+            <if test="pjrq != null and pjrq != ''" >
+                pjrq,
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
             <if test="id != null">
                 #{id,jdbcType=INTEGER},
             </if>
-            <if test="baOrgId != null">
-                #{baOrgId,jdbcType=INTEGER},
+            <if test="pjkg != null">
+                #{pjkg,jdbcType=INTEGER},
             </if>
-            <if test="wjmc != null and wjmc != ''">
-                #{wjmc,jdbcType=VARCHAR},
-            </if>
-            <if test="url != null and url != ''">
-                #{url,jdbcType=VARCHAR},
-            </if>
-            <if test="state != null">
-                #{state,jdbcType=INTEGER},
+            <if test="pjrq != null and pjrq != ''">
+                #{pjrq,jdbcType=VARCHAR},
             </if>
         </trim>
     </insert>
 
     <!-- 更新 -->
-    <update id="updateByPrimaryKeySelective" parameterType="com.mw.platform.business.mysql.entity.BaOrgFj" >
-        UPDATE t_ba_org_fj
+    <update id="updateByPrimaryKeySelective" parameterType="com.mw.platform.business.mysql.entity.ScoreSet" >
+        UPDATE t_score_set
         <set>
-            <if test="baOrgId != null">
-                ba_org_id = #{baOrgId,jdbcType=INTEGER},
-            </if>
-            <if test="wjmc != null and wjmc != ''">
-                wjmc = #{wjmc,jdbcType=VARCHAR},
-            </if>
-            <if test="url != null and url != ''">
-                url = #{url,jdbcType=VARCHAR},
+            <if test="pjkg != null">
+                pjkg = #{pjkg,jdbcType=INTEGER},
             </if>
-            <if test="state != null">
-                state = #{state,jdbcType=INTEGER},
+            <if test="pjrq != null and pjrq != ''">
+                pjrq = #{pjrq,jdbcType=VARCHAR},
             </if>
         </set>
             WHERE id = #{id,jdbcType=INTEGER}
@@ -116,15 +90,15 @@
 
     <!-- 总记录条数 -->
     <select id="totalByExample" resultType="Integer" parameterType="com.mw.platform.core.Example" >
-        select count(id) from t_ba_org_fj
+        select count(id) from t_score_set
         <include refid="example_where" />
     </select>
 
     <!-- 通过主键查询 -->
-    <select id="selectByPrimaryKey" resultType="com.mw.platform.business.mysql.entity.BaOrgFj" >
+    <select id="selectByPrimaryKey" resultType="com.mw.platform.business.mysql.entity.ScoreSet" >
         SELECT
         <include refid="Base_Column_List" />
-        FROM t_ba_org_fj
+        FROM t_score_set
         WHERE id = #{id,jdbcType=INTEGER}
     </select>
 
@@ -132,14 +106,14 @@
     <select id="selectByExample" resultType="HashMap" parameterType="com.mw.platform.core.Example" >
         SELECT
         <include refid="Base_Column_List" />
-        FROM t_ba_org_fj
+        FROM t_score_set
         <include refid="example_where" />
         <include refid="base_order" />
     </select>
 
     <!-- 批量删除 -->
     <update id="deleteListByPrimaryKey" parameterType="java.lang.Integer" >
-        update t_ba_org_fj set state = -9
+        update t_score_set set state = -9
         <where>
             <if test="record != null">
                 id in