Commit 77b9efc4 by sunxin

类型 类别 需求变更

parent c303d94c
......@@ -83,6 +83,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends DataEntity<T>>
public void save(T entity) {
if (entity.getIsNewRecord()){
entity.preInsert();
dao.insert(entity);
}else{
entity.preUpdate();
......
......@@ -20,6 +20,15 @@ public class CtBbtcBusCategory extends DataEntity<CtBbtcBusCategory> {
private CtBbtcBusType type; // 所属业务类型
private String typeName; // 所属业务类型名称
private String ctBbtcGroup; //所属集团
private String supplementArea; //所属区域
public String getSupplementArea() {
return supplementArea;
}
public void setSupplementArea(String supplementArea) {
this.supplementArea = supplementArea;
}
public String getCtBbtcGroup() {
return ctBbtcGroup;
......
......@@ -19,6 +19,16 @@ public class CtBbtcBusType extends DataEntity<CtBbtcBusType> {
private String name; // 业务类型名称
private String group; // 所属集团
private String groupName; // 所属集团名称
private String area; //区域
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public CtBbtcBusType() {
super();
}
......@@ -45,7 +55,7 @@ public class CtBbtcBusType extends DataEntity<CtBbtcBusType> {
this.name = name;
}
@Length(min=0, max=64, message="所属集团长度必须介于 0 和 64 之间")
@Length(min=0, max=1000, message="所属集团长度必须介于 0 和 1000之间")
public String getGroup() {
return group;
}
......@@ -53,6 +63,7 @@ public class CtBbtcBusType extends DataEntity<CtBbtcBusType> {
public void setGroup(String group) {
this.group = group;
}
public String getGroupName() {
return groupName;
}
......
......@@ -4,9 +4,12 @@
package com.ejweb.modules.report.service;
import java.util.List;
import java.util.UUID;
import com.ejweb.modules.report.dao.CtBbtcRegionDao;
import com.ejweb.modules.report.dao.CtBbtcTypeAreaDao;
import com.ejweb.modules.report.entity.CtBbtcRegion;
import com.ejweb.modules.report.entity.CtBbtcTypeArea;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -28,6 +31,9 @@ public class CtBbtcBusTypeService extends CrudService<CtBbtcBusTypeDao, CtBbtcBu
@Autowired
private CtBbtcBusTypeDao ctBbtcBusTypeDao;
@Autowired
private CtBbtcTypeAreaDao ctBbtcTypeAreaDao;
public CtBbtcBusType get(String id) {
return super.get(id);
}
......@@ -43,6 +49,32 @@ public class CtBbtcBusTypeService extends CrudService<CtBbtcBusTypeDao, CtBbtcBu
@Transactional(readOnly = false)
public void save(CtBbtcBusType ctBbtcBusType) {
super.save(ctBbtcBusType);
/*将可用范围存到 typearea表中*/
System.out.println(ctBbtcBusType.getGroup()+"==========================");
System.out.println(ctBbtcBusType.getArea()+"=========================");
String[] groups = ctBbtcBusType.getGroup().split(",");
String[] areas = ctBbtcBusType.getArea().split(",");
int i=0;
for (String typeArea:groups) {
CtBbtcTypeArea ctBbtcTypeArea =new CtBbtcTypeArea();
ctBbtcTypeArea.setId(UUID.randomUUID().toString());
ctBbtcTypeArea.setGroup(typeArea);
ctBbtcTypeArea.setArea(areas[i]);
ctBbtcTypeArea.setParentId(ctBbtcBusType.getId());
ctBbtcTypeAreaDao.insert(ctBbtcTypeArea);
i++;
}
}
public List<CtBbtcTypeArea> getByArea(String groupId,String areaId){
CtBbtcTypeArea area=new CtBbtcTypeArea();
area.setGroup(groupId);
area.setArea(areaId);
return this.ctBbtcTypeAreaDao.getByAreaId(area);
}
@Transactional(readOnly = false)
......@@ -50,8 +82,4 @@ public class CtBbtcBusTypeService extends CrudService<CtBbtcBusTypeDao, CtBbtcBu
super.delete(ctBbtcBusType);
}
public List<CtBbtcBusType> getByGroupId(String groupId){
return this.ctBbtcBusTypeDao.getByGroupId(groupId);
}
}
\ No newline at end of file
......@@ -109,6 +109,11 @@ public class CtBbtcBusCategoryController extends BaseController {
@RequestMapping(value = "form")
public String form(CtBbtcBusCategory ctBbtcBusCategory, Model model) {
List<CtBbtcBusType> ctBbtcBusTypeList = ctBbtcBusTypeService.findList(null);
if(ctBbtcBusCategory.getId() != null){
CtBbtcBusCategory ctBbtcBusCategory1 = ctBbtcBusCategoryService.get(ctBbtcBusCategory.getId());
ctBbtcBusCategory.setType(ctBbtcBusCategory1.getType());
ctBbtcBusCategory.setTypeName(ctBbtcBusCategory1.getTypeName());
}
model.addAttribute("ctBbtcBusTypeList", ctBbtcBusTypeList);
model.addAttribute("ctBbtcBusCategory", ctBbtcBusCategory);
return "modules/report/ctBbtcBusCategoryForm";
......
......@@ -3,12 +3,14 @@
*/
package com.ejweb.modules.report.web;
import com.alibaba.fastjson.JSONObject;
import com.ejweb.core.base.BaseController;
import com.ejweb.core.persistence.Page;
import com.ejweb.core.utils.StringUtils;
import com.ejweb.modules.report.entity.CtBbtcBusType;
import com.ejweb.modules.report.entity.CtBbtcRegion;
import com.ejweb.modules.report.entity.CtBbtcTypeArea;
import com.ejweb.modules.report.entity.ReportEntity;
import com.ejweb.modules.report.service.CtBbtcBusTypeService;
import com.ejweb.modules.report.service.ReportService;
......@@ -24,6 +26,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.List;
/**
......@@ -120,4 +123,21 @@ public class CtBbtcBusTypeController extends BaseController {
return false;
}
@RequestMapping(value = "getTypeList")
public void getRegionList(String groupId, RedirectAttributes redirectAttributes,HttpServletResponse response,String area) {
if (groupId != null && !"".equals(groupId) && area != null && !"".equals(area)) {
JSONObject res = new JSONObject();
List<CtBbtcTypeArea> ctBbtcTypeList = ctBbtcBusTypeService.getByArea(groupId, area);
res.put("ctBbtcTypeList", ctBbtcTypeList);
String jsonStr = res.toJSONString();
try {
PrintWriter out = response.getWriter();
out.print(jsonStr);
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
\ No newline at end of file
......@@ -132,10 +132,7 @@ public class CtBbtcRegionController extends BaseController {
if(groupId != null && !"".equals(groupId)){
JSONObject res = new JSONObject();
List<CtBbtcRegion> ctBbtcRegionList = ctBbtcRegionService.getByGroupId(groupId);
List<CtBbtcBusType> ctBbtcBusTypeList = ctBbtcBusTypeService.getByGroupId(groupId);
res.put("ctBbtcRegionList", ctBbtcRegionList);
res.put("ctBbtcBusTypeList", ctBbtcBusTypeList);
String jsonStr = res.toJSONString();
try{
PrintWriter out = response.getWriter();
......
......@@ -8,12 +8,14 @@
a.name AS "name",
a.type AS "type.id",
b.name AS "typeName",
b2.label AS "ctBbtcGroup"
b2.label AS "ctBbtcGroup",
b3.name AS "supplementArea"
</sql>
<sql id="ctBbtcBusCategoryJoins">
LEFT JOIN ct_bbtc_bus_type b on b.id = a.type
LEFT JOIN ct_bbtc_sys_dict b2 on b2.id = a.CTBBTCGROUP
LEFT JOIN CT_BBTC_REGION b3 on b3.id = a.supplementArea
</sql>
<select id="get" resultType="CtBbtcBusCategory">
......@@ -79,13 +81,15 @@
fnumber,
name,
type,
ctBbtcGroup
ctBbtcGroup,
supplementArea
) VALUES (
#{id},
#{number},
#{name},
#{type.id},
#{ctBbtcGroup}
#{ctBbtcGroup},
#{supplementArea}
)
</insert>
......@@ -94,7 +98,8 @@
fnumber = #{number},
name = #{name},
type = #{type.id},
ctBbtcGroup=#{ctBbtcGroup}
ctBbtcGroup=#{ctBbtcGroup},
supplementArea=#{supplementArea}
WHERE id = #{id}
</update>
......
......@@ -3,34 +3,30 @@
<mapper namespace="com.ejweb.modules.report.dao.CtBbtcBusTypeDao">
<sql id="ctBbtcBusTypeColumns">
a.id AS "id",
a.fnumber AS "number",
a.name AS "name",
a.supplement_group AS "group",
b.label AS "groupName"
id AS "id",
fnumber AS "number",
name AS "name"
</sql>
<sql id="ctBbtcBusTypeJoins">
<!--<sql id="ctBbtcBusTypeJoins">
LEFT JOIN ct_bbtc_sys_dict b on b.id = a.supplement_group
</sql>
</sql>-->
<select id="get" resultType="CtBbtcBusType">
SELECT
<include refid="ctBbtcBusTypeColumns"/>
FROM ct_bbtc_bus_type a
<include refid="ctBbtcBusTypeJoins"/>
WHERE a.id = #{id}
FROM ct_bbtc_bus_type
WHERE id = #{id}
</select>
<select id="findList" resultType="CtBbtcBusType">
SELECT
<include refid="ctBbtcBusTypeColumns"/>
FROM ct_bbtc_bus_type a
<include refid="ctBbtcBusTypeJoins"/>
FROM ct_bbtc_bus_type
<where>
<if test="name != null and name != ''">
AND a.name LIKE
AND name LIKE
<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
......@@ -45,23 +41,13 @@
</choose>
</select>
<select id="getByGroupId" resultType="CtBbtcBusType">
SELECT
<include refid="ctBbtcBusTypeColumns"/>
FROM ct_bbtc_bus_type a
<include refid="ctBbtcBusTypeJoins"/>
WHERE a.supplement_group = #{groupId}
</select>
<select id="findAllList" resultType="CtBbtcBusType">
SELECT
<include refid="ctBbtcBusTypeColumns"/>
FROM ct_bbtc_bus_type a
<include refid="ctBbtcBusTypeJoins"/>
FROM ct_bbtc_bus_type
<where>
</where>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
......@@ -75,13 +61,11 @@
INSERT INTO ct_bbtc_bus_type(
id,
fnumber,
name,
supplement_group
name
) VALUES (
#{id},
#{number},
#{name},
#{group}
#{name}
)
</insert>
......@@ -89,7 +73,6 @@
UPDATE ct_bbtc_bus_type SET
fnumber = #{number},
name = #{name},
supplement_group = #{group}
WHERE id = #{id}
</update>
......
......@@ -29,7 +29,7 @@
function getRegion(){
var selectNode = $("#supplementType");
var selectNode = $("#supplementArea");
selectNode.empty();//每次需要将上一次的数据进行清空
selectNode.append("<option value=''>请选择</option>");
......@@ -40,16 +40,43 @@
url: "${ctx}/report/ctBbtcRegion/getRegionList?groupId="+ts_describe,
dataType: "json",
success: function(returnedData) {
console.log(returnedData);
var data2 = returnedData.ctBbtcBusTypeList;
// console.log(data1[0].name);
// console.log(data2[0].name);
var data2 = returnedData.ctBbtcRegionList;
if (data2 != '') {
var slsb=document.getElementById("supplementArea");
for (var i = 0;i < data2.length;i++){
slsb.append(new Option(data2[i].name,data2[i].id));
}
}
},error:function(data){
alert("系统错误");
}
});
}else{
/*top.$.jBox.tip('请选择所属集团', 'warning');*/
}
}
function getType(){
var selectNode = $("#supplementType");
selectNode.empty();//每次需要将上一次的数据进行清空
selectNode.append("<option value=''>请选择</option>");
var ts_describe1= $("#ctBbtcGroup").val();
var ts_describe2= $("#supplementArea").val();
if(ts_describe1 != null && ts_describe1 != '' && ts_describe2 != null && ts_describe2 != '' ){
$.ajax({
type: "POST",
url: "${ctx}/report/ctBbtcBusType/getTypeList?groupId="+ts_describe1+"&area="+ts_describe2,
dataType: "json",
success: function(returnedData) {
var data2 = returnedData.ctBbtcTypeList;
if (data2 != '') {
console.log(data2[0].name);
var slsb=document.getElementById("supplementType");
for (var i = 0;i < data2.length;i++){
slsb.append(new Option(data2[i].name,data2[i].id));
slsb.append(new Option(data2[i].typeName,data2[i].parentId));
}
}
},error:function(data){
......@@ -97,11 +124,21 @@
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group" >
<label class="control-label">所属区域:</label>
<div class="controls">
<form:select id="supplementArea" path="supplementArea" class="input-small required" onchange="getType();" cssStyle="width: 285px">
<form:option value="">请选择</form:option>
</form:select>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">所属业务类型:</label>
<div class="controls">
<form:select onchange="resetPageNo();" path="type.id" class="input-xlarge required" id="supplementType" cssStyle="width: 285px" >
<form:option value="">请选择</form:option>
<%--<form:option value="">请选择</form:option>--%>
</form:select>
<%--<form:input path="type" htmlEscape="false" maxlength="64" class="input-xlarge "/>--%>
<span class="help-inline"><font color="red">*</font> </span>
......
......@@ -39,6 +39,7 @@
<th>业务类别编码</th>
<th>业务类别名称</th>
<th>所属集团</th>
<th>所属区域</th>
<th>所属业务类型</th>
<shiro:hasPermission name="report:ctBbtcBusCategory:edit"><th>操作</th></shiro:hasPermission>
</tr>
......@@ -62,6 +63,9 @@
<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq null}">--</c:if>
</td>
<td>
${ctBbtcBusCategory.supplementArea}
</td>
<td>
${ctBbtcBusCategory.typeName}
</td>
<shiro:hasPermission name="report:ctBbtcBusCategory:edit"><td>
......
......@@ -23,6 +23,65 @@
}
});
});
function addRow(list, idx, tpl, row) {
$(list).append(Mustache.render(tpl, {
idx: idx, delBtn: true, row: row
}));
genSeqNo();
}
function delRow(obj, prefix) {
var id = $(prefix + "_id");
var delFlag = $(prefix + "_delFlag");
delFlag.val("1");
$(obj).parent().parent().remove();
genSeqNo();
}
// 自动生成序号
function genSeqNo() {
var indx = 0;
$('#scopeList').find("tr").each(function () {
var tdArr = $(this).children();
tdArr.eq(1).html(indx + 1);
indx = indx + 1;
});
}
/*跟据集团 获取对应的业务类型 和业务类别 */
function getRegion(supplementGroup,supplementArea){
var selectNode = $(supplementArea);
selectNode.empty();//每次需要将上一次的数据进行清空
selectNode.append("<option value=''>请选择</option>");
var ts_describe= $(supplementGroup).val();
if(ts_describe != null && ts_describe != ''){
$.ajax({
type: "POST",
url: "${ctx}/report/ctBbtcRegion/getRegionList?groupId="+ts_describe,
dataType: "json",
success: function(returnedData) {
var data1 = returnedData.ctBbtcRegionList;
if (data1 != '') {
var slsb=$(supplementArea);
for (var i = 0;i < data1.length;i++){
slsb.append(new Option(data1[i].name,data1[i].id));
}
}
},error:function(data){
alert("系统错误");
}
});
}else{
/*top.$.jBox.tip('请选择被举报集团', 'warning');*/
}
}
</script>
</head>
<body>
......@@ -47,15 +106,91 @@
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">所属集团</label>
<label class="control-label">使用范围</label>
<div class="controls">
<form:select onchange="resetPageNo();" path="group" class="input-xlarge required" cssStyle="width: 285px">
<form:option value="">请选择</form:option>
<form:options items="${fns:getDictList('supplement_group')}" itemLabel="label" itemValue="id"
htmlEscape="false"/></form:select>
<%--<form:input path="group" htmlEscape="false" maxlength="64" class="input-xlarge "/>--%>
<span class="help-inline"><font color="red">*</font> </span>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th class="hide"></th>
<th>序号</th>
<th>集团名称</th>
<th>区域名称</th>
</tr>
</thead>
<tbody id="scopeList">
</tbody>
<tfoot>
<tr>
<td colspan="7">
<a href="javascript:"
onclick="addRow('#scopeList', scopeRowIdx, scopeTpl);scopeRowIdx = scopeRowIdx + 1;"
class="btn">新增使用范围</a></td>
</tr>
</tfoot>
</table>
<script type="text/template" id="scopeTplReadOnly">//<!--
<tr id="scopeList{{idx}}">
<td class="hide">
<input id="scopeList{{idx}}_id" type="hidden" />
<input id="scopeList{{idx}}_delFlag" type="hidden" />
</td>
<td></td>
<td>
<form:select id="supplementGroup{{idx}}" path="group" class="input-small required" onchange="getRegion('#supplementGroup{{idx}}','#supplementArea{{idx}}');" cssStyle="width: 280px">
<form:option value="">请选择</form:option>
<form:options items="${fns:getDictList('supplement_group')}" itemLabel="label" itemValue="id"
htmlEscape="false"/>
</form:select>
</td>
<td>
<form:select id="supplementArea{{idx}}" path="area" class="input-small required" cssStyle="width: 280px">
<form:option value="">请选择</form:option>
</form:select>
</td>
</tr>//-->
</script>
<script type="text/template" id="scopeTpl">//<!--
<tr id="scopeList{{idx}}">
<td class="hide">
<input id="scopeList{{idx}}_id" type="hidden" />
<input id="scopeList{{idx}}_delFlag" type="hidden" />
</td>
<td></td>
<td>
<form:select id="supplementGroup{{idx}}" path="group" class="input-small required" onchange="getRegion('#supplementGroup{{idx}}','#supplementArea{{idx}}');" cssStyle="width: 280px">
<form:option value="">请选择</form:option>
<form:options items="${fns:getDictList('supplement_group')}" itemLabel="label" itemValue="id"
htmlEscape="false"/>
</form:select>
</td>
<td>
<form:select id="supplementArea{{idx}}" path="area" class="input-small required" cssStyle="width: 280px">
<form:option value="">请选择</form:option>
</form:select>
</td>
<td class="text-center" width="20">
{{#delBtn}}<span class="close" onclick="delRow(this, '#scopeList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
</td>
</tr>//-->
</script>
<script type="text/javascript">
var scopeRowIdx = 0,
scopeTpl = $("#scopeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),
scopeTplReadOnly = $("#scopeTplReadOnly").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
$(document).ready(function () {
var data = ${fns:toJson(adjustBill.scopeList)};
for (var i = 0; i < data.length; i++) {
if (data[i].isCanDelete != null && data[i].isCanDelete == '1') {
addRow('#scopeList', scopeRowIdx, scopeTpl, data[i]);
} else {
addRow('#scopeList', scopeRowIdx, scopeTplReadOnly, data[i]);
}
scopeRowIdx = scopeRowIdx + 1;
}
});
</script>
</div>
</div>
<div class="form-actions">
......
......@@ -38,7 +38,6 @@
<tr>
<th>业务类型编码</th>
<th>业务类型名称</th>
<th>所属集团</th>
<shiro:hasPermission name="report:ctBbtcBusType:edit"><th>操作</th></shiro:hasPermission>
</tr>
</thead>
......@@ -51,9 +50,6 @@
<td>
${ctBbtcBusType.name}
</td>
<td>
${ctBbtcBusType.groupName}
</td>
<shiro:hasPermission name="report:ctBbtcBusType:edit"><td>
<a href="${ctx}/report/ctBbtcBusType/form?id=${ctBbtcBusType.id}">修改</a>
<a href="${ctx}/report/ctBbtcBusType/delete?id=${ctBbtcBusType.id}" onclick="return confirmx('确认要删除该业务类型吗?', this.href)">删除</a>
......
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