Browse Source

添加入库申请仓库添加功能

lwx_dev
erdanergou 3 years ago
parent
commit
d19682b5ed
  1. 4
      src/main/java/com/dreamchaser/depository_manage/config/QyWxConfig.java
  2. 20
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  3. 32
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  4. 36
      src/main/java/com/dreamchaser/depository_manage/controller/UserController.java
  5. 10
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java
  6. 13
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  7. 91
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  8. 64
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  9. 38
      src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java
  10. 2
      src/main/resources/templates/pages/application/application-in.html
  11. 51
      src/main/resources/templates/pages/user/table-user.html
  12. 12
      src/main/resources/templates/pages/user/user-add.html
  13. 247
      src/main/resources/templates/pages/user/user-email.html
  14. 17
      src/main/resources/templates/pages/user/user-role-edit.html
  15. 14
      src/main/resources/templates/pages/user/userRole.html
  16. 204
      src/main/resources/templates/pages/user/userRoleForIn.html
  17. 5
      src/test/java/com/dreamchaser/depository_manage/TestOther.java

4
src/main/java/com/dreamchaser/depository_manage/config/QyWxConfig.java

@ -55,8 +55,8 @@ public class QyWxConfig {
// 企业微信库存盘点审批模板Id
public static String stockTaking_approval_template_id = "C4RbNbd7KYKHGXimVTc5rkNdVWT92JURzoU4KTgbw";
// 企业微信库审批模板Id
public static String isTrue_out_approval_template_id = "3WKiKVEcnH2dsARvP18hwkApF1Ku5dbNd7txbZCS";
// 企业微信库审批模板Id
public static String in_approval_template_id = "3WKiKVEcnH2dsARvP18hwkApF1Ku5dbNd7txbZCS";
// 用于jsapi的url

20
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -188,6 +188,9 @@ public class DepositoryRecordController {
Integer integer = 0;
map.put("applicantId", userToken.getId());
Map<String, Object> result = new HashMap<>();
// 定义列表用于储存入库单id
List<Integer> recordIds = new ArrayList<>();
if (params.size() < 1 && map.size() > 3) {
String unit = (String) (map.get("unit"));
if (!"-1".equals(unit)) {
@ -195,6 +198,7 @@ public class DepositoryRecordController {
Integer addSplitInventory = splitUnitService.addSplitInventory(map);
if (addSplitInventory != -1) {
integer += addSplitInventory;
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId")));
}
} else {
// 获取库位id
@ -202,18 +206,20 @@ public class DepositoryRecordController {
if (placeId == 0) {// 如果插入到仓库
map.put("placeId", 0); // 到默认库位
integer += depositoryRecordService.applicationInPlace(map);
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId")));
} else { // 如果具体到库位
Integer flag = depositoryRecordService.applicationInPlace(map);
if (flag != -1) {
integer += flag;
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId")));
}
}
}
} else {
List<Object> errMsg = new ArrayList<>();
List<Object> successMsg = new ArrayList<>();
for (int i = 0; i < params.size(); i++) {
Integer temp = ObjectFormatUtil.toInteger(params.get(i));
for (Integer param : params) {
Integer temp = ObjectFormatUtil.toInteger(param);
Map<String, Object> insert = new HashMap<>();
Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId" + temp));
insert.put("applicantId", userToken.getId());
@ -233,6 +239,7 @@ public class DepositoryRecordController {
Integer addSplitInventory = splitUnitService.addSplitInventory(insert);
if (addSplitInventory != -1) {
integer += addSplitInventory;
recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId")));
successMsg.add(insert);
} else {
errMsg.add(insert);
@ -246,6 +253,8 @@ public class DepositoryRecordController {
} else {
integer += add;
successMsg.add(insert);
recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId")));
}
} else {// 如果具体到库位
insert.put("placeId", placeId);
@ -255,6 +264,8 @@ public class DepositoryRecordController {
errMsg.add(insert);
} else {
integer += flag;
recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId")));
}
}
}
@ -266,6 +277,7 @@ public class DepositoryRecordController {
if (addSplitInventory != -1) {
integer += addSplitInventory;
successMsg.add(map);
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId")));
} else {
errMsg.add(map);
}
@ -280,6 +292,8 @@ public class DepositoryRecordController {
} else {
integer += add;
successMsg.add(map);
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId")));
}
} else { // 如果具体到库位
Integer flag = depositoryRecordService.applicationInPlace(map);
@ -288,6 +302,7 @@ public class DepositoryRecordController {
errMsg.add(map);
} else {
integer += flag;
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId")));
}
}
}
@ -295,6 +310,7 @@ public class DepositoryRecordController {
result.put("err", errMsg);
result.put("success", successMsg);
}
if (integer != 0 && params.size() < 1 && integer != -1) {
return CrudUtil.postHandle(integer, 1);
} else if (integer != 0 && params.size() > 0) {

32
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -807,7 +807,6 @@ public class PageController {
mv.setViewName("pages/user/table-user");
List<AdministrationP> administrationPList = findAllCompany(userToken);
mv.addObject("administrationPList", administrationPList);
mv.addObject("users", userService.findUserPsByCondition(new HashMap<>()));
return mv;
}
@ -1052,14 +1051,14 @@ public class PageController {
@GetMapping("/user_add")
public ModelAndView user_add(Integer userId, HttpServletRequest request) {
public ModelAndView user_add(Integer userId,Integer classes, HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/user/user-add");
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userToken);
UserByPortP userByPortP = new UserByPortP(userByPort);
mv.addObject("userByPort", userByPortP);
mv.addObject("depositories", depositoryService.findDepositoryAll());
mv.addObject("classes", classes);
return mv;
}
@ -1078,7 +1077,6 @@ public class PageController {
mv.addObject("userByPort", userByPortP);
mv.addObject("roleId", roleAndDepositoryById.getId());
mv.addObject("depositoryId", roleAndDepositoryById.getDepositoryId());
mv.addObject("depositories", depositoryService.findDepositoryAll());
return mv;
}
@ -1240,6 +1238,11 @@ public class PageController {
return mv;
}
/**
* 用于跳转到仓库管理员
* @param id
* @return
*/
@GetMapping("/userRoleView")
public ModelAndView finduserRoleView(Integer id) {
ModelAndView mv = new ModelAndView();
@ -1248,6 +1251,19 @@ public class PageController {
return mv;
}
/**
* 用于跳转到入库申请审核时的赋权
* @param id
* @return
*/
@GetMapping("/userRoleInView")
public ModelAndView finduserRoleInView(Integer id) {
ModelAndView mv = new ModelAndView();
mv.addObject("userId", id);
mv.setViewName("pages/user/userRoleForIn");
return mv;
}
@GetMapping("/postRoleView")
public ModelAndView findPostRoleView(Integer id) {
ModelAndView mv = new ModelAndView();
@ -1864,14 +1880,6 @@ public class PageController {
return mv;
}
@GetMapping("/user_email")
public ModelAndView user_email(HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/user/user-email");
UserToken userToken = (UserToken) request.getAttribute("userToken");
mv.addObject("email", userToken.getUser().getEmail());
return mv;
}
public List<AdministrationP> findAllCompany(UserByPort userByPort) {

36
src/main/java/com/dreamchaser/depository_manage/controller/UserController.java

@ -287,16 +287,14 @@ public class UserController {
* @return
*/
/**
* {id: "4323", authority: "1", depositoryId: "20"}
* @param map
* @return
*/
@PostMapping("/sys/user_role")
public RestResponse addUser(@RequestBody Map<String, Object> map) {
map.put("classes",1);
Map<String,Object> param = new HashMap<>();
param.put("userId",map.get("userid"));
param.put("classes",1);
param.put("classes",map.get("classes"));
if(map.containsKey("depositoryId")){
param.put("depositoryId",map.get("depositoryId"));
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param);
@ -308,14 +306,12 @@ public class UserController {
}else{
List<Depository> depositoryAll = depositoryService.findDepositoryAll();
Integer success = 0;
for (int i = 0; i < depositoryAll.size(); i++) {
param.put("depositoryId",depositoryAll.get(i).getId());
map.put("depositoryId",depositoryAll.get(i).getId());
for (Depository depository : depositoryAll) {
param.put("depositoryId", depository.getId());
map.put("depositoryId", depository.getId());
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param);
if(roleAndDepositoryByCondition.size() > 0){
continue;
}else{
success += roleService.addUserOrPostRoleAndDepository(map);
if (roleAndDepositoryByCondition.size() <= 0) {
success += roleService.addUserOrPostRoleAndDepository(map);
}
}
return CrudUtil.postHandle(success,depositoryAll.size());
@ -325,8 +321,6 @@ public class UserController {
@PostMapping("/sys/userRole_edit")
public RestResponse editUserRole(@RequestBody Map<String, Object> map) {
RoleAndDepository roleId = roleService.findRoleAndDepositoryById(ObjectFormatUtil.toInteger(map.get("roleId")));
map.put("classes",1);
return CrudUtil.postHandle(roleService.UpdateRoleAndDepositoryById(map),1);
}
@ -478,18 +472,15 @@ public class UserController {
}
@GetMapping("/findUserRole")
public RestResponse findUserRole(@RequestParam("userId") Integer userId,HttpServletRequest request){
Map<String,Object> param = new HashMap<>();
public RestResponse findUserRole(@RequestParam Map<String,Object> map,HttpServletRequest request){
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
param.put("classes",1);
param.put("userId",userId);
List<UserByPortP> userByPortPList = new ArrayList<>();
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param);
for (int i = 0; i < roleAndDepositoryByCondition.size(); i++) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepositoryByCondition.get(i).getUserId(),userToken);
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(map);
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepository.getUserId(), userToken);
UserByPortP up = new UserByPortP(userByPort);
up.setId(roleAndDepositoryByCondition.get(i).getId());
up.setDepositoryName(roleAndDepositoryByCondition.get(i).getDepositoryName());
up.setId(roleAndDepository.getId());
up.setDepositoryName(roleAndDepository.getDepositoryName());
userByPortPList.add(up);
}
return new RestResponse(userByPortPList, userByPortPList.size(), 200);
@ -497,4 +488,7 @@ public class UserController {
}

10
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java

@ -74,6 +74,13 @@ public interface DepositoryRecordMapper {
* @return
*/
List<ApplicationInRecordP> findApplicationInRecordPAll();
/**
* 根据主键id列表获取入库订单列表
* @param ids
* @return
*/
List<ApplicationInRecordP> findApplicationInRecordsByIds(List<Integer> ids);
/**
* 查找所有入库记录
* @return
@ -176,6 +183,9 @@ public interface DepositoryRecordMapper {
*/
Integer findApplicationInRecordByDate(Map<String,Object> map);
/**
* 获取一段时间内的出库额度
*

13
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -622,6 +622,19 @@
from applicationInRecordInfo
</select>
<select id="findApplicationInRecordsByIds" resultMap="applicationInRecord" parameterType="list">
select
<include refid="ApplicationInRecordInfo"/>
from applicationInRecordInfo
where 1 = 1
and air in
<foreach collection="list" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="findApplicationInRecordPByDepositoryList" resultMap="applicationInRecord" parameterType="list">
select

91
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -631,12 +631,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Integer newInMid = ObjectFormatUtil.toInteger(map.get("newInMid"));
// 获取当前入库记录id
Integer InId = ObjectFormatUtil.toInteger(map.get("id"));
map.put("applicationInId",map.get("id"));
Map<String, Object> insertProducedDate = new HashMap<>();
insertProducedDate.put("inid", InId);
insertProducedDate.put("mid", newInMid);
if (map.containsKey("producedDate")) {
Long producedDate = 0L;
long producedDate = 0L;
Object s = map.get("producedDate");
if (s == null || "".equals(s.toString())) {
producedDate = 0L;
@ -1852,34 +1852,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}).start();
}
/*for (Integer integer : depositoryIdList) {
Object o = minIdByDepository.get("depository" + integer);
if (o != null) {
List<Integer> minIdList = (List<Integer>) o;
List<Integer> userIdByDid = roleService.findUserIdByDid(integer);
StringBuilder QyWxUid = new StringBuilder();
for (Integer value : userIdByDid) {
UserByPort manager = LinkInterfaceUtil.FindUserById(value, userByPort);
// QyWxUid.append(manager.getWorkwechat()+",");
}
QyWxUid.append("PangFuZhen,");
// 根据仓库向仓库管理员发送审批
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplateOut(userAgent, userByPort, ObjectFormatUtil.toInteger(mainId), minIdList, QyWxUid.toString());
String sp_no = jsonObject.getString("sp_no");
Map<String, Object> QyWxApprovalMap = new HashMap<>();
StringBuilder sb = new StringBuilder();
for (int j = 0; j < minIdList.size(); j++) {
sb.append(minIdList.get(j)).append(",");
}
QyWxApprovalMap.put("sp_no", sp_no);
QyWxApprovalMap.put("minIdList", sb.toString());
redisTemplate.opsForHash().putAll("wms_out_" + recordP.getId(), QyWxApprovalMap);
// 设置过期时间为7天
redisTemplate.expire("wms_out_" + recordP.getId(), 7, TimeUnit.DAYS);
} else {
continue;
}
}*/
// 将主订单插入到redis中
redisTemplate.opsForHash().put("record:" + recordP.getId(), "minRecord", minRecordByMain.toString());
@ -2314,34 +2286,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/*for (int i = 0; i < depositoryIdList.size(); i++) {
Object o = minIdByDepository.get("depository" + depositoryIdList.get(i));
if (o != null) {
List<Integer> minIdList = (List<Integer>) o;
List<Integer> userIdByDid = roleService.findUserIdByDid(depositoryIdList.get(i));
StringBuilder QyWxUid = new StringBuilder();
for (int j = 0; j < userIdByDid.size(); j++) {
UserByPort manager = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), userToken);
// QyWxUid.append(manager.getWorkwechat()+",");
}
QyWxUid.append("PangFuZhen,");
// 根据仓库向仓库管理员发送审批
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplateOut(userAgent, userToken, ObjectFormatUtil.toInteger(id), minIdList, QyWxUid.toString());
String sp_no = jsonObject.getString("sp_no");
Map<String, Object> QyWxApprovalMap = new HashMap<>();
StringBuilder sb = new StringBuilder();
for (int j = 0; j < minIdList.size(); j++) {
sb.append(minIdList.get(j)).append(",");
}
QyWxApprovalMap.put("sp_no", sp_no);
QyWxApprovalMap.put("minIdList", sb.toString());
redisTemplate.opsForHash().putAll("wms_out_" + record.getId(), QyWxApprovalMap);
// 设置过期时间为7天
redisTemplate.expire("wms_out_" + record.getId(), 7, TimeUnit.DAYS);
} else {
continue;
}
}*/
// 开启流程通知其他人忽略审批流程
new Thread(new Runnable() {
@ -2562,34 +2506,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}).start();
}
for (int i = 0; i < depositoryIdList.size(); i++) {
Object o = minIdByDepository.get("depository" + depositoryIdList.get(i));
if (o != null) {
List<Integer> minIdList = (List<Integer>) o;
List<Integer> userIdByDid = roleService.findUserIdByDid(depositoryIdList.get(i));
StringBuilder QyWxUid = new StringBuilder();
for (int j = 0; j < userIdByDid.size(); j++) {
UserByPort manager = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), userByPort);
// QyWxUid.append(manager.getWorkwechat()+",");
}
QyWxUid.append("PangFuZhen,");
// 根据仓库向仓库管理员发送审批
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplateOut(userAgent, userByPort, ObjectFormatUtil.toInteger(outId), minIdList, QyWxUid.toString());
String sp_no = jsonObject.getString("sp_no");
Map<String, Object> QyWxApprovalMap = new HashMap<>();
StringBuilder sb = new StringBuilder();
for (int j = 0; j < minIdList.size(); j++) {
sb.append(minIdList.get(j)).append(",");
}
QyWxApprovalMap.put("sp_no", sp_no);
QyWxApprovalMap.put("minIdList", sb.toString());
redisTemplate.opsForHash().putAll("wms_out_" + recordP.getId(), QyWxApprovalMap);
// 设置过期时间为7天
redisTemplate.expire("wms_out_" + recordP.getId(), 7, TimeUnit.DAYS);
} else {
continue;
}
}
// 将主订单插入到redis中
redisTemplate.opsForHash().put("record:" + recordP.getId(), "minRecord", minRecordByMain.toString());
map.put("state", "仓储中心负责人审核通过");
@ -2797,6 +2713,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, placeAndMaterial.getId(), map, quantity, splitInfo);
} else {
applicationInPlace(map);
map.put("applicationInId",map.get("id"));
map.remove("id");
}
@ -2874,6 +2791,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, placeAndMaterial.getId(), map, quantity, splitInfo);
} else {
applicationInPlace(map);
map.put("applicationInId",map.get("id"));
map.remove("id");
}
@ -3032,6 +2950,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, ObjectFormatUtil.toInteger(insertForMaterialAndPlace.get("id")), map, quantity, splitInfo);
} else {
applicationInPlace(map);
map.put("applicationInId",map.get("id"));
map.remove("id");
}

64
src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java

@ -8,10 +8,11 @@ import com.dreamchaser.depository_manage.config.QyWxConfig;
import com.dreamchaser.depository_manage.config.QyWx_approval_template.*;
import com.dreamchaser.depository_manage.config.QyWx_template_card.*;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.exception.MyException;
import com.dreamchaser.depository_manage.mapper.*;
import com.dreamchaser.depository_manage.pojo.ApplicationInRecordP;
import com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP;
import com.dreamchaser.depository_manage.pojo.StockTakingChildP;
import com.dreamchaser.depository_manage.service.NoticeService;
import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
@ -1792,28 +1793,28 @@ public class QyWxOperationService {
/**
* 用于发送库审批
* 用于发送库审批
*
* @param userAgent 加密后的userAgent
* @param userToken 审批人
* @param mainId 主订单
* @param minIdList 出库的列表
* @param recordIdList 入库id列表
* @param QyWxUid 接收人
* @return
*/
public JSONObject sendOutApprovalTemplateOut(String userAgent, UserByPort userToken, Integer mainId, List<Integer> minIdList, String QyWxUid) {
public JSONObject sendApprovalTemplateIn(String userAgent, UserByPort userToken, List<Integer> recordIdList, String QyWxUid) {
// 获取当前出库主订单
ApplicationOutRecordP mainRecord = depositoryRecordMapper.findApplicationOutRecordPById(mainId);
// 获取当前出库明细
List<ApplicationOutRecordMin> minRecordList = depositoryRecordMapper.findApplicationOutMinByIds(minIdList);
List<ApplicationInRecordP> minRecordList = depositoryRecordMapper.findApplicationInRecordsByIds(recordIdList);
if(minRecordList.size() <= 0){
throw new MyException("参数错误");
}
// 定义审批模板
ApprovalTemplate approvalTemplate = new ApprovalTemplate();
// 获取申请人的userId
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mainRecord.getApplicantId(), null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(minRecordList.get(0).getApplicantId(), null);
String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat();
@ -1823,7 +1824,7 @@ public class QyWxOperationService {
approvalTemplate.setCreator_userid(workwechat);
// 设置模板id
approvalTemplate.setTemplate_id(QyWxConfig.isTrue_out_approval_template_id);
approvalTemplate.setTemplate_id(QyWxConfig.in_approval_template_id);
// 设置审批人模式为在自定义流程
approvalTemplate.setUse_template_approver(0);
@ -1836,6 +1837,9 @@ public class QyWxOperationService {
List<String> userIdList = new ArrayList<>();
String[] split = QyWxUid.split(",");
for (String value : split) {
if("".equals(value)){
continue;
}
userIdList.add(value);
}
approval_template_approver.setUserid(userIdList);
@ -1877,7 +1881,7 @@ public class QyWxOperationService {
Map<String, Object> members_time = new HashMap<>();
Map<String, String> contact_time = new HashMap<>();
contact_time.put("type", "hour");
contact_time.put("s_timestamp", String.valueOf(Long.valueOf(mainRecord.getApplicantTime()) / 1000));
contact_time.put("s_timestamp", String.valueOf(Long.parseLong(minRecordList.get(0).getApplicantTime()) / 1000));
members_time.put("date", contact_time);
approval_template_apply_data_contents_time.setValue(members_time);
@ -1913,12 +1917,10 @@ public class QyWxOperationService {
approval_template_apply_data_contents_info.setId("Table-1668220735636");
// 定义明细列表
List<Object> contents_detail = new ArrayList<>();
for (ApplicationOutRecordMin recordMin : minRecordList) {
for (ApplicationInRecordP recordMin : minRecordList) {
// 获取明细信息
// 获取当前出库物料
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid());
// 获取当前物料所在仓库
Depository depositoryById = depositoryMapper.findDepositoryById(recordMin.getDepositoryId());
Map<String, Object> detail_list = new HashMap<>();
@ -1960,20 +1962,20 @@ public class QyWxOperationService {
detail_list_control_info_materialCode.put("value", detail_list_control_info_value_Code);
// 请求数量
Map<String, Object> detail_list_control_info_outNumber = new HashMap<>();
detail_list_control_info_outNumber.put("control", "Number");
detail_list_control_info_outNumber.put("id", "Number-1668220772222");
Map<String, String> detail_list_control_info_title_outNumber = new HashMap<>();
detail_list_control_info_title_outNumber.put("text", "数量");
detail_list_control_info_title_outNumber.put("lang", "zh_CN");
Map<String, Object> detail_list_control_info_inNumber = new HashMap<>();
detail_list_control_info_inNumber.put("control", "Number");
detail_list_control_info_inNumber.put("id", "Number-1668220772222");
Map<String, String> detail_list_control_info_title_inNumber = new HashMap<>();
detail_list_control_info_title_inNumber.put("text", "数量");
detail_list_control_info_title_inNumber.put("lang", "zh_CN");
List<Object> detail_list_control_info_title_list_outNumber = new ArrayList<>();
detail_list_control_info_title_list_outNumber.add(detail_list_control_info_title_outNumber);
detail_list_control_info_outNumber.put("title", detail_list_control_info_title_list_outNumber);
List<Object> detail_list_control_info_title_list_inNumber = new ArrayList<>();
detail_list_control_info_title_list_inNumber.add(detail_list_control_info_title_inNumber);
detail_list_control_info_inNumber.put("title", detail_list_control_info_title_list_inNumber);
Map<String, String> detail_list_control_info_value_outNumber = new HashMap<>();
detail_list_control_info_value_outNumber.put("new_number", recordMin.getQuantity().toString());
detail_list_control_info_outNumber.put("value", detail_list_control_info_value_outNumber);
Map<String, String> detail_list_control_info_value_inNumber = new HashMap<>();
detail_list_control_info_value_inNumber.put("new_number", String.valueOf(recordMin.getQuantity()));
detail_list_control_info_inNumber.put("value", detail_list_control_info_value_inNumber);
// 请求单位
@ -1990,7 +1992,7 @@ public class QyWxOperationService {
Map<String, String> detail_list_control_info_value_unit = new HashMap<>();
// 定义出库单位
String unit = recordMin.getUnit();
String unit = recordMin.getAirUnit();
if ("-1".equals(unit)) {
unit = materialById.getUnit();
}
@ -2010,7 +2012,7 @@ public class QyWxOperationService {
detail_list_control_info_depositoryName.put("title", detail_list_control_info_title_list_depositoryName);
Map<String, String> detail_list_control_info_value_dname = new HashMap<>();
detail_list_control_info_value_dname.put("text", depositoryById.getDname());
detail_list_control_info_value_dname.put("text", recordMin.getDepositoryName());
detail_list_control_info_depositoryName.put("value", detail_list_control_info_value_dname);
@ -2031,11 +2033,11 @@ public class QyWxOperationService {
detail_list_control_info_version.put("value", detail_list_control_info_value_version);
detail_list_control.add(detail_list_control_info_materialName);
detail_list_control.add(detail_list_control_info_materialCode);
detail_list_control.add(detail_list_control_info_materialName);
detail_list_control.add(detail_list_control_info_version);
detail_list_control.add(detail_list_control_info_outNumber);
detail_list_control.add(detail_list_control_info_unit);
detail_list_control.add(detail_list_control_info_inNumber);
detail_list_control.add(detail_list_control_info_depositoryName);
@ -2063,7 +2065,7 @@ public class QyWxOperationService {
summary_info_name.setText("发起人:" + userByPort.getName());
summary_info_name.setLang("zh_CN");
Approval_template_summary_info summary_info_time = new Approval_template_summary_info();
summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(mainRecord.getApplicantTime())));
summary_info_time.setText("发起时间:" + DateUtil.TimeStampToDateTime(Long.valueOf(minRecordList.get(0).getApplicantTime())));
summary_info_time.setLang("zh_CN");
Approval_template_summary_info summary_info_department = new Approval_template_summary_info();
summary_info_department.setText("所在部门:" + portName);

38
src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java

@ -76,7 +76,6 @@ public class SplitUnitServiceImpl implements SplitUnitService {
@Override
@Transactional(rollbackFor = Exception.class)
public Integer addSplitInventory(Map<String, Object> map) {
Map<String, Object> paramForSplitInfo = new HashMap<>();
paramForSplitInfo.put("mid", map.get("mid"));
paramForSplitInfo.put("newUnit", map.get("unit"));
@ -146,6 +145,7 @@ public class SplitUnitServiceImpl implements SplitUnitService {
}
}
// 获取要操作的数量
Double quantity = ObjectFormatUtil.toDouble(map.get("quantity"));
if ("in".equals(type)) {
@ -197,9 +197,7 @@ public class SplitUnitServiceImpl implements SplitUnitService {
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfoForUnit.getParentId());
updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, placeAndMaterialByMidAndPid.getId(), map, quantity.intValue(), splitInfoForUnit);
} else {
double price = Double.parseDouble((String) map.get("price"));
price = price * findSplitInfoScaleQuantity(splitInfoForUnit, -1);
map.put("price", Double.toString(price));
map.put("price", Double.toString(0));
depositoryRecordService.applicationInPlace(map);
map.put("applicationInId",map.get("id"));
map.remove("id");
@ -234,9 +232,7 @@ public class SplitUnitServiceImpl implements SplitUnitService {
if (placeAndMaterialByMidAndPid != null) {
updateSplitInfoSaveQuantity(parentSplitInfo, ObjectFormatUtil.toInteger(String.valueOf(saveQuantity)), placeAndMaterialByMidAndPid.getId(), map, quantity.intValue(), splitInfoForUnit);
} else {
double price = Double.parseDouble((String) map.get("price"));
price = price * findSplitInfoScaleQuantity(splitInfoForUnit, -1);
map.put("price", Double.toString(price));
map.put("price", Double.toString(0));
result += depositoryRecordService.applicationInPlace(map);
map.put("applicationInId",map.get("id"));
map.remove("id");
@ -247,9 +243,7 @@ public class SplitUnitServiceImpl implements SplitUnitService {
updateSplitInfoSaveQuantity(parentSplitInfo, ObjectFormatUtil.toInteger(String.valueOf(saveQuantity)), placeAndMaterialByMidAndPid.getId(), map, quantity.intValue(), splitInfoForUnit);
}
} else {
double price = Double.parseDouble((String) map.get("price"));
price = price * findSplitInfoScaleQuantity(splitInfoForUnit, -1);
map.put("price", Double.toString(price));
map.put("price", Double.toString(0));
result += depositoryRecordService.applicationInPlace(map);
map.put("applicationInId",map.get("id"));
map.remove("id");
@ -269,9 +263,7 @@ public class SplitUnitServiceImpl implements SplitUnitService {
// 如果没有库存记录
// 插入一条库存记录
double price = Double.parseDouble((String) map.get("price"));
price = price * findSplitInfoScaleQuantity(splitInfoForUnit, -1);
map.put("price", Double.toString(price));
map.put("price", Double.toString(0));
if (parentId != null) {
@ -568,14 +560,14 @@ public class SplitUnitServiceImpl implements SplitUnitService {
updateSplitInfoSaveQuantity(splitInfoForParent, disposeQuantity, splitInventory.getIid(), map, inQuantity, baseSplitInfo);
} else {
// 如果为空
double price = Double.parseDouble((String) map.get("price"));
price = price * findSplitInfoScaleQuantity(baseSplitInfo, -1);
map.put("price", Double.toString(price));
map.put("price", Double.toString(0));
map.put("quantity", String.valueOf(disposeQuantity));
map.put("realQuantity", String.valueOf(inQuantity));
depositoryRecordService.applicationInPlace(map);
// 删除入库订单
// depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(map.get("id")));
map.put("applicationInId",map.get("id"));
map.remove("id");
}
}
@ -585,14 +577,14 @@ public class SplitUnitServiceImpl implements SplitUnitService {
splitInventory.setInQuantity(splitInventory.getInQuantity() + (int) saveQuantity);
splitUnitMapper.updateSplitInventory(splitInventory);
double price = Double.parseDouble( map.get("price").toString());
price = price * findSplitInfoScaleQuantity(baseSplitInfo, -1);
map.put("price", Double.toString(price));
map.put("price", "0");
map.put("quantity", "0");
map.put("realQuantity", String.valueOf(inQuantity));
depositoryRecordService.applicationInPlace(map);
// 删除入库订单
// depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(map.get("id")));
map.put("applicationInId",map.get("id"));
map.remove("id");
}
}
@ -624,14 +616,13 @@ public class SplitUnitServiceImpl implements SplitUnitService {
updateSplitInfoSaveQuantity(parentSplitInfo, quantity_scale, iid, map, inQuantity, baseSplitInfo);
}
else {
double price = Double.parseDouble((String) map.get("price"));
price = price * findSplitInfoScaleQuantity(baseSplitInfo, -1);
map.put("price", Double.toString(price));
map.put("price", Double.toString(0));
map.put("quantity", String.valueOf(quantity_scale));
map.put("realQuantity", String.valueOf(inQuantity));
depositoryRecordService.applicationInPlace(map);
// 删除入库订单
// depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(map.get("id")));
map.put("applicationInId",map.get("id"));
map.remove("id");
}
} else {
@ -640,10 +631,11 @@ public class SplitUnitServiceImpl implements SplitUnitService {
splitUnitMapper.addSplitInventory(paramForInsertSplitInventory);
map.put("quantity", "0");
map.put("realQuantity", String.valueOf(inQuantity));
map.put("price", map.get("price").toString());
map.put("price", "0");
depositoryRecordService.applicationInPlace(map);
// 删除入库订单
// depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(map.get("id")));
map.put("applicationInId",map.get("id"));
map.remove("id");
}

2
src/main/resources/templates/pages/application/application-in.html

@ -850,7 +850,7 @@
}
var unit = $("#unit" + idNumber);
unit.empty();
$("#unit" + idNumber).append(new Option(material.unit, "-1"));
$("#unit" + idNumber).append(new Option(material.baseUnit, "-1"));
var unitList = material["splitInfoList"];
for (let i = 0; i < unitList.length; i++) {
$("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit));

51
src/main/resources/templates/pages/user/table-user.html

@ -49,16 +49,6 @@
<select name="adminorg" id="adminorg"></select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-inline">
<select name="state">
<option value="">请选择状态</option>
<option value="1">启用</option>
<option value="2">禁用</option>
</select>
</div>
</div>
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索
@ -75,6 +65,7 @@
<script type="text/html" id="currentTableBar">
<a class="layui-btn layui-btn-xs layui-btn-danger " lay-event="add_role">设置权限</a>
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="detail">详情</a>
<a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="addRoleForIn">入库审核权</a>
</script>
</div>
@ -117,28 +108,17 @@
{field: 'name', width: 100, title: '姓名'},
{
field: 'gender', width: 80, title: '性别', templet: function (d) {
if (d.gender == 1) {
if (d.gender === 1) {
return "男性";
} else if (d.gender == 2) {
} else if (d.gender === 2) {
return "女性";
} else if (d.gender == 3) {
} else if (d.gender === 3) {
return "中性";
} else {
return "";
}
}
},
{
field: 'state', title: '状态', minWidth: 80, templet: function (d) {
if (d.state == 1) {
return "启用";
} else if (d.state == 2) {
return "禁用";
} else {
return "";
}
}
},
{
field: 'health', title: '健康状况', minWidth: 160, templet: function (d) {
switch (d.health) {
@ -157,14 +137,13 @@
}
}
},
{field: 'depositoryName', width: 200, title: '管理仓库'},
{field: 'mobilephone', width: 200, title: '内线电话'},
{field: 'companyname', width: 200, title: '公司名称'},
{field: 'maindeparmentname', width: 200, title: '主部门'},
{field: 'sunmaindeparmentname', width: 200, title: '岗位'},
{field: 'workpostname', width: 200, title: '工段'},
{field: 'positionname', width: 200, title: '职位'},
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
{title: '操作', width: 300, toolbar: '#currentTableBar', align: "center"}
]
],
limits: [10, 15, 20, 25, 50, 100],
@ -188,10 +167,7 @@
if (data.adminorg !== '') {
req.adminorg = data.adminorg;
}
if (data.state != '') {
req.state = data.state;
}
if (data.number != '') {
if (data.number !== '') {
req.number = data.number;
}
//执行搜索重载
@ -250,7 +226,7 @@
layer.full(index);
});
return false;
} else if (obj.event == 'add_role') {
} else if (obj.event === 'add_role') {
layer.open({
type: 2,
title: '权限信息',
@ -260,6 +236,19 @@
area: ['70%', '70%'],
content: '/userRoleView?id=' + data.id
});
}else if(obj.event === 'addRoleForIn'){
var index1 = layer.open({
title: '权限信息',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['70%', '70%'],
content: '/userRoleInView?id=' + data.id,
});
$(window).on("resize", function () {
layer.full(index1);
});
}
});

12
src/main/resources/templates/pages/user/user-add.html

@ -17,6 +17,7 @@
<body>
<div class="layui-form layuimini-form">
<input type="text" name="userid" th:value="${userByPort.getId()}" style="display: none">
<input type="text" name="classes" th:value="${classes}" style="display: none">
<div class="layui-form-item">
<label class="layui-form-label required">用户名</label>
<div class="layui-input-block">
@ -24,15 +25,6 @@
<tip>填写自己管理账号的名称。</tip>
</div>
</div>
<div class=" layui-form-item" style="display:none;">
<label class="layui-form-label required">权限:</label>
<div class="layui-inline " style="margin-bottom: 10px">
<select name="authority" class="layui-input-inline">
<option value="">请选择权限</option>
<option th:each="role,iterStar:${roles}" th:value="${role?.getId()}" th:text="${role?.getName()}" th:selected="${userByPort.getRolename() == role.getName()}">系统管理员</option>
</select>
</div>
</div>
<div class=" layui-form-item" >
<label class="layui-form-label required">负责仓库:</label>
<div class="layui-inline" style="margin-bottom: 10px">
@ -110,7 +102,7 @@
})
}
}
})
});
return false;
});

247
src/main/resources/templates/pages/user/user-email.html

@ -1,247 +0,0 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>分步表单</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="/static/lib/layui-v2.6.3/css/layui.css" media="all">
<link rel="stylesheet" href="/static/css/public.css" media="all">
<link rel="stylesheet" href="/static/js/lay-module/step-lay/step.css" media="all">
</head>
<body>
<div class="layuimini-container">
<div class="layuimini-main">
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-body" style="padding-top: 40px;">
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin-top: 5em;">
<div carousel-item>
<div>
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<div class="layui-form-item">
<h2>验证码将发送至<span id="oldEmail" th:text="${email}">1789131794@qq.com</span></h2>
<h3 style="color: grey;margin-top: 1em">如果长时间未收到验证码,请检查垃圾箱</h3>
</div>
<div class="layui-form-item" style="margin-top: 5em">
<label class="layui-form-label required" style="display: inline">邮箱验证码:</label>
<input type="text" id="oldCode" class="layui-input" name="oldCode"
placeholder="请输入验证码"
lay-verify="required"
maxlength="4" style="width:160px;display: inline">
<button id="sendCodeBtn1" class="layui-btn layui-btn-normal layui-btn-sm"
style="display: inline;margin-left: 10px">发送验证码
</button>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formStep1">
&emsp;下一步&emsp;
</button>
</div>
</div>
</form>
</div>
<div>
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<div class="layui-form-item">
<label class="layui-form-label required">邮箱</label>
<div class="layui-input-block">
<input type="newEmail" name="email" lay-verify="email" placeholder="请输入邮箱"
value=""
class="layui-input">
</div>
</div>
<div class="layui-form-item" style="margin-top: 5em">
<label class="layui-form-label required" style="display: inline">邮箱验证码:</label>
<input type="text" id="newCode" class="layui-input" name="newCode"
placeholder="请输入验证码"
lay-verify="required"
maxlength="4" style="width:160px;display: inline">
<button id="sendCodeBtn2" class="layui-btn layui-btn-normal layui-btn-sm"
lay-submit style="display: inline;margin-left: 10px">发送验证码
</button>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formStep2">
&emsp;下一步&emsp;
</button>
</div>
</div>
</form>
<div>
<div style="text-align: center;margin-top: 90px;">
<i class="layui-icon layui-circle"
style="color: white;font-size:30px;font-weight:bold;background: #52C41A;padding: 20px;line-height: 80px;">&#xe605;</i>
<div style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;">
邮箱修改成功
</div>
</div>
</div>
</div>
</div>
</div>
<hr>
<div style="color: #666;margin-top: 30px;margin-bottom: 40px;padding-left: 30px;">
<h3>说明</h3><br>
验证码五分钟后会失效,请及时输入。
</div>
</div>
</div>
</div>
</div>
</div>
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
layui.use(['form', 'layer', 'step'], function () {
var $ = layui.$,
form = layui.form,
layer = layui.layer,
step = layui.step;
step.render({
elem: '#stepForm',
filter: 'stepForm',
width: '100%', //设置容器宽度
stepWidth: '750px',
height: '100%',
stepItems: [{
title: '验证旧邮箱'
}, {
title: '验证新邮箱'
}, {
title: '修改成功'
}]
});
$('#sendCodeBtn1').click(function () {
let email = $('#oldEmail').text();
$.ajax({
url: "/sendCode",
data:'{"email":'+JSON.stringify(email)+'}',
type: "post",
dataType: 'JSON',
contentType: "application/json;charset=utf-8",
success: function (data) {
if (data.status !== 200) {
layer.msg(data.statusInfo.message);//失败的表情
return;
} else {
layer.msg("验证码发送成功,请前往邮箱查看", {
icon: 6,//成功的表情
time: 1000 //1秒关闭(如果不配置,默认是3秒)
}, function () {
});
}
}
});
// $.ajax({
// url: '/sendCode',
// type: 'POST',
// dataType:'json',
// contentType: "application/json;charset=utf-8",
// data: '{"email":'+JSON.stringify(email)+'}',
// beforeSend: function () {
// this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
// },
// success: function (res) {
// if (res.status >= 300) {
// layer.msg(data.statusInfo.message);//失败的表情
// } else {
// layer.msg("验证码发送成功,请前往邮箱查看", {
// icon: 6,//成功的表情
// time: 1000 //1秒关闭(如果不配置,默认是3秒)
// });
// }
// }
// });
})
form.on('submit(formStep1)', function (data) {
data = data.field;
$.ajax({
type: 'put',
dataType: 'json',
contentType: "application/json;charset=utf-8",
url: '/checkOldEmail',
data: JSON.stringify(data),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (res) {
if (res.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
layer.msg("验证成功", {
icon: 6,//成功的表情
time: 1000 //1秒关闭(如果不配置,默认是3秒)
});
step.next('#stepForm');
}
}
});
return false;
});
$('#sendCodeBtn2').click(function () {
let data = {};
data.email = $('#oldEmail').text();
$.ajax({
type: 'POST',
dataType: 'json',
contentType: "application/json;charset=utf-8",
url: '/sendCode',
data: JSON.stringify(data),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (res) {
if (res.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
layer.msg("验证码发送成功,请前往邮箱查看", {
icon: 6,//成功的表情
time: 1000 //1秒关闭(如果不配置,默认是3秒)
});
}
}
});
})
form.on('submit(formStep2)', function (data) {
data = data.field;
data.oldCode = $("#oldCode");
$.ajax({
type: 'put',
dataType: 'json',
contentType: "application/json;charset=utf-8",
url: '/updateEmail',
data: JSON.stringify(data),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (res) {
if (res.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
layer.msg("验证成功", {
icon: 6,//成功的表情
time: 1000 //1秒关闭(如果不配置,默认是3秒)
});
step.next('#stepForm');
}
}
});
return false;
});
})
</script>
</body>
</html>

17
src/main/resources/templates/pages/user/user-role-edit.html

@ -25,22 +25,9 @@
<tip>填写自己管理账号的名称。</tip>
</div>
</div>
<div class=" layui-form-item" style="display:none;">
<label class="layui-form-label required">权限:</label>
<div class="layui-inline " style="margin-bottom: 10px">
<select name="authority" class="layui-input-inline">
<option value="">请选择权限</option>
<option th:each="role,iterStar:${roles}" th:value="${role?.getId()}" th:text="${role?.getName()}" th:selected="${userByPort.getRolename() == role.getName()}">系统管理员</option>
</select>
</div>
</div>
<div class=" layui-form-item" >
<label class="layui-form-label required">负责仓库:</label>
<div class="layui-inline" style="margin-bottom: 10px">
<!--<select name="depositoryId" lay-verify="required">
<option value="">请选择仓库</option>
<option th:each="depository,iterStar:${depositories}" th:value="${depository?.getId()}" th:text="${depository?.getDname()}" th:selected="${userByPort.getDepositoryName() == depository.getDname()}" >外芯仓库</option>
</select>-->
<input type="text" placeholder="请选择仓库" class="layui-input" id="openSonByDepository" readonly th:value="${userByPort.getDepositoryName()}"
lay-verify="required"/>
<input type="text" th:value="${depositoryId}" name="depositoryId" class="layui-input" id="depositoryId" style="display: none" lay-verify="required"/>
@ -106,7 +93,7 @@
layer.msg(data.statusInfo.message);//失败的表情
return;
} else {
layer.msg("申请提交成功", {
layer.msg("修改成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
},function(){
@ -115,7 +102,7 @@
})
}
}
})
});
return false;
});

