Commit 0e20668534bd2becec7f9403f97485d11ece7357

Authored by pengcheng
1 parent 4b567a4b

复制角色,字典数据,菜单

src/main/java/com/huaheng/pc/config/FilterConfigHeader/service/FilterConfigHeaderService.java
... ... @@ -22,4 +22,10 @@ public class FilterConfigHeaderService extends ServiceImpl<FilterConfigHeaderMap
22 22 .eq(FilterConfigHeader::getWarehouseCode, ShiroUtils.getWarehouseCode());
23 23 return this.list(lam);
24 24 }
  25 +
  26 +
  27 + //复制规则配置
  28 + public Boolean filterConfigCopy(String code,String newCode){
  29 + return null;
  30 + }
25 31 }
... ...
src/main/java/com/huaheng/pc/config/shipmentType/config/shipmentTypeController.java renamed to src/main/java/com/huaheng/pc/config/shipmentType/controller/shipmentTypeController.java
1   -package com.huaheng.pc.config.shipmentType.config;
  1 +package com.huaheng.pc.config.shipmentType.controller;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.metadata.IPage;
... ...
src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowHeaderService.java
... ... @@ -30,4 +30,10 @@ public class StatusFlowHeaderService extends ServiceImpl<StatusFlowHeaderMapper,
30 30 .eq(StatusFlowHeader::getWarehouseCode, ShiroUtils.getWarehouseCode());
31 31 return this.list(lambda);
32 32 }
  33 +
  34 +
  35 + //复制流程
  36 + public Boolean statusFlowCopy(String code,String newCode){
  37 + return null;
  38 + }
33 39 }
... ...
src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseServiceImpl.java
... ... @@ -4,27 +4,30 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6 import com.huaheng.common.exception.service.ServiceException;
7   -import com.huaheng.pc.config.address.domain.Address;
  7 +import com.huaheng.pc.config.FilterConfigHeader.service.FilterConfigHeaderService;
8 8 import com.huaheng.pc.config.address.service.AddressService;
9   -import com.huaheng.pc.config.configValue.domain.ConfigValue;
10 9 import com.huaheng.pc.config.configValue.service.ConfigValueService;
11 10 import com.huaheng.pc.config.containerType.service.ContainerTypeService;
12   -import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference;
13 11 import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService;
14   -import com.huaheng.pc.config.locationType.domain.LocationType;
15 12 import com.huaheng.pc.config.locationType.service.LocationTypeService;
16 13 import com.huaheng.pc.config.receiptPreference.service.ReceiptPreferenceService;
17 14 import com.huaheng.pc.config.receiptType.service.ReceiptTypeService;
18   -import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference;
19 15 import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService;
20 16 import com.huaheng.pc.config.shipmentType.service.ShipmentTypeService;
  17 +import com.huaheng.pc.config.statusFlow.service.StatusFlowHeaderService;
21 18 import com.huaheng.pc.config.warehouse.domain.Warehouse;
22 19 import com.huaheng.pc.config.warehouse.mapper.WarehouseMapper;
23 20 import com.huaheng.pc.config.warehouseCompany.domain.WarehouseCompany;
24 21 import com.huaheng.pc.config.warehouseCompany.service.WarehouseCompanyService;
  22 +import com.huaheng.pc.config.waveMaster.service.WaveMasterService;
  23 +import com.huaheng.pc.shipment.wave.service.WaveService;
  24 +import com.huaheng.pc.system.dict.service.IDictTypeService;
  25 +import com.huaheng.pc.system.menu.service.IMenuService;
  26 +import com.huaheng.pc.system.menu.service.MenuServiceImpl;
  27 +import com.huaheng.pc.system.role.service.IRoleService;
  28 +import org.springframework.beans.factory.annotation.Autowired;
25 29 import org.springframework.stereotype.Service;
26 30 import org.springframework.transaction.annotation.Transactional;
27   -import sun.util.resources.cldr.ext.CurrencyNames_rof;
28 31  
29 32 import javax.annotation.Resource;
30 33 import java.util.List;
... ... @@ -55,6 +58,18 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse
55 58 private WarehouseMapper warehouseMapper;
56 59 @Resource
57 60 private WarehouseCompanyService warehouseCompanyService;
  61 + @Autowired
  62 + private IRoleService roleService;
  63 + @Autowired
  64 + private IDictTypeService dictTypeService;
  65 + @Autowired
  66 + private IMenuService menuService;
  67 + @Autowired
  68 + private FilterConfigHeaderService filterConfigHeaderService;
  69 + @Autowired
  70 + private StatusFlowHeaderService statusFlowHeaderService;
  71 + @Autowired
  72 + private WaveMasterService waveMasterService;
