Commit ff36183a by sunxin

需求变更

parent 5dfe46da
......@@ -21,6 +21,14 @@ public interface CrudDao<T> extends BaseDao {
* @return
*/
public T get(String id);
/**
* 跟据类型编码查询列表 是否有相同编码
* @param entity
* @return
*/
public List<T> getByNumber(T entity);
/**
* 获取单条数据
......
......@@ -84,6 +84,10 @@ public abstract class CrudService<D extends CrudDao<T>, T extends DataEntity<T>>
if (entity.getIsNewRecord()){
entity.preInsert();
List<T> byNumber = dao.getByNumber(entity);
if(byNumber.size() != 0){
throw new RuntimeException("保存失败,编码重复!!!!!!");
}
dao.insert(entity);
}else{
entity.preUpdate();
......
......@@ -23,4 +23,5 @@ public interface CtBbtcBusCategoryDao extends CrudDao<CtBbtcBusCategory> {
* @return
*/
List<CtBbtcBusCategory> getByTypeId(@Param("typeId") String typeId);
}
\ No newline at end of file
......@@ -24,4 +24,5 @@ public interface CtBbtcBusTypeDao extends CrudDao<CtBbtcBusType> {
* @return
*/
List<CtBbtcBusType> getByGroupId(@Param("groupId")String groupId);
}
\ No newline at end of file
......@@ -25,4 +25,5 @@ public interface CtBbtcRegionDao extends CrudDao<CtBbtcRegion> {
*/
List<CtBbtcRegion> getByGroupId(@Param("groupId")String groupId);
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ package com.ejweb.modules.report.service;
import java.util.List;
import com.ejweb.modules.report.entity.CtBbtcRegion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -39,7 +40,12 @@ public class CtBbtcBusCategoryService extends CrudService<CtBbtcBusCategoryDao,
@Transactional(readOnly = false)
public void save(CtBbtcBusCategory ctBbtcBusCategory) {
super.save(ctBbtcBusCategory);
try{
super.save(ctBbtcBusCategory);
}catch (RuntimeException e){
throw new RuntimeException(e.getMessage());
}
}
@Transactional(readOnly = false)
......
......@@ -49,7 +49,11 @@ public class CtBbtcBusTypeService extends CrudService<CtBbtcBusTypeDao, CtBbtcBu
@Transactional(readOnly = false)
public void save(CtBbtcBusType ctBbtcBusType) {
super.save(ctBbtcBusType);
try{
super.save(ctBbtcBusType);
}catch (RuntimeException e){
throw new RuntimeException(e.getMessage());
}
/*将可用范围存到 typearea表中*/
String[] groups = ctBbtcBusType.getGroup().split(",");
......
......@@ -41,15 +41,20 @@ public class CtBbtcRegionService extends CrudService<CtBbtcRegionDao, CtBbtcRegi
return this.ctBbtcRegionDao.getByGroupId(groupId);
}
@Transactional(readOnly = false)
public void save(CtBbtcRegion ctBbtcRegion) {
super.save(ctBbtcRegion);
try{
super.save(ctBbtcRegion);
}catch (RuntimeException e){
throw new RuntimeException(e.getMessage());
}
}
@Transactional(readOnly = false)
public void delete(CtBbtcRegion ctBbtcRegion) {
super.delete(ctBbtcRegion);
}
}
\ No newline at end of file
......@@ -144,8 +144,12 @@ public class CtBbtcBusCategoryController extends BaseController {
if (!beanValidator(model, ctBbtcBusCategory)){
return form(ctBbtcBusCategory, model);
}
ctBbtcBusCategoryService.save(ctBbtcBusCategory);
addMessage(redirectAttributes, "保存业务类别成功");
try{
ctBbtcBusCategoryService.save(ctBbtcBusCategory);
addMessage(redirectAttributes, "保存业务类别成功");
}catch (RuntimeException e){
addMessage(redirectAttributes, e.getMessage());
}
return "redirect:"+adminPath+"/report/ctBbtcBusCategory/?repage";
}
......
......@@ -92,8 +92,12 @@ public class CtBbtcBusTypeController extends BaseController {
if (!beanValidator(model, ctBbtcBusType)){
return form(ctBbtcBusType, model);
}
ctBbtcBusTypeService.save(ctBbtcBusType);
addMessage(redirectAttributes, "保存业务类型成功");
try{
ctBbtcBusTypeService.save(ctBbtcBusType);
addMessage(redirectAttributes, "保存业务类型成功");
}catch (RuntimeException e){
addMessage(redirectAttributes, e.getMessage());
}
return "redirect:"+adminPath+"/report/ctBbtcBusType/?repage";
}
......@@ -135,7 +139,7 @@ public class CtBbtcBusTypeController extends BaseController {
@RequestMapping(value = "getTypeList")
public void getRegionList(String groupId, RedirectAttributes redirectAttributes,HttpServletResponse response,String area) {
if (groupId != null && !"".equals(groupId) && area != null && !"".equals(area)) {
if (groupId != null && !"".equals(groupId)) {
JSONObject res = new JSONObject();
List<CtBbtcTypeArea> ctBbtcTypeList = ctBbtcBusTypeService.getByArea(groupId, area);
res.put("ctBbtcTypeList", ctBbtcTypeList);
......
......@@ -28,6 +28,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.ArrayList;
import java.util.List;
/**
......@@ -84,8 +85,12 @@ public class CtBbtcRegionController extends BaseController {
if (!beanValidator(model, ctBbtcRegion)){
return form(ctBbtcRegion, model);
}
ctBbtcRegionService.save(ctBbtcRegion);
addMessage(redirectAttributes, "保存区域基础资料成功");
try{
ctBbtcRegionService.save(ctBbtcRegion);
addMessage(redirectAttributes, "保存区域基础资料成功");
}catch (RuntimeException e){
addMessage(redirectAttributes, e.getMessage());
}
return "redirect:"+adminPath+"/report/ctBbtcRegion/?repage";
}
......
......@@ -1012,7 +1012,7 @@ public class ReportController extends BaseController {
if (ctBbtcBusType != null) {
SupplementTypeStr = SupplementTypeStr + ctBbtcBusType.getName() + ",";
} else {
/* SupplementTypeStr = SupplementTypeStr + "--";*/
SupplementTypeStr = SupplementTypeStr + "-";
}
}
......@@ -1027,7 +1027,7 @@ public class ReportController extends BaseController {
if (ctBbtcBusCategory != null) {
SupplementCategoryStr = SupplementCategoryStr + ctBbtcBusCategory.getName() + ",";
} else {
/* SupplementCategoryStr = SupplementCategoryStr + "--";*/
SupplementCategoryStr = SupplementCategoryStr + "-";
}
}
reportEntity1.setSupplementCategory(SupplementCategoryStr.substring(0,SupplementCategoryStr.length()-1));
......
......@@ -26,6 +26,14 @@
WHERE a.id = #{id}
</select>
<select id="getByNumber" resultType="CtBbtcBusCategory">
SELECT
<include refid="ctBbtcBusCategoryColumns"/>
FROM ct_bbtc_bus_category a
<include refid="ctBbtcBusCategoryJoins"/>
WHERE a.fnumber = #{number}
</select>
<select id="getByTypeId" resultType="CtBbtcBusCategory">
SELECT
<include refid="ctBbtcBusCategoryColumns"/>
......
......@@ -18,7 +18,14 @@
FROM ct_bbtc_bus_type
WHERE id = #{id}
</select>
<select id="getByNumber" resultType="CtBbtcBusType">
SELECT
<include refid="ctBbtcBusTypeColumns"/>
FROM ct_bbtc_bus_type
WHERE fnumber = #{number}
</select>
<select id="findList" resultType="CtBbtcBusType">
SELECT
<include refid="ctBbtcBusTypeColumns"/>
......
......@@ -22,6 +22,14 @@
WHERE a.id = #{id}
</select>
<select id="getByNumber" resultType="CtBbtcRegion">
SELECT
<include refid="ctBbtcRegionColumns"/>
FROM ct_bbtc_region a
<include refid="ctBbtcRegionJoins"/>
WHERE a.fnumber = #{number}
</select>
<select id="getByGroupId" resultType="CtBbtcRegion">
SELECT
<include refid="ctBbtcRegionColumns"/>
......
......@@ -37,8 +37,13 @@
<include refid="ctBbtcTypeAreaColumns"/>
FROM CT_BBTC_TYPE_AREA a
<include refid="ctBbtcTypeAreaJoins"/>
WHERE a.area = #{area} AND a.group_name=#{group}
<where>
a.group_name=#{group}
<if test="area != null and area != ''">
AND a.area = #{area}
</if>
</where>
GROUP BY a.parent_id
</select>
<select id="findList" resultType="com.ejweb.modules.report.entity.CtBbtcTypeArea">
......
......@@ -6,7 +6,7 @@
<meta name="decorator" content="default"/>
<script type="text/javascript">
$(document).ready(function() {
getRegion();
/*getRegion();*/
getType();
});
function page(n,s){
......@@ -60,11 +60,11 @@
selectNode.append("<option value=''>请选择</option>");
var ts_describe1= $("#supplementGroup").val();
var ts_describe2= $("#supplementArea").val();
if(ts_describe1 != null && ts_describe1 != '' && ts_describe2 != null && ts_describe2 != '' ){
/*var ts_describe2= $("#supplementArea").val();*/
if(ts_describe1 != null && ts_describe1 != ''){
$.ajax({
type: "POST",
url: "${ctx}/report/ctBbtcBusType/getTypeList?groupId="+ts_describe1+"&area="+ts_describe2,
url: "${ctx}/report/ctBbtcBusType/getTypeList?groupId="+ts_describe1,
dataType: "json",
success: function(returnedData) {
var data2 = returnedData.ctBbtcTypeList;
......@@ -105,23 +105,23 @@
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<ul class="ul-form">
<li><label>所属集团:</label>
<form:select id="supplementGroup" path="ctBbtcGroup" class="input-small required" onchange="getRegion()" cssStyle="width: 160px">
<form:select id="supplementGroup" path="ctBbtcGroup" class="input-small required" onchange="getType()" cssStyle="width: 160px">
<form:option value="">请选择</form:option>
<form:options items="${fns:getDictList('supplement_group')}" itemLabel="label" itemValue="id"
htmlEscape="false"/>
</form:select>
</li>
<li><label>所属区域:</label>
<%-- <select id="supplementArea" path="supplementArea" class="input-small required" onchange="resetPageNo();">
<%-- <li><label>所属区域:</label>
&lt;%&ndash; <select id="supplementArea" path="supplementArea" class="input-small required" onchange="resetPageNo();">
<option value="">请选择</option>
&lt;%&ndash;<options items="${ctBbtcRegionList}" itemLabel="name" itemValue="id"&ndash;%&gt;
&lt;%&ndash;htmlEscape="false"/></select>&ndash;%&gt;
</select>--%>
</select>&ndash;%&gt;
<form:select id="supplementArea" onchange="getType();" path="supplementArea" class="input-medium " cssStyle="width: 160px" htmlEscape="false">
<form:option value="">请选择</form:option>
</form:select>
</li>
</li>--%>
<li><label>业务类型:</label>
<form:select id="supplementType" onchange="resetPageNo();" path="typeName" class="input-small required" cssStyle="width: 160px">
<form:option value="">请选择</form:option>
......@@ -142,7 +142,7 @@
<th>业务类别编码</th>
<th>业务类别名称</th>
<th>所属集团</th>
<th>所属区域</th>
<%--<th>所属区域</th>--%>
<th>所属业务类型</th>
<shiro:hasPermission name="report:ctBbtcBusCategory:edit"><th>操作</th></shiro:hasPermission>
</tr>
......@@ -165,9 +165,9 @@
<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq '3770618512934949260'}">文旅集团</c:if>--%>
<c:if test="${ctBbtcBusCategory.ctBbtcGroup eq null}">--</c:if>
</td>
<td>
<%--<td>
${ctBbtcBusCategory.supplementArea}
</td>
</td>--%>
<td>
${ctBbtcBusCategory.typeName}
</td>
......
......@@ -137,7 +137,7 @@
<tr class="reportList">
<td><input type="checkbox" value="${report.id}"></td>
<td></td>
<td>${report.supplementTitle}</td>
<td> <a href="${ctx}/report/view?id=${report.id}">${report.supplementTitle}</a></td>
<td align="center">
${report.supplementGroup}
<%-- <c:if test="${user.supplementGroup eq '30590306011301372591'}">集团本部</c:if>
......
......@@ -583,7 +583,7 @@
<c:forEach items="${page.list}" var="report" varStatus="vs">
<tr class="reportList">
<td align="center" style="width:5%"></td>
<td align="left" style="width:15%" title= ${report.supplementTitle}>${report.supplementTitle}</td>
<td align="left" style="width:15%" title= ${report.supplementTitle}> <a href="${ctx}/report/view?id=${report.id}">${report.supplementTitle}</a></td>
</c:forEach>
</c:if>
......
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