Compare commits

...

12 Commits

21 changed files with 345 additions and 126 deletions

45
.drone.yml Normal file
View File

@@ -0,0 +1,45 @@
kind: pipeline
type: docker
name: build-and-deploy
steps:
- name: build-backend
image: maven:3.9-amazoncorretto-8
commands:
- cd jshERP-boot
- mvn package -DskipTests
volumes:
- name: maven-cache
path: /root/.m2
- name: build-frontend
image: node:18-alpine
commands:
- cd jshERP-web
- npm install --legacy-peer-deps
- npx vue-cli-service build
- name: docker-build-deploy
image: docker:dind
volumes:
- name: docker-sock
path: /var/run/docker.sock
commands:
- docker build -t jsherp:latest .
- docker stop jsherp || true
- docker rm jsherp || true
- docker run -d --name jsherp --network host -v /opt/jshERP/upload:/opt/jshERP/upload --restart unless-stopped jsherp:latest
volumes:
- name: maven-cache
host:
path: /root/.m2
- name: docker-sock
host:
path: /var/run/docker.sock
trigger:
branch:
- master
event:
- push

7
Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
FROM amazoncorretto:8-alpine
WORKDIR /app
COPY jshERP-boot/target/jshERP.jar /app/jshERP.jar
COPY jshERP-web/dist /app/static
RUN mkdir -p /opt/jshERP/upload /opt/tmp/tomcat
EXPOSE 9999
ENTRYPOINT ["java", "-jar", "/app/jshERP.jar"]

View File