58 73  
59 74 @Override
60 75 public List<Map<String, Object>> getWarehouseList(Integer id) {
... ... @@ -122,26 +137,54 @@ public class WarehouseServiceImpl extends ServiceImpl&lt;WarehouseMapper, Warehouse
122 137 if (!containerTypeService.containerTypeCopy(warehouseCode, newWarehouseCode)){
123 138 throw new ServiceException("复制容器类型表失败");
124 139 }
125   - /* 复制盘点首选项表*/
126   - if (!cycleCountPreferenceService.cycleCountPreferenceCopy(warehouseCode, newWarehouseCode)){
127   - throw new ServiceException("复制盘点首选项表失败");
128   - }
129 140 /* 复制库位类型表*/
130 141 if (!locationTypeService.locationTypeCopy(warehouseCode, newWarehouseCode)){
131 142 throw new ServiceException("复制库位类型表失败");
132 143 }
  144 + /* 复制盘点首选项表*/
  145 + if (!cycleCountPreferenceService.cycleCountPreferenceCopy(warehouseCode, newWarehouseCode)){
  146 + throw new ServiceException("复制盘点首选项表失败");
  147 + }
  148 + /* 复制入库首选项*/
133 149 if (!receiptPreferenceService.receiptPreferenceCopy(warehouseCode, newWarehouseCode)){
134 150 throw new ServiceException("复制入库首选项表失败");
135 151 }
136   - if (!receiptTypeService.receiptTypeCopy(warehouseCode, newWarehouseCode)){
137   - throw new ServiceException("复制入库类型表失败");
138   - }
  152 + /* 复制出库首选项*/
139 153 if (!shipmentPreferenceService.shipmentPreferenceCopy(warehouseCode, newWarehouseCode)){
140 154 throw new ServiceException("复制出库首选项表失败");
141 155 }
  156 + /* 复制入库类型*/
  157 + if (!receiptTypeService.receiptTypeCopy(warehouseCode, newWarehouseCode)){
  158 + throw new ServiceException("复制入库类型表失败");
  159 + }
  160 + /* 复制出库类型*/
142 161 if (!shipmentTypeService.ShipmentTypeCopy(warehouseCode, newWarehouseCode)){
143 162 throw new ServiceException("复制出库类型表失败");
144 163 }
  164 + /* 复制角色*/
  165 + if (!roleService.roleCopy(warehouseCode, newWarehouseCode)){
  166 + throw new ServiceException("复制角色表失败");
  167 + }
  168 + /* 复制字典数据*/
  169 + if (!dictTypeService.dictTypeCopy(warehouseCode, newWarehouseCode)){
  170 + throw new ServiceException("复制字典数据表失败");
  171 + }
  172 + /* 复制菜单*/
  173 + if (!menuService.menuCopy(warehouseCode, newWarehouseCode)){
  174 + throw new ServiceException("复制菜单表失败");
  175 + }
  176 + /* 复制流程*/
  177 + if (!statusFlowHeaderService.statusFlowCopy(warehouseCode, newWarehouseCode)){
  178 + throw new ServiceException("复制流程表失败");
  179 + }
  180 + /* 复制规则配置*/
  181 + if (!filterConfigHeaderService.filterConfigCopy(warehouseCode, newWarehouseCode)){
  182 + throw new ServiceException("复制规则配置表失败");
  183 + }
  184 + /* 复制波次配置*/
  185 + if (!waveMasterService.waveMasterCopy(warehouseCode, newWarehouseCode)){
  186 + throw new ServiceException("复制波次配置表失败");
  187 + }
145 188 return true;
146 189 }
147 190 }
... ...
src/main/java/com/huaheng/pc/config/waveMaster/service/WaveMasterService.java
... ... @@ -8,4 +8,9 @@ import org.springframework.stereotype.Service;
8 8 @Service
9 9 public class WaveMasterService extends ServiceImpl<WaveMasterMapper, WaveMaster> {
10 10  
  11 + //复制波次配置
  12 + public Boolean waveMasterCopy(String code,String newCode){
  13 + return null;
  14 + }
  15 +
11 16 }
... ...
src/main/java/com/huaheng/pc/system/dict/mapper/DictDataMapper.java
... ... @@ -115,4 +115,10 @@ public interface DictDataMapper
115 115  
116 116 DictData selectModel(DictData dictData);
117 117  
  118 + //复制字典明细数据
  119 + int dictDateCopy(@Param("code")String code, @Param("newCode")String newCode);
  120 +
  121 +
  122 + //修改复制明细的父ID
  123 + int updateHeaderId(@Param("code")String code);