14
src/main/resources/templates/pages/user/userRole.html

@ -36,8 +36,7 @@
//第一个实例
table.render({
elem: '#demo'
, height: 312
, url: 'findUserRole?userId=' + userId, //数据接口
, url: 'findUserRole?userId=' + userId+'&classes=1', //数据接口
parseData: function (res) { //res 即为原始返回的数据
return {
"status": res.status, //解析接口状态
@ -65,15 +64,6 @@
{field: 'depositoryName', width: 200, title: '仓库名称', sort: true},
{field: 'number', width: 100, title: '工号', sort: true},
{field: 'name', width: 100, title: '姓名', sort: true},
{
field: 'state', title: '状态', minWidth: 80, sort: true, templet: function (d) {
if (d.state == 1) {
return "启用";
} else if (d.state == 2) {
return "禁用";
}
}
},
{field: 'mobilephone', width: 200, title: '内线电话', sort: true},
{field: 'companyname', width: 200, title: '公司名称', sort: true},
{field: 'maindeparmentname', width: 200, title: '主部门', sort: true},
@ -152,7 +142,7 @@
maxmin:true,
shadeClose: true,
area: ['100%', '100%'],
content: '/user_add?userId='+userId,
content: '/user_add?userId='+userId+'&classes=1',
end:function () {
location.reload()
}

204
src/main/resources/templates/pages/user/userRoleForIn.html

@ -0,0 +1,204 @@
<!DOCTYPE html>
<html lang="en" xmlns:checked="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>layui</title>
<meta content="webkit" name="renderer">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
<link href="/static/lib/layui-v2.6.3/css/layui.css" media="all" rel="stylesheet">
<link href="/static/css/public.css" media="all" rel="stylesheet">
</head>
<body>
<div class="layuimini-container">
<input id="userId" style="display: none" th:value="${userId}">
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add_role">添加仓库</button>
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete">删除仓库</button>
</div>
</script>
<table id="demo" class="layui-hide" lay-filter="currentTableFilter"></table>
<script type="text/html" id="currentTableBar">
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="detail">详情</a>
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
</script>
</div>
<script charset="utf-8" src="/static/lib/layui-v2.6.3/layui.js"></script>
<script>
layui.use('table', function () {
var table = layui.table;
var $ = layui.$;
let userId = $("#userId").val();
//第一个实例
table.render({
elem: '#demo'
, url: 'findUserRole?userId=' + userId+'&classes=3', //数据接口
parseData: function (res) { //res 即为原始返回的数据
return {
"status": res.status, //解析接口状态
"message": res.statusInfo.message, //解析提示文本
"count": res.count, //解析数据长度
"data": res.data //解析数据列表
};
},
height: 'full-265',//固定高度-即固定表头固定第一行首行
request: {
pageName: 'page', //页码的参数名称,默认:page
limitName: 'pagesize' //每页数据量的参数名,默认:limit
},
response: {
statusName: 'status' //规定数据状态的字段名称,默认:code
, statusCode: 200 //规定成功的状态码,默认:0
, msgName: 'message' //规定状态信息的字段名称,默认:msg
, countName: 'count' //规定数据总数的字段名称,默认:count
, dataName: 'data' //规定数据列表的字段名称,默认:data
}, toolbar: '#toolbarDemo'
, cols: [
[ //表头
{type: "checkbox", width: 50},
{field: 'id', width: 80, title: 'ID', sort: true},
{field: 'depositoryName', width: 200, title: '仓库名称', sort: true},
{field: 'number', width: 100, title: '工号', sort: true},
{field: 'name', width: 100, title: '姓名', sort: true},
{field: 'mobilephone', width: 200, title: '内线电话', sort: true},
{field: 'companyname', width: 200, title: '公司名称', sort: true},
{field: 'maindeparmentname', width: 200, title: '主部门', sort: true},
{field: 'sunmaindeparmentname', width: 200, title: '岗位', sort: true},
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
]
],
limits: [10, 15, 20, 25, 50, 100],
limit: 10,
page: true,
skin: 'line',
done:function () {
$("[data-field='id']").css('display','none');
}
});
//监听表格复选框选择
table.on('checkbox(currentTableFilter)', function (obj) {
console.log(obj)
});
table.on('tool(currentTableFilter)', function (obj) {
let data = obj.data;
if(obj.event === 'detail'){
var index = layer.open({
title: '修改权限',
type: 2,
shade: 0.2,
maxmin:true,
shadeClose: true,
area: ['100%', '100%'],
content: '/user_role_edit?id='+data.id,
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
return false;
}
else if(obj.event === 'delete'){
var req = {};
req.id = data.id;
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) {
$.ajax({
url: '/sys/userRole_del',
dataType: 'json',
type: 'POST',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
return;
} else {
obj.del();
layer.msg("删除成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
});
}
}
})
});
}
});
table.on('toolbar(currentTableFilter)', function (obj) {
if (obj.event === 'add_role') {
var index = layer.open({
title: '添加权限',
type: 2,
shade: 0.2,
maxmin:true,
shadeClose: true,
area: ['100%', '100%'],
content: '/user_add?userId='+userId+'&classes=3',
end:function () {
location.reload()
}
});
$(window).on("resize", function () {
layer.full(index);
});
return false;
}
else if (obj.event === 'delete') { // 监听删除操作
var checkStatus = table.checkStatus('demo')
, data = checkStatus.data;
var req = {};
req.ids = [];
for (i = 0, len = data.length; i < len; i++) {
req.ids[i] = data[i].id;
}
if(req.ids.length > 0) {
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) {
$.ajax({
url: '/sys/userRole_del',
dataType: 'json',
type: 'POST',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
return;
} else {
layer.msg("删除成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
});
//执行搜索重载
table.reload('demo', {
url: '/findUserRole?userId=' + userId,
page: {
curr: 1
}
}, 'data');
}
}
})
});
}else{
layer.msg("未选中记录,请确认!");
return false;
}
}
})
});
</script>
</body>
</html>

5
src/test/java/com/dreamchaser/depository_manage/TestOther.java

@ -148,4 +148,9 @@ public class TestOther {
}
}

Loading…
Cancel
Save