@@ -580,7 +580,7 @@ INSERT INTO `jsh_msg` VALUES (2, '标题1', '内容1', '2019-09-10 00:11:39', '
DROP TABLE IF EXISTS `jsh_orga_user_rel`;
CREATE TABLE `jsh_orga_user_rel` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`orga_id` bigint(0) NOT NULL COMMENT '机构id',
`orga_id` bigint(0) NULL DEFAULT NULL COMMENT '机构id',
`user_id` bigint(0) NOT NULL COMMENT '用户id',
`user_blng_orga_dspl_seq` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户在所属机构中显示顺序',
`delete_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记0未删除1删除',

View File

@@ -1745,3 +1745,10 @@ create index depot_id on jsh_serial_number(depot_id) using btree;
create index type on jsh_user_business(type) using btree;
create index key_id on jsh_user_business(key_id) using btree;
create index tenant_id on jsh_user_business(tenant_id) using btree;
-- --------------------------------------------------------
-- 时间 2026年1月31日
-- by jishenghua
-- 给jsh_user表的orga_id字段改为非必填
-- --------------------------------------------------------
alter table jsh_orga_user_rel change orga_id orga_id bigint(0) NULL DEFAULT NULL COMMENT '机构id';

View File

@@ -141,6 +141,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.jsh.erp.ErpApplication</mainClass>
</configuration>
<version>2.0.3.RELEASE</version>
<executions>
<execution>

View File

@@ -215,6 +215,7 @@ public class DepotItemController {
BigDecimal totalAllPrice = BigDecimal.ZERO;
BigDecimal totalTaxMoney = BigDecimal.ZERO;
BigDecimal totalTaxLastMoney = BigDecimal.ZERO;
BigDecimal totalFinishNumber = BigDecimal.ZERO;
BigDecimal totalWeight = BigDecimal.ZERO;
for (DepotItemVo4WithInfoEx diEx : dataList) {
JSONObject item = new JSONObject();
@@ -252,7 +253,8 @@ public class DepotItemController {
item.put("operNumber", diEx.getOperNumber());
item.put("basicNumber", diEx.getBasicNumber());
item.put("preNumber", diEx.getOperNumber()); //原数量
item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialExtendId(), diEx.getId(), diEx.getHeaderId(), unitInfo, materialUnit, linkType)); //已入库|已出库
BigDecimal finishNumber = depotItemService.getFinishNumber(diEx.getMaterialExtendId(), diEx.getId(), diEx.getHeaderId(), unitInfo, materialUnit, linkType);
item.put("finishNumber", finishNumber); //已入库|已出库
item.put("purchaseDecimal", roleService.parseBillPriceByLimit(diEx.getPurchaseDecimal(), billCategory, priceLimit, request)); //采购价
if("basic".equals(linkType) || "1".equals(isReadOnly)) {
//正常情况显示金额,而以销定购的情况不能显示金额
@@ -288,6 +290,7 @@ public class DepotItemController {
totalAllPrice = totalAllPrice.add(diEx.getAllPrice()==null?BigDecimal.ZERO:diEx.getAllPrice());
totalTaxMoney = totalTaxMoney.add(diEx.getTaxMoney()==null?BigDecimal.ZERO:diEx.getTaxMoney());
totalTaxLastMoney = totalTaxLastMoney.add(diEx.getTaxLastMoney()==null?BigDecimal.ZERO:diEx.getTaxLastMoney());
totalFinishNumber = totalFinishNumber.add(finishNumber);
totalWeight = totalWeight.add(allWeight);
}
if(StringUtil.isNotEmpty(isReadOnly) && "1".equals(isReadOnly)) {
@@ -296,6 +299,7 @@ public class DepotItemController {
footItem.put("allPrice", roleService.parseBillPriceByLimit(totalAllPrice, billCategory, priceLimit, request));
footItem.put("taxMoney", roleService.parseBillPriceByLimit(totalTaxMoney, billCategory, priceLimit, request));
footItem.put("taxLastMoney", roleService.parseBillPriceByLimit(totalTaxLastMoney, billCategory, priceLimit, request));
footItem.put("finishNumber", totalFinishNumber);
footItem.put("weight", totalWeight);
dataArray.add(footItem);
}

View File

@@ -241,7 +241,7 @@ public class FunctionController extends BaseController {
if("admin".equals(userInfo.getLoginName())) {
funIdList = null;
}
List<Function> dataListFun = functionService.findRoleFunction("0", funIdList);
List<Function> dataListFun = functionService.findRoleFunction("0", null);
//开始拼接json数据
JSONObject outer = new JSONObject();
outer.put("id", 0);
@@ -255,17 +255,22 @@ public class FunctionController extends BaseController {
//根据条件从列表里面移除"系统管理"
List<Function> dataList = new ArrayList<>();
for (Function fun : dataListFun) {
List<Function> childrenList = functionService.getRoleFunction(fun.getNumber());
String token = request.getHeader("X-Access-Token");
Long tenantId = Tools.getTenantIdByToken(token);
if (tenantId!=0L) {
if(!("系统管理").equals(fun.getName())) {
if(!childrenList.isEmpty()) {
dataList.add(fun);
}
}
} else {
//超管
if(!childrenList.isEmpty()) {
dataList.add(fun);
}
}
}
dataArray = getFunctionList(dataList, type, keyId, funIdList);
outer.put("children", dataArray);
}

View File

@@ -233,8 +233,7 @@ public class UserController extends BaseController {
HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
Long id = jsonObject.getLong("id");
String password = "123456";
String md5Pwd = Tools.md5Encryp(password);
String md5Pwd = jsonObject.getString("password");
int update = userService.resetPwd(md5Pwd, id, request);
if(update > 0) {
return returnJson(objectMap, SUCCESS, ErpInfo.OK.code);

View File

@@ -553,10 +553,6 @@ public class UserService {
ubObj.put("value", "[" + ue.getRoleId() + "]");
userBusinessService.insertUserBusiness(ubObj, request);
}
if(ue.getOrgaId()==null){
//如果没有选择机构,就不建机构和用户的关联关系
return;
}
if(ue.getOrgaId()!=null && "1".equals(ue.getLeaderFlag())){
//检查当前机构是否存在经理
List<User> checkList = userMapperEx.getListByOrgaId(ue.getId(), ue.getOrgaId());
@@ -585,12 +581,10 @@ public class UserService {
public UserEx addUser(UserEx ue) throws Exception{
/**
* 新增用户默认设置
* 1、密码默认123456
* 2是否系统自带默认为非系统自带
* 3是否管理者默认为员工
* 4默认用户状态为正常
* 1是否系统自带默认为非系统自带
* 2是否管理者默认为员工
* 3默认用户状态为正常
* */
ue.setPassword(Tools.md5Encryp(BusinessConstants.USER_DEFAULT_PASSWORD));
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if(ue.getIsmanager()==null){
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
@@ -707,10 +701,6 @@ public class UserService {
userBusinessService.insertUserBusiness(ubObj, request);
}
}
if (ue.getOrgaId() == null) {
//如果没有选择机构,就不建机构和用户的关联关系
return;
}
if(ue.getOrgaId()!=null && "1".equals(ue.getLeaderFlag())){
//检查当前机构是否存在经理
List<User> checkList = userMapperEx.getListByOrgaId(ue.getId(), ue.getOrgaId());

View File

@@ -7,13 +7,13 @@ server.servlet.context-path=/jshERP-boot
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/jsh_erp?useUnicode=true&characterEncoding=utf8&useCursorFetch=true&defaultFetchSize=500&allowMultiQueries=true&rewriteBatchedStatements=true&useSSL=false
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.password=Qweewqzzx1
#mybatis-plus配置
mybatis-plus.mapper-locations=classpath:./mapper_xml/*.xml
# Redis
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=1234abcd
spring.redis.password=
#租户对应的角色id
manage.roleId=10
#租户允许创建的用户数

View File

@@ -276,7 +276,12 @@
order by oper_time desc,number desc
</if>
<if test="column != 'createTime'">
order by ${column} ${order}
<if test="column == 'barCode' or column == 'operNumber' or column == 'unitPrice' or column == 'allPrice' or column == 'taxMoney'">
order by ${column}
<if test="order == 'asc' or order == 'desc'">
${order}
</if>
</if>
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}
@@ -495,7 +500,12 @@
order by materialId desc
</if>
<if test="column != 'createTime'">
order by ${column} ${order}
<if test="column == 'barCode' or column == 'numSum' or column == 'priceSum'">
order by ${column}
<if test="order == 'asc' or order == 'desc'">
${order}
</if>
</if>
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}
@@ -701,7 +711,12 @@
order by oper_time desc,number desc
</if>
<if test="column != 'createTime'">
order by ${column} ${order}
<if test="column == 'barCode' or column == 'operNumber' or column == 'unitPrice' or column == 'allPrice'">
order by ${column}
<if test="order == 'asc' or order == 'desc'">
${order}
</if>
</if>
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}

View File

@@ -698,7 +698,12 @@
order by m.id desc
</if>
<if test="column != 'createTime'">
order by ${column} ${order}
<if test="column == 'mBarCode' or column == 'purchaseDecimal' or column == 'currentStock' or column == 'currentStockPrice' or column == 'currentWeight'">
order by ${column}
<if test="order == 'asc' or order == 'desc'">
${order}
</if>
</if>
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}

View File

@@ -17,9 +17,7 @@
<update id="updateOrgaUserRel" parameterType="com.jsh.erp.datasource.entities.OrgaUserRel" >
update jsh_orga_user_rel
<set >
<if test="orgaId != null" >
orga_id = #{orgaId},
</if>
<if test="userId != null" >
user_id = #{userId},
</if>

View File

@@ -20,6 +20,7 @@ const editUser = (params)=>putAction("/user/updateUser",params);
const getUserList = (params)=>getAction("/user/getUserList",params);
const getUserBtnByCurrentUser = (params)=>getAction("/user/getUserBtnByCurrentUser",params);
const queryPermissionsByUser = (params)=>postAction("/function/findMenuByPNumber",params);
const resetPwd = (params)=>postAction("/user/resetPwd",params);
//机构管理
const queryOrganizationTreeList = (params)=>getAction("/organization/getOrganizationTree",params);
const getAllOrganizationTreeByUser = (params)=>getAction("/organization/getAllOrganizationTreeByUser",params);
@@ -131,6 +132,7 @@ export {
getUserList,
getUserBtnByCurrentUser,
queryPermissionsByUser,
resetPwd,
queryOrganizationTreeList,
getAllOrganizationTreeByUser,
queryOrganizationById,

View File

@@ -133,7 +133,7 @@
}
let reg = /^(?=.*[a-z])(?=.*\d).{6,}$/;
if (!reg.test(value)) {
callback(new Error('密码由6位数字小写字母组成!'))
callback(new Error('用户密码至少要有数字和小写字母并且长度至少6位!'))
}
callback()
},

View File

@@ -75,6 +75,15 @@
<a-input placeholder="请输入关联订单" v-model="queryParam.linkNumber"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="结算账户" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select placeholder="请选择结算账户" showSearch allow-clear optionFilterProp="children" v-model="queryParam.accountId">
<a-select-option v-for="(item,index) in accountList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="单据状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select placeholder="请选择单据状态" allow-clear v-model="queryParam.status">
@@ -235,6 +244,7 @@
depotId: undefined,
linkApply: "",
linkNumber: "",
accountId: undefined,
creator: undefined,
status: undefined,
remark: ""
@@ -310,6 +320,7 @@
this.initSystemConfig()
this.initSupplier()
this.initUser()
this.initAccount()
this.initQuickBtn()
this.getDepotByCurrentUser()
},

View File

@@ -66,6 +66,15 @@
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="结算账户" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select placeholder="请选择结算账户" showSearch allow-clear optionFilterProp="children" v-model="queryParam.accountId">
<a-select-option v-for="(item,index) in accountList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="单据状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select placeholder="请选择单据状态" allow-clear v-model="queryParam.status">
@@ -240,6 +249,7 @@
subType: "销售订单",
organId: undefined,
depotId: undefined,
accountId: undefined,
creator: undefined,
status: undefined,
salesMan: undefined,
@@ -316,6 +326,7 @@
this.initCustomer()
this.initSalesman()
this.initUser()
this.initAccount()
this.getSystemConfig()
this.initQuickBtn()
this.getDepotByCurrentUser()

View File

@@ -980,7 +980,6 @@
},
autoSkuList(skuOneData, skuTwoData, skuThreeData) {
let unit = this.form.getFieldValue('unit')
if(unit) {
//计算多属性已经选择了几个
let skuArr = []
if(this.getNumByField('skuOne')) {
@@ -1060,10 +1059,6 @@
this.meTable.dataSource = meTableData
}
})
} else {
this.$message.warning('请填写单位(注意不要勾选多单位,因为多属性商品不支持多单位)');
this.barCodeSwitch = false;
}
},
getNumByField(field) {
let num = 0

View File

@@ -57,9 +57,7 @@
<a>删除</a>
</a-popconfirm>
<a-divider type="vertical"/>
<a-popconfirm title="确定重置密码为123456吗?" @confirm="() => handleReset(record.id)">
<a>重置密码</a>
</a-popconfirm>
<a @click="handleResetModal(record)">重置密码</a>
</span>
<!-- 状态渲染模板 -->
<template slot="customRenderFlag" slot-scope="status">
@@ -72,6 +70,7 @@
<user-modal ref="modalForm" @ok="modalFormOk"></user-modal>
<user-depot-modal ref="userDepotModal" @ok="modalFormOk"></user-depot-modal>
<user-customer-modal ref="userCustomerModal" @ok="modalFormOk"></user-customer-modal>
<user-reset-modal ref="userResetModal" @ok="modalFormOk"></user-reset-modal>
</a-card>
</a-col>
</a-row>
@@ -81,6 +80,7 @@
import UserModal from './modules/UserModal'
import UserDepotModal from './modules/UserDepotModal'
import UserCustomerModal from './modules/UserCustomerModal'
import UserResetModal from './modules/UserResetModal'
import {postAction} from '@/api/manage';
import {getCurrentSystemConfig} from '@/api/api'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
@@ -92,6 +92,7 @@
UserModal,
UserDepotModal,
UserCustomerModal,
UserResetModal,
JInput
},
data() {
@@ -175,6 +176,10 @@
this.$refs.modalForm.isReadOnly = true
}
},
handleResetModal(record) {
this.$refs.userResetModal.edit(record);
this.$refs.userResetModal.title = "请输入" + record.loginName + "的新密码";
},
handleReset(id) {
let that = this;
postAction(that.url.resetPwd, {id: id}).then((res) => {

View File

@@ -14,7 +14,7 @@
@cancel="handleCancel"
cancelText="取消"
okText="保存"
style="top:5%;height: 85%;">
style="top:2%;height:95%;">
<template slot="footer">
<a-button key="back" v-if="isReadOnly" @click="handleCancel">
取消
@@ -23,8 +23,10 @@
<a-spin :spinning="confirmLoading">
<a-form :form="form" id="userModal">
<a-form-item label="登录名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入登录名称" v-decorator.trim="[ 'loginName', validatorRules.loginName]" :readOnly="!!model.id"
suffix="初始密码123456" />
<a-input placeholder="请输入登录名称" v-decorator.trim="[ 'loginName', validatorRules.loginName]" :readOnly="!!model.id" />
</a-form-item>
<a-form-item label="用户密码" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="!model.id">
<a-input-password placeholder="请输入用户密码" v-decorator.trim="[ 'password', validatorRules.password]" />
</a-form-item>
<a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" >
<a-input placeholder="请输入用户姓名" v-decorator.trim="[ 'username', validatorRules.username]" />
@@ -71,11 +73,10 @@
<script>
import pick from 'lodash.pick'
import Vue from 'vue'
import md5 from 'md5'
import JSelectPosition from '@/components/jeecgbiz/JSelectPosition'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import { getAction } from '@/api/manage'
import {addUser,editUser,queryOrganizationTreeList,roleAllList} from '@/api/api'
import { disabledAuthFilter } from "@/utils/authFilter"
import {autoJumpNextInput} from "@/utils/util"
import {mixinDevice} from '@/utils/mixin'
import JImageUpload from '../../../components/jeecg/JImageUpload'
@@ -105,6 +106,12 @@
required: true, message: '请输入登录名称!'
}]
},
password: {
rules: [
{ required: true, message: '请输入用户密码!' },
{ pattern: /^(?=.*[a-z])(?=.*\d).{6,}$/, message: '用户密码至少要有数字和小写字母并且长度至少6位!' }
]
},
username:{
rules: [{
required: true, message: '请输入用户姓名!'
@@ -168,6 +175,7 @@
let obj;
if(!this.model.id){
formData.id = this.userId;
formData.password = md5(values.password);
obj=addUser(formData);
}else{
obj=editUser(formData);

View File

@@ -0,0 +1,109 @@
<template>
<div ref="container">
<a-modal
:title="title"
:width="600"
:visible="visible"
:confirmLoading="confirmLoading"
:getContainer="() => $refs.container"
:maskStyle="{'top':'93px','left':'154px'}"
:wrapClassName="wrapClassNameInfo()"
:mask="isDesktop()"
:maskClosable="false"
@ok="handleOk"
@cancel="handleCancel"
cancelText="取消"
okText="保存"
style="top:25%;height:35%;">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="新密码">
<a-input-password placeholder="请输入新密码" v-decorator.trim="[ 'password', validatorRules.password]" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</div>
</template>
<script>
import md5 from 'md5'
import pick from 'lodash.pick'
import { resetPwd } from '@/api/api'
import {mixinDevice} from '@/utils/mixin'
export default {
name: "UserResetModal",
mixins: [mixinDevice],
data () {
return {
title:"操作",
visible: false,
model: {},
maskStyle: '',
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
password:{
rules: [
{ required: true, message: '请输入新密码!' },
{ pattern: /^(?=.*[a-z])(?=.*\d).{6,}$/, message: '用户密码至少要有数字和小写字母并且长度至少6位!' }
]
}
},
}
},
created () {
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'password'))
});
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let formData = Object.assign(this.model, values);
let bodyParam = {
id: formData.id,
password: md5(formData.password)
}
resetPwd(bodyParam).then((res)=>{
if(res.code === 200){
that.$emit('ok');
}else{
that.$message.warning(res.data.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
}
}
}
</script>