118 124 }
... ...
src/main/java/com/huaheng/pc/system/dict/mapper/DictTypeMapper.java
... ... @@ -94,4 +94,8 @@ public interface DictTypeMapper
94 94  
95 95 public int insertDictTypes(@Param("dictTypes") List<DictType> dictTypes);
96 96  
  97 +
  98 + //先复制字典主表数据
  99 + int dictTypeCopy(@Param("code")String code, @Param("newCode")String newCode);
  100 +
97 101 }
... ...
src/main/java/com/huaheng/pc/system/dict/service/DictTypeServiceImpl.java
1 1 package com.huaheng.pc.system.dict.service;
2 2  
  3 +import com.huaheng.common.exception.service.ServiceException;
3 4 import org.apache.ibatis.annotations.Param;
4 5 import org.springframework.beans.factory.annotation.Autowired;
5 6 import org.springframework.stereotype.Service;
... ... @@ -176,4 +177,26 @@ public class DictTypeServiceImpl implements IDictTypeService
176 177  
177 178 return dictTypeMapper.insertDictTypes(dictTypeList);
178 179 }
  180 +
  181 + //复制字典数据
  182 + @Override
  183 + public Boolean dictTypeCopy(String code, String newCode) {
  184 + int i = 0;
  185 + //1、先复制字典主表数据
  186 + i = dictTypeMapper.dictTypeCopy(code,newCode);
  187 + if(i < 1){
  188 + throw new ServiceException("复制字典主表失败");
  189 + }
  190 + //2、复制字典明细数据
  191 + i = dictDataMapper.dictDateCopy(code,newCode);
  192 + if(i < 1){
  193 + throw new ServiceException("复制字典明细失败");
  194 + }
  195 + //3、修改复制明细的父ID
  196 + i = dictDataMapper.updateHeaderId(newCode);
  197 + if(i < 1){
  198 + throw new ServiceException("修改字典明细失败");
  199 + }
  200 + return null;
  201 + }
179 202 }
... ...
src/main/java/com/huaheng/pc/system/dict/service/IDictTypeService.java
... ... @@ -96,4 +96,7 @@ public interface IDictTypeService
96 96  
97 97  
98 98 public int insertDictTypes(List<DictType> dictTypes);
  99 +
  100 + //复制字典数据
  101 + Boolean dictTypeCopy(String code,String newCode);
99 102 }
... ...
src/main/java/com/huaheng/pc/system/menu/service/IMenuService.java
... ... @@ -138,4 +138,8 @@ public interface IMenuService
138 138 * @return 菜单列表
139 139 */
140 140 List<Menu> selectMobileMenusByUserId(Integer userId);
  141 +
  142 +
  143 + //复制菜单
  144 + Boolean menuCopy(String code,String newCode);
141 145 }
... ...
src/main/java/com/huaheng/pc/system/menu/service/MenuServiceImpl.java
... ... @@ -354,5 +354,11 @@ public class MenuServiceImpl implements IMenuService
354 354 return menus;
355 355 }
356 356  
  357 + //复制菜单
  358 + @Override
  359 + public Boolean menuCopy(String code, String newCode) {
  360 + return null;
  361 + }
  362 +
357 363  
358 364 }
... ...
src/main/java/com/huaheng/pc/system/role/mapper/RoleMapper.java
... ... @@ -91,4 +91,7 @@ public interface RoleMapper
91 91 */
92 92 public Role checkroleCodeUnique(@Param("warehouseCode") String warehouseCode, @Param("roleCode") String roleCode);
93 93  
  94 +
  95 + public int roleCopy(@Param("code")String code, @Param("newCode")String newCode);
  96 +
94 97 }
... ...
src/main/java/com/huaheng/pc/system/role/service/IRoleService.java
... ... @@ -108,4 +108,8 @@ public interface IRoleService
108 108 */
109 109 public int countUserRoleByRoleId(Integer id);
110 110  
  111 +
  112 + //复制角色
  113 + Boolean roleCopy(String code,String newCode);
  114 +
111 115 }
... ...
src/main/java/com/huaheng/pc/system/role/service/RoleServiceImpl.java
... ... @@ -259,4 +259,15 @@ public class RoleServiceImpl implements IRoleService
259 259 return userRoleMapper.countUserRoleByRoleId(id);
260 260 }
261 261  
  262 +
  263 + //复制角色
  264 + @Override
  265 + public Boolean roleCopy(String code, String newCode) {
  266 + int i = roleMapper.roleCopy(code,newCode);
  267 + if(i > 0){
  268 + return true;
  269 + }
  270 + return false;
  271 + }
  272 +
262 273 }
... ...
src/main/resources/mybatis/system/DictDataMapper.xml
... ... @@ -205,4 +205,18 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
205 205 limit 1
206 206 </select>
207 207  
  208 + <insert id="dictDateCopy">
  209 + insert into sys_dict_data(warehouseCode,dictSort,dictLabel,dictValue,dictType,cssClass,listClass,isDefault,enable,deleted,remark)
  210 + SELECT #{newCode},dictSort,dictLabel,dictValue,dictType,cssClass,listClass,isDefault,enable,deleted,remark from sys_dict_data
  211 + where warehouseCode = {code}
  212 +
  213 + </insert>
  214 +
  215 + <update id="updateHeaderId">
  216 + update sys_dict_data d
  217 + inner join sys_dict_type t
  218 + on t.dictType=d.dictType and d.warehouseCode=t.warehouseCode and d.warehouseCode=#{code}
  219 + set d.headerId=t.id
  220 + </update>
  221 +
208 222 </mapper>
209 223 \ No newline at end of file
... ...
src/main/resources/mybatis/system/DictTypeMapper.xml
... ... @@ -141,5 +141,12 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
141 141 )
142 142 </foreach>
143 143 </insert>
  144 +
  145 + <insert id="dictTypeCopy">
  146 + insert into sys_dict_type(warehouseCode,dictName,dictType,enable,deleted,remark)
  147 + select #{newCode},dictName,dictType,enable,deleted,remark from sys_dict_type
  148 + where warehouseCode=#{code}
  149 +
  150 + </insert>
144 151  
145 152 </mapper>
146 153 \ No newline at end of file
... ...
src/main/resources/mybatis/system/RoleMapper.xml
... ... @@ -124,5 +124,10 @@
124 124 sysdate()
125 125 )
126 126 </insert>
  127 +
  128 + <insert id="roleCopy">
  129 + insert into sys_role(roleName,roleCode,roleSort,warehouseCode,enable,remark)
  130 + select roleName,roleCode,roleSort,#{newCode},enable,remark from sys_role where warehouseCode=#{code}
  131 + </insert>
127 132  
128 133 </mapper>
129 134 \ No newline at end of file
... ...
src/main/resources/templates/config/shipmentType/add.html
... ... @@ -4,7 +4,7 @@
4 4 <head th:include="include :: header"></head>
5 5 <body class="white-bg">
6 6 <div class="wrapper wrapper-content animated fadeInRight ibox-content">
7   - <form class="form-horizontal m" id="form-receiptType-add">
  7 + <form class="form-horizontal m" id="form-shipmentType-add">
8 8 <div class="form-group">
9 9 <label class="col-sm-3 control-label">编码:</label>
10 10 <div class="col-sm-8">
... ... @@ -46,7 +46,7 @@
46 46 <div class="form-group">
47 47 <label class="col-sm-3 control-label">出库流程:</label>
48 48 <div class="col-sm-8">
49   - <select id="receiptFlow" name="shipmentFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList()}">
  49 + <select id="shipmentFlow" name="shipmentFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('shippingFlow')}">
50 50 <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
51 51 </select>
52 52 </div>
... ... @@ -153,7 +153,7 @@
153 153 <div th:include="include::footer"></div>
154 154 <script type="text/javascript">
155 155 var prefix = ctx + "config/shipmentType";
156   - $("#form-receiptType-add").validate({
  156 + $("#form-shipmentType-add").validate({
157 157 rules:{
158 158 code:{
159 159 required:true,
... ... @@ -167,7 +167,7 @@
167 167 },
168 168 submitHandler: function(form) {
169 169 // $.operate.save(prefix + "/add", $('#form-locationType-add').serialize());
170   - var tableValue = $.common.getTableValue("#form-receiptType-add");
  170 + var tableValue = $.common.getTableValue("#form-shipmentType-add");
171 171 tableValue = formValueReplace(tableValue, "companyCode", $("#companyCode option:selected").val());
172 172 tableValue = formValueReplace(tableValue, "shipmentFlow", $("#shipmentFlow option:selected").val());
173 173 tableValue = formValueReplace(tableValue, "enable", $("input[name='enable']").is(':checked'));
... ...
src/main/resources/templates/config/shipmentType/edit.html
... ... @@ -155,7 +155,7 @@
155 155 <div th:include="include::footer"></div>
156 156 <script type="text/javascript">
157 157 var prefix = ctx + "config/shipmentType";
158   - $("#form-receiptType-edit").validate({
  158 + $("#form-shipmentType-edit").validate({
159 159 rules:{
160 160 code:{
161 161 required:true,
... ...