Compare commits
No commits in common. "dev" and "comsumer-1.0.7" have entirely different histories.
dev
...
comsumer-1
542 changed files with 10424 additions and 952603 deletions
|
|
@ -22,12 +22,4 @@
|
|||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
.git
|
||||
**/bin/
|
||||
**/obj/
|
||||
.vscode/
|
||||
.dockerignore
|
||||
.gitignore
|
||||
README.md
|
||||
*.md
|
||||
README.md
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
name: Build & Deploy Checkin Service
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "checkin-dev[0-9]+.[0-9]+.[0-9]+"
|
||||
- "checkin-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||
IMAGE_VERSION: latest
|
||||
SERVICE_NAME: hrms-api-checkin
|
||||
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Tag Version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
VERSION=$(echo "${{ github.ref_name }}" | sed 's/checkin-dev//g')
|
||||
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
context: .
|
||||
file: ./BMA.EHR.CheckInConsumer/Dockerfile
|
||||
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||
push: true
|
||||
|
||||
- name: Remote Deploy
|
||||
uses: appleboy/ssh-action@v1.2.1
|
||||
with:
|
||||
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||
script: |
|
||||
cd ~/repo
|
||||
./replace-env.sh API_CHECKIN "${{ env.IMAGE_VERSION }}"
|
||||
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||
|
||||
- name: Discord Notification
|
||||
if: always()
|
||||
run: |
|
||||
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{
|
||||
\"embeds\": [{
|
||||
\"title\": \"$STATUS\",
|
||||
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||
\"color\": $COLOR,
|
||||
\"footer\": {
|
||||
\"text\": \"Release Notification\",
|
||||
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||
},
|
||||
\"timestamp\": \"$TIMESTAMP\"
|
||||
}]
|
||||
}" \
|
||||
${{ env.DISCORD_WEBHOOK }}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
name: Build & Deploy Discipline Service
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "discipline-dev[0-9]+.[0-9]+.[0-9]+"
|
||||
- "discipline-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||
IMAGE_VERSION: latest
|
||||
SERVICE_NAME: hrms-api-discipline
|
||||
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Tag Version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
VERSION=$(echo "${{ github.ref_name }}" | sed 's/discipline-dev//g')
|
||||
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
context: .
|
||||
file: ./BMA.EHR.Discipline.Service/Dockerfile
|
||||
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||
push: true
|
||||
|
||||
- name: Remote Deploy
|
||||
uses: appleboy/ssh-action@v1.2.1
|
||||
with:
|
||||
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||
script: |
|
||||
cd ~/repo
|
||||
./replace-env.sh API_DISCIPLINE "${{ env.IMAGE_VERSION }}"
|
||||
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||
|
||||
- name: Discord Notification
|
||||
if: always()
|
||||
run: |
|
||||
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{
|
||||
\"embeds\": [{
|
||||
\"title\": \"$STATUS\",
|
||||
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||
\"color\": $COLOR,
|
||||
\"footer\": {
|
||||
\"text\": \"Release Notification\",
|
||||
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||
},
|
||||
\"timestamp\": \"$TIMESTAMP\"
|
||||
}]
|
||||
}" \
|
||||
${{ env.DISCORD_WEBHOOK }}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
name: Build & Deploy Insignia Service
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "insignia-dev[0-9]+.[0-9]+.[0-9]+"
|
||||
- "insignia-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||
IMAGE_VERSION: latest
|
||||
SERVICE_NAME: hrms-api-insignia
|
||||
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Tag Version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
VERSION=$(echo "${{ github.ref_name }}" | sed 's/insignia-dev//g')
|
||||
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
context: .
|
||||
file: ./BMA.EHR.Insignia/Dockerfile
|
||||
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||
push: true
|
||||
|
||||
- name: Remote Deploy
|
||||
uses: appleboy/ssh-action@v1.2.1
|
||||
with:
|
||||
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||
script: |
|
||||
cd ~/repo
|
||||
./replace-env.sh API_INSIGNIA "${{ env.IMAGE_VERSION }}"
|
||||
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||
|
||||
- name: Discord Notification
|
||||
if: always()
|
||||
run: |
|
||||
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{
|
||||
\"embeds\": [{
|
||||
\"title\": \"$STATUS\",
|
||||
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||
\"color\": $COLOR,
|
||||
\"footer\": {
|
||||
\"text\": \"Release Notification\",
|
||||
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||
},
|
||||
\"timestamp\": \"$TIMESTAMP\"
|
||||
}]
|
||||
}" \
|
||||
${{ env.DISCORD_WEBHOOK }}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
name: Build & Deploy Leave Service
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "leave-dev[0-9]+.[0-9]+.[0-9]+"
|
||||
- "leave-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||
IMAGE_VERSION: latest
|
||||
SERVICE_NAME: hrms-api-leave
|
||||
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Tag Version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
VERSION=$(echo "${{ github.ref_name }}" | sed 's/leave-dev//g')
|
||||
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
context: .
|
||||
file: ./BMA.EHR.Leave/Dockerfile
|
||||
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||
push: true
|
||||
|
||||
- name: Remote Deploy
|
||||
uses: appleboy/ssh-action@v1.2.1
|
||||
with:
|
||||
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||
script: |
|
||||
cd ~/repo
|
||||
./replace-env.sh API_LEAVE "${{ env.IMAGE_VERSION }}"
|
||||
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||
|
||||
- name: Discord Notification
|
||||
if: always()
|
||||
run: |
|
||||
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{
|
||||
\"embeds\": [{
|
||||
\"title\": \"$STATUS\",
|
||||
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||
\"color\": $COLOR,
|
||||
\"footer\": {
|
||||
\"text\": \"Release Notification\",
|
||||
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||
},
|
||||
\"timestamp\": \"$TIMESTAMP\"
|
||||
}]
|
||||
}" \
|
||||
${{ env.DISCORD_WEBHOOK }}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
name: Build & Deploy Placement Service
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "placement-dev[0-9]+.[0-9]+.[0-9]+"
|
||||
- "placement-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||
IMAGE_VERSION: latest
|
||||
SERVICE_NAME: hrms-api-placement
|
||||
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Tag Version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
VERSION=$(echo "${{ github.ref_name }}" | sed 's/placement-dev//g')
|
||||
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
context: .
|
||||
file: ./BMA.EHR.Placement.Service/Dockerfile
|
||||
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||
push: true
|
||||
|
||||
- name: Remote Deploy
|
||||
uses: appleboy/ssh-action@v1.2.1
|
||||
with:
|
||||
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||
script: |
|
||||
cd ~/repo
|
||||
./replace-env.sh API_PLACEMENT "${{ env.IMAGE_VERSION }}"
|
||||
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||
|
||||
- name: Discord Notification
|
||||
if: always()
|
||||
run: |
|
||||
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{
|
||||
\"embeds\": [{
|
||||
\"title\": \"$STATUS\",
|
||||
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||
\"color\": $COLOR,
|
||||
\"footer\": {
|
||||
\"text\": \"Release Notification\",
|
||||
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||
},
|
||||
\"timestamp\": \"$TIMESTAMP\"
|
||||
}]
|
||||
}" \
|
||||
${{ env.DISCORD_WEBHOOK }}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
name: Build & Deploy Retirement Service
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "retirement-dev[0-9]+.[0-9]+.[0-9]+"
|
||||
- "retirement-dev[0-9]+.[0-9]+.[0-9]+*"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}
|
||||
IMAGE_VERSION: latest
|
||||
SERVICE_NAME: hrms-api-retirement
|
||||
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Tag Version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
VERSION=$(echo "${{ github.ref_name }}" | sed 's/retirement-dev//g')
|
||||
echo "IMAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
context: .
|
||||
file: ./BMA.EHR.Retirement.Service/Dockerfile
|
||||
tags: ${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||
push: true
|
||||
|
||||
- name: Remote Deploy
|
||||
uses: appleboy/ssh-action@v1.2.1
|
||||
with:
|
||||
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||
script: |
|
||||
cd ~/repo
|
||||
./replace-env.sh API_RETIREMENT "${{ env.IMAGE_VERSION }}"
|
||||
./deploy.sh ${{ env.SERVICE_NAME }}
|
||||
|
||||
- name: Discord Notification
|
||||
if: always()
|
||||
run: |
|
||||
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{
|
||||
\"embeds\": [{
|
||||
\"title\": \"$STATUS\",
|
||||
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}/${{ env.SERVICE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ gitea.actor }}\`\",
|
||||
\"color\": $COLOR,
|
||||
\"footer\": {
|
||||
\"text\": \"Release Notification\",
|
||||
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||
},
|
||||
\"timestamp\": \"$TIMESTAMP\"
|
||||
}]
|
||||
}" \
|
||||
${{ env.DISCORD_WEBHOOK }}
|
||||
22
.github/workflows/discord-notify.yml
vendored
22
.github/workflows/discord-notify.yml
vendored
|
|
@ -1,22 +0,0 @@
|
|||
name: Discord PR Notify
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
discord:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send Discord
|
||||
run: |
|
||||
curl -X POST "${{ secrets.DISCORD_WEBHOOK_PULLREQUEST }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "🔔 **Service:** ${{ github.repository }}",
|
||||
"description": "👤 **Author:** ${{ github.event.pull_request.user.login }}\n🌿 **Branch:** ${{ github.event.pull_request.head.ref }} → ${{ github.event.pull_request.base.ref }}\n📦 **Pull Request:** [#${{ github.event.pull_request.number }} - ${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})",
|
||||
"color": 5814783,
|
||||
"timestamp": "${{ github.event.pull_request.created_at }}"
|
||||
}]
|
||||
}'
|
||||
101
.github/workflows/dockerhub-release-checkin.yaml
vendored
101
.github/workflows/dockerhub-release-checkin.yaml
vendored
|
|
@ -1,101 +0,0 @@
|
|||
name: DockerHub Release - CheckIn Consumer
|
||||
run-name: DockerHub Release - CheckIn Consumer by ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "checkin-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
IMAGE_VER:
|
||||
description: "Image version (e.g., latest, v1.0.0)"
|
||||
required: false
|
||||
default: "latest"
|
||||
|
||||
env:
|
||||
DOCKERHUB_REGISTRY: docker.io
|
||||
IMAGE_NAME: hrms-api-checkin
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
release-to-dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: ${IMAGE_VER}"
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Git Ref: $GITHUB_REF"
|
||||
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: BMA.EHR.CheckInConsumer/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=BMA EHR CheckIn Consumer
|
||||
org.opencontainers.image.description=HRMS CheckIn Consumer Service
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify Discord on success
|
||||
if: success()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
|
||||
- name: Notify Discord on failure
|
||||
if: failure()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
101
.github/workflows/dockerhub-release-command.yaml
vendored
101
.github/workflows/dockerhub-release-command.yaml
vendored
|
|
@ -1,101 +0,0 @@
|
|||
name: DockerHub Release - Command Service
|
||||
run-name: DockerHub Release - Command Service by ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "command-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
IMAGE_VER:
|
||||
description: "Image version (e.g., latest, v1.0.0)"
|
||||
required: false
|
||||
default: "latest"
|
||||
|
||||
env:
|
||||
DOCKERHUB_REGISTRY: docker.io
|
||||
IMAGE_NAME: hrms-api-command
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
release-to-dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: ${IMAGE_VER}"
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Git Ref: $GITHUB_REF"
|
||||
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: BMA.EHR.Command.Service/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=BMA EHR Command Service
|
||||
org.opencontainers.image.description=HRMS Command API Service
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify Discord on success
|
||||
if: success()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
|
||||
- name: Notify Discord on failure
|
||||
if: failure()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
101
.github/workflows/dockerhub-release-discipline.yaml
vendored
101
.github/workflows/dockerhub-release-discipline.yaml
vendored
|
|
@ -1,101 +0,0 @@
|
|||
name: DockerHub Release - Discipline Service
|
||||
run-name: DockerHub Release - Discipline Service by ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "discipline-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
IMAGE_VER:
|
||||
description: "Image version (e.g., latest, v1.0.0)"
|
||||
required: false
|
||||
default: "latest"
|
||||
|
||||
env:
|
||||
DOCKERHUB_REGISTRY: docker.io
|
||||
IMAGE_NAME: hrms-api-discipline
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
release-to-dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: ${IMAGE_VER}"
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Git Ref: $GITHUB_REF"
|
||||
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: BMA.EHR.Discipline.Service/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=BMA EHR Discipline Service
|
||||
org.opencontainers.image.description=HRMS Discipline API Service
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify Discord on success
|
||||
if: success()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
|
||||
- name: Notify Discord on failure
|
||||
if: failure()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
101
.github/workflows/dockerhub-release-insignia.yaml
vendored
101
.github/workflows/dockerhub-release-insignia.yaml
vendored
|
|
@ -1,101 +0,0 @@
|
|||
name: DockerHub Release - Insignia Service
|
||||
run-name: DockerHub Release - Insignia Service by ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "insignia-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
IMAGE_VER:
|
||||
description: "Image version (e.g., latest, v1.0.0)"
|
||||
required: false
|
||||
default: "latest"
|
||||
|
||||
env:
|
||||
DOCKERHUB_REGISTRY: docker.io
|
||||
IMAGE_NAME: hrms-api-insignia
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
release-to-dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: ${IMAGE_VER}"
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Git Ref: $GITHUB_REF"
|
||||
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: BMA.EHR.Insignia/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=BMA EHR Insignia Service
|
||||
org.opencontainers.image.description=HRMS Insignia API Service
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify Discord on success
|
||||
if: success()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
|
||||
- name: Notify Discord on failure
|
||||
if: failure()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
119
.github/workflows/dockerhub-release-leave.yaml
vendored
119
.github/workflows/dockerhub-release-leave.yaml
vendored
|
|
@ -1,119 +0,0 @@
|
|||
name: DockerHub Release - Leave Service
|
||||
run-name: DockerHub Release - Leave Service by ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "leave-[0-9]+.[0-9]+.[0-9]+"
|
||||
# branches:
|
||||
# - main
|
||||
# - develop
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
IMAGE_VER:
|
||||
description: "Image version (e.g., latest, v1.0.0)"
|
||||
required: false
|
||||
default: "latest"
|
||||
|
||||
env:
|
||||
DOCKERHUB_REGISTRY: docker.io
|
||||
IMAGE_NAME: hrms-api-leave
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
release-to-dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
elif [[ $GITHUB_REF == 'refs/heads/'* ]]; then
|
||||
BRANCH_NAME=${GITHUB_REF#refs/heads/}
|
||||
IMAGE_VER="${BRANCH_NAME}-latest"
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: ${IMAGE_VER}"
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Git Ref: $GITHUB_REF"
|
||||
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
type=ref,event=branch
|
||||
type=raw,value=${{ steps.gen_ver.outputs.image_ver }}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: BMA.EHR.Leave/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Image digest
|
||||
run: echo "Image pushed with digest ${{ steps.build.outputs.digest }}"
|
||||
|
||||
- name: Notify Discord on success
|
||||
if: success()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
|
||||
- name: Notify Discord on failure
|
||||
if: failure()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
101
.github/workflows/dockerhub-release-placement.yaml
vendored
101
.github/workflows/dockerhub-release-placement.yaml
vendored
|
|
@ -1,101 +0,0 @@
|
|||
name: DockerHub Release - Placement Service
|
||||
run-name: DockerHub Release - Placement Service by ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "placement-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
IMAGE_VER:
|
||||
description: "Image version (e.g., latest, v1.0.0)"
|
||||
required: false
|
||||
default: "latest"
|
||||
|
||||
env:
|
||||
DOCKERHUB_REGISTRY: docker.io
|
||||
IMAGE_NAME: hrms-api-placement
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
release-to-dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: ${IMAGE_VER}"
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Git Ref: $GITHUB_REF"
|
||||
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: BMA.EHR.Placement.Service/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=BMA EHR Placement Service
|
||||
org.opencontainers.image.description=HRMS Placement API Service
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify Discord on success
|
||||
if: success()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
|
||||
- name: Notify Discord on failure
|
||||
if: failure()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
101
.github/workflows/dockerhub-release-reportv2.yaml
vendored
101
.github/workflows/dockerhub-release-reportv2.yaml
vendored
|
|
@ -1,101 +0,0 @@
|
|||
name: DockerHub Release - Report Service
|
||||
run-name: DockerHub Release - Report Service by ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "reportv2-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
IMAGE_VER:
|
||||
description: "Image version (e.g., latest, v1.0.0)"
|
||||
required: false
|
||||
default: "latest"
|
||||
|
||||
env:
|
||||
DOCKERHUB_REGISTRY: docker.io
|
||||
IMAGE_NAME: hrms-api-reportv2
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
release-to-dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: ${IMAGE_VER}"
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Git Ref: $GITHUB_REF"
|
||||
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: BMA.EHR.Report.Service/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=BMA EHR Report Service
|
||||
org.opencontainers.image.description=HRMS Report API Service
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify Discord on success
|
||||
if: success()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
|
||||
- name: Notify Discord on failure
|
||||
if: failure()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
101
.github/workflows/dockerhub-release-retirement.yaml
vendored
101
.github/workflows/dockerhub-release-retirement.yaml
vendored
|
|
@ -1,101 +0,0 @@
|
|||
name: DockerHub Release - Retirement Service
|
||||
run-name: DockerHub Release - Retirement Service by ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "retirement-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
IMAGE_VER:
|
||||
description: "Image version (e.g., latest, v1.0.0)"
|
||||
required: false
|
||||
default: "latest"
|
||||
|
||||
env:
|
||||
DOCKERHUB_REGISTRY: docker.io
|
||||
IMAGE_NAME: hrms-api-retirement
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
jobs:
|
||||
release-to-dockerhub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo "image_ver=${IMAGE_VER}" >> $GITHUB_OUTPUT
|
||||
echo "Generated version: ${IMAGE_VER}"
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Git Ref: $GITHUB_REF"
|
||||
echo "Image Version: ${{ steps.gen_ver.outputs.image_ver }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.DOCKERHUB_REGISTRY}}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: BMA.EHR.Retirement.Service/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.gen_ver.outputs.image_ver }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=BMA EHR Retirement Service
|
||||
org.opencontainers.image.description=HRMS Retirement API Service
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify Discord on success
|
||||
if: success()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="✅ DockerHub release succeeded\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
|
||||
- name: Notify Discord on failure
|
||||
if: failure()
|
||||
env:
|
||||
IMAGE_VER: ${{ steps.gen_ver.outputs.image_ver }}
|
||||
run: |
|
||||
TAG_INFO="Tag: ${IMAGE_VER:-unknown}"
|
||||
REF_INFO="Ref: ${GITHUB_REF}"
|
||||
ACTOR_INFO="Actor: ${GITHUB_ACTOR}"
|
||||
MSG="❌ DockerHub release failed\n${TAG_INFO}\n${REF_INFO}\n${ACTOR_INFO}"
|
||||
curl -s -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "{\"content\":\"${MSG}\"}" \
|
||||
"$DISCORD_WEBHOOK"
|
||||
196
.github/workflows/release_Retirement.yaml
vendored
196
.github/workflows/release_Retirement.yaml
vendored
|
|
@ -1,107 +1,107 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - "retirement-[0-9]+.[0-9]+.[0-9]+"
|
||||
push:
|
||||
tags:
|
||||
- "retirement-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-retirement-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-retirement
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-retirement-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-retirement
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_retirement.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Retirement.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
# act workflow_dispatch -W .github/workflows/release_retirement.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Retirement.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - "consumer-[0-9]+.[0-9]+.[0-9]+"
|
||||
push:
|
||||
tags:
|
||||
- "consumer-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
|
|
|
|||
182
.github/workflows/release_command.yaml
vendored
182
.github/workflows/release_command.yaml
vendored
|
|
@ -1,107 +1,89 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - "command-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-command-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-command
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-command-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-command
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_command.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Command.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
# act workflow_dispatch -W .github/workflows/release_command.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Command.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
|
|
|
|||
196
.github/workflows/release_discipline.yaml
vendored
196
.github/workflows/release_discipline.yaml
vendored
|
|
@ -1,107 +1,107 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - "discipline-[0-9]+.[0-9]+.[0-9]+"
|
||||
push:
|
||||
tags:
|
||||
- "discipline-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-discipline-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-discipline
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-discipline-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-discipline
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_discipline.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Discipline.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
# act workflow_dispatch -W .github/workflows/release_discipline.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Discipline.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
|
|
|||
6
.github/workflows/release_insignia.yaml
vendored
6
.github/workflows/release_insignia.yaml
vendored
|
|
@ -1,9 +1,9 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - "insignia-[0-9]+.[0-9]+.[0-9]+"
|
||||
push:
|
||||
tags:
|
||||
- "insignia-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
|
|
|
|||
8
.github/workflows/release_leave.yaml
vendored
8
.github/workflows/release_leave.yaml
vendored
|
|
@ -1,9 +1,9 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - "leave-[0-9]+.[0-9]+.[0-9]+"
|
||||
push:
|
||||
tags:
|
||||
- "leave-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
|
|
@ -57,7 +57,7 @@ jobs:
|
|||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
- name: Remote Deployment
|
||||
uses: appleboy/ssh-action@v1
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
|
|
|
|||
107
.github/workflows/release_metadata.yaml
vendored
107
.github/workflows/release_metadata.yaml
vendored
|
|
@ -1,107 +0,0 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "metadata-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-metadata-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-metadata
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_metadata.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.MetaData.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
196
.github/workflows/release_placement.yaml
vendored
196
.github/workflows/release_placement.yaml
vendored
|
|
@ -1,107 +1,107 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - "placement-[0-9]+.[0-9]+.[0-9]+"
|
||||
push:
|
||||
tags:
|
||||
- "placement-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-placement-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-placement
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-placement-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-placement
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_placement.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Placement.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
# act workflow_dispatch -W .github/workflows/release_placement.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Placement.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
|
|
|||
182
.github/workflows/release_report.yaml
vendored
182
.github/workflows/release_report.yaml
vendored
|
|
@ -1,107 +1,89 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - "reportv2-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-report-v2-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-report-v2
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-report-v2-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-report-v2
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_report.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set output tags
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER=${{ steps.vars.outputs.tag }}
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Check Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Report.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
# act workflow_dispatch -W .github/workflows/release_report.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Report.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- name: Notify Discord Success
|
||||
if: success()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Deployment Success!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||
"color": 3066993,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/success-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
- name: Notify Discord Failure
|
||||
if: failure()
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Deployment Failed!",
|
||||
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||
"color": 15158332,
|
||||
"footer": {
|
||||
"text": "Release Notification",
|
||||
"icon_url": "https://example.com/failure-icon.png"
|
||||
},
|
||||
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||
}]
|
||||
}' \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
|
|
|
|||
21
.gitignore
vendored
21
.gitignore
vendored
|
|
@ -16,19 +16,6 @@
|
|||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
out/
|
||||
.idea_modules/
|
||||
atlassian-ide-plugin.xml
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
|
|
@ -373,10 +360,4 @@ MigrationBackup/
|
|||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code C# Dev Kit cache
|
||||
*.lscache
|
||||
|
||||
# Claude Code
|
||||
.claude/
|
||||
FodyWeavers.xsd
|
||||
1
.idea/.idea.BMA.EHR.Solution/.idea/.name
generated
Normal file
1
.idea/.idea.BMA.EHR.Solution/.idea/.name
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
BMA.EHR.Solution
|
||||
|
After Width: | Height: | Size: 16 B |
4
.idea/.idea.BMA.EHR.Solution/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.BMA.EHR.Solution/.idea/encodings.xml
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
8
.idea/.idea.BMA.EHR.Solution/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.BMA.EHR.Solution/.idea/indexLayout.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.BMA.EHR.Solution/.idea/projectSettingsUpdater.xml
generated
Normal file
6
.idea/.idea.BMA.EHR.Solution/.idea/projectSettingsUpdater.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RiderProjectSettingsUpdater">
|
||||
<option name="vcsConfiguration" value="2" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.BMA.EHR.Solution/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.BMA.EHR.Solution/.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
552
.idea/.idea.BMA.EHR.Solution/.idea/workspace.xml
generated
Normal file
552
.idea/.idea.BMA.EHR.Solution/.idea/workspace.xml
generated
Normal file
|
|
@ -0,0 +1,552 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoGeneratedRunConfigurationManager">
|
||||
<projectFile kind="Docker">BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj</projectFile>
|
||||
<projectFile profileName="BMA.EHR.CheckInConsumer">BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj</projectFile>
|
||||
<projectFile kind="Docker">BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj</projectFile>
|
||||
<projectFile kind="Docker">BMA.EHR.Insignia/BMA.EHR.Insignia.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.Insignia/BMA.EHR.Insignia.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.Insignia/BMA.EHR.Insignia.csproj</projectFile>
|
||||
<projectFile kind="Docker">BMA.EHR.Leave/BMA.EHR.Leave.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.Leave/BMA.EHR.Leave.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.Leave/BMA.EHR.Leave.csproj</projectFile>
|
||||
<projectFile kind="Docker">BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj</projectFile>
|
||||
<projectFile kind="Docker">BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj</projectFile>
|
||||
<projectFile kind="Docker">BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj</projectFile>
|
||||
<projectFile kind="Docker">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
||||
<projectFile profileName="dotnet">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
||||
<projectFile profileName="report-designer">BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj</projectFile>
|
||||
<projectFile kind="Docker">BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj</projectFile>
|
||||
<projectFile profileName="http">BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj</projectFile>
|
||||
<projectFile profileName="https">BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj</projectFile>
|
||||
</component>
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="85fddeb6-44fd-40a4-864f-89daec07db75" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/BMA.EHR.Insignia/appsettings.json" beforeDir="false" afterPath="$PROJECT_DIR$/BMA.EHR.Insignia/appsettings.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/BMA.EHR.Leave/Controllers/LeaveController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/BMA.EHR.Leave/Controllers/LeaveController.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/BMA.EHR.Leave/appsettings.json" beforeDir="false" afterPath="$PROJECT_DIR$/BMA.EHR.Leave/appsettings.json" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="DpaMonitoringSettings">
|
||||
<option name="autoShow" value="false" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"customColor": "",
|
||||
"associatedIndex": 2
|
||||
}]]></component>
|
||||
<component name="ProjectId" id="2lB1pnEIkATarPnZkJ5vo5hUlwn" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
".NET Launch Settings Profile.BMA.EHR.Leave: https.executor": "Debug",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "working",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"/Users/suphonchai/Library/Application Support/JetBrains/Rider2024.1/resharper-host/DecompilerCache",
|
||||
"/Users/suphonchai/Library/Application Support/JetBrains/Rider2024.1/resharper-host/SourcesCache",
|
||||
"/Users/suphonchai/Library/Application Support/Symbols/src"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager" selected=".NET Launch Settings Profile.BMA.EHR.Leave: https">
|
||||
<configuration name="BMA.EHR.CheckInConsumer" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.CheckInConsumer/BMA.EHR.CheckInConsumer.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net8.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="BMA.EHR.CheckInConsumer" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Command.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Command.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Discipline.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Discipline.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Discipline.Service/BMA.EHR.Discipline.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Insignia: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Insignia/BMA.EHR.Insignia.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Insignia: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Insignia/BMA.EHR.Insignia.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Leave: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Leave/BMA.EHR.Leave.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Leave: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Leave/BMA.EHR.Leave.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.MetaData.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.MetaData.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.OrganizationEmployee.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.OrganizationEmployee.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Placement.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Placement.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Report.Service: dotnet" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="dotnet" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Report.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Report.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Report.Service: report-designer" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="report-designer" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Retirement.Service: http" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="http" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Retirement.Service: https" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
|
||||
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/BMA.EHR.Retirement.Service/BMA.EHR.Retirement.Service.csproj" />
|
||||
<option name="LAUNCH_PROFILE_TFM" value="net7.0" />
|
||||
<option name="LAUNCH_PROFILE_NAME" value="https" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<option name="USE_MONO" value="0" />
|
||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
|
||||
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
|
||||
<option name="SEND_DEBUG_REQUEST" value="1" />
|
||||
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
|
||||
<method v="2">
|
||||
<option name="Build" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.CheckInConsumer/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.checkinconsumer" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.CheckInConsumer/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="false" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Command.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.command.service" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="publishAllPorts" value="true" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.Command.Service/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Insignia/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.insignia" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="publishAllPorts" value="true" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.Insignia/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Leave/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.leave" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="publishAllPorts" value="true" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.Leave/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.MetaData.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.metadata.service" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="publishAllPorts" value="true" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.MetaData.Service/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.OrganizationEmployee.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.organizationemployee.service" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="publishAllPorts" value="true" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.OrganizationEmployee.Service/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Placement.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.placement.service" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="publishAllPorts" value="true" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.Placement.Service/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Report.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.report.service" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="publishAllPorts" value="true" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.Report.Service/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="BMA.EHR.Retirement.Service/Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="containerName" value="bma.ehr.retirement.service" />
|
||||
<option name="contextFolderPath" value="$PROJECT_DIR$" />
|
||||
<option name="publishAllPorts" value="true" />
|
||||
<option name="sourceFilePath" value="BMA.EHR.Retirement.Service/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="true" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration default="true" type="docker-deploy" factoryName="dockerfile" temporary="true">
|
||||
<deployment type="dockerfile" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="85fddeb6-44fd-40a4-864f-89daec07db75" name="Changes" comment="" />
|
||||
<created>1724638841465</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1724638841465</updated>
|
||||
<workItem from="1724638842250" duration="4068000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/BMA.EHR.Leave/Controllers/LeaveController.cs</url>
|
||||
<line>1152</line>
|
||||
<properties documentPath="$PROJECT_DIR$/BMA.EHR.Leave/Controllers/LeaveController.cs" containingFunctionPresentation="Method 'GetTimeRecordAsync'">
|
||||
<startOffsets>
|
||||
<option value="52378" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="52431" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
version: 37
|
||||
jobs:
|
||||
- name: CI for UAT
|
||||
steps:
|
||||
- !CheckoutStep
|
||||
name: checkout code
|
||||
cloneCredential: !DefaultCredential {}
|
||||
withLfs: false
|
||||
withSubmodules: false
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
- !GenerateChecksumStep
|
||||
name: generate project checksum
|
||||
files: '**/*.csproj'
|
||||
targetFile: checksum
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
- !SetupCacheStep
|
||||
name: set up nuget cache
|
||||
key: nuget_packages_@file:checksum@
|
||||
loadKeys:
|
||||
- nuget_packages
|
||||
paths:
|
||||
- /root/.nuget/packages
|
||||
uploadStrategy: UPLOAD_IF_NOT_HIT
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
- !CommandStep
|
||||
name: test and analyze
|
||||
runInContainer: true
|
||||
image: mcr.microsoft.com/dotnet/sdk
|
||||
interpreter: !DefaultInterpreter
|
||||
commands: |
|
||||
set -e
|
||||
dotnet tool install -g roslynator.dotnet.cli
|
||||
dotnet test -l trx --collect:"XPlat Code Coverage"
|
||||
#/root/.dotnet/tools/roslynator analyze -o roslynator-analysis.xml
|
||||
useTTY: true
|
||||
condition: NEVER
|
||||
- !PublishTRXReportStep
|
||||
name: publish unit test report
|
||||
reportName: Unit Test
|
||||
filePatterns: '**/*.trx'
|
||||
condition: NEVER
|
||||
- !PublishCoberturaReportStep
|
||||
name: publish code coverage report
|
||||
reportName: Code Coverage
|
||||
filePatterns: '**/coverage.cobertura.xml'
|
||||
condition: NEVER
|
||||
- !PublishRoslynatorReportStep
|
||||
name: publish code problem report
|
||||
reportName: Code Problems
|
||||
filePatterns: roslynator-analysis.xml
|
||||
failThreshold: HIGH
|
||||
condition: NEVER
|
||||
- !SetBuildVersionStep
|
||||
name: set build version
|
||||
buildVersion: '@tag@'
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
- !BuildImageStep
|
||||
name: build docker image - Leave
|
||||
dockerfile: ./BMA.EHR.Leave/Dockerfile
|
||||
output: !RegistryOutput
|
||||
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-leave:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-leave:latest
|
||||
condition: NEVER
|
||||
- !BuildImageStep
|
||||
name: build docker image - Checkin
|
||||
dockerfile: ./BMA.EHR.CheckInConsumer/Dockerfile
|
||||
output: !RegistryOutput
|
||||
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-checkin:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-checkin:latest
|
||||
condition: NEVER
|
||||
- !BuildImageStep
|
||||
name: build docker image - Insignia
|
||||
dockerfile: ./BMA.EHR.Insignia/Dockerfile
|
||||
output: !RegistryOutput
|
||||
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-insignia:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-insignia:latest
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
triggers:
|
||||
- !TagCreateTrigger
|
||||
tags: uat-*
|
||||
branches: main
|
||||
retryCondition: never
|
||||
maxRetries: 3
|
||||
retryDelay: 30
|
||||
timeout: 14400
|
||||
93
.vscode/launch.json
vendored
93
.vscode/launch.json
vendored
|
|
@ -1,60 +1,35 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/BMA.EHR.Leave/bin/Debug/net7.0/BMA.EHR.Leave.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/BMA.EHR.Leave",
|
||||
"stopAtEntry": false,
|
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
|
||||
"name": ".NET Core Launch (web) - Insignia",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/BMA.EHR.Insignia/bin/Debug/net7.0/BMA.EHR.Insignia.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/BMA.EHR.Insignia",
|
||||
"stopAtEntry": false,
|
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/BMA.EHR.Leave.Service/bin/Debug/net7.0/BMA.EHR.Leave.Service.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/BMA.EHR.Leave.Service",
|
||||
"stopAtEntry": false,
|
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -23,12 +23,11 @@ namespace BMA.EHR.Application
|
|||
services.AddTransient<CommandStatusRepository>();
|
||||
services.AddTransient<InsigniaPeriodsRepository>();
|
||||
services.AddTransient<RetirementRepository>();
|
||||
services.AddTransient<RetirementEmployeeRepository>();
|
||||
services.AddTransient<UserProfileRepository>();
|
||||
services.AddTransient<OrganizationCommonRepository>();
|
||||
services.AddTransient<InboxRepository>();
|
||||
services.AddTransient<NotificationRepository>();
|
||||
//services.AddTransient<RetirementRepository>();
|
||||
services.AddTransient<RetirementRepository>();
|
||||
services.AddTransient<RetireReportRepository>();
|
||||
services.AddTransient<InsigniaReportRepository>();
|
||||
services.AddTransient<CommandReportRepository>();
|
||||
|
|
@ -53,16 +52,12 @@ namespace BMA.EHR.Application
|
|||
services.AddTransient<UserDutyTimeRepository>();
|
||||
services.AddTransient<AdditionalCheckRequestRepository>();
|
||||
services.AddTransient<UserCalendarRepository>();
|
||||
services.AddTransient<CheckInJobStatusRepository>();
|
||||
|
||||
services.AddTransient<LeaveTypeRepository>();
|
||||
services.AddTransient<LeaveRequestRepository>();
|
||||
services.AddTransient<LeaveBeginningRepository>();
|
||||
|
||||
services.AddTransient<MinIOLeaveService>();
|
||||
|
||||
services.AddTransient<LeaveProcessJobStatusRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@
|
|||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<NoWarn>$(NoWarn);$(WarningsNotAsErrors)</NoWarn>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace BMA.EHR.Application.Messaging
|
|||
}
|
||||
catch
|
||||
{
|
||||
//throw;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
PositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
PositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
Salary = p.Amount == null ? "0" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
|
||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||
ExamNumber = p.ExamNumber == null ? "0" : p.ExamNumber.Value.ToString().ToThaiNumber(),
|
||||
|
|
@ -138,6 +138,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
join p in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementEducations)
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
.Include(x => x.PositionType)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType01Response
|
||||
|
|
@ -152,11 +158,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
PositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
PositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
Salary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||
ExamNumber = p.ExamNumber == null ? "" : p.ExamNumber.Value.ToString().ToThaiNumber(),
|
||||
|
|
@ -190,6 +196,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
join p in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementEducations)
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
.Include(x => x.PositionType)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType03Response
|
||||
|
|
@ -206,11 +218,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
||||
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
||||
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "0" ? $"{p.rootShortNameOld} {p.posMasterNoOld}".ToThaiNumber() : "",
|
||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
|
||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
|
||||
NewOc = p.root == null ? "" : p.root,
|
||||
|
|
@ -218,11 +230,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||
RemarkHorizontal = p.RemarkHorizontal,
|
||||
|
|
@ -255,6 +267,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
join p in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementEducations)
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
.Include(x => x.PositionType)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType03Response
|
||||
|
|
@ -269,22 +287,22 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
||||
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
||||
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "0" ? $"{p.rootShortNameOld} {p.posMasterNoOld}".ToThaiNumber() : "",
|
||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
|
||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
NewOc = p.root == null ? "" : p.root,
|
||||
NewPositionName = p.positionName == null ? "" : p.positionName,
|
||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
|
||||
})
|
||||
|
|
@ -315,6 +333,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
join p in _dbContext.Set<PlacementProfile>()
|
||||
.Include(x => x.PlacementEducations)
|
||||
.Include(x => x.Placement)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.PositionPath)
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionNumber)
|
||||
.Include(x => x.PositionType)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType03Response
|
||||
|
|
@ -329,22 +353,22 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
|
||||
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
|
||||
OldPositionNumber = p.posMasterNoOld == null ? "" :
|
||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld} {p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "0" ? $"{p.rootShortNameOld} {p.posMasterNoOld}".ToThaiNumber() : "",
|
||||
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
|
||||
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
|
||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
NewOc = p.root == null ? "" : p.root,
|
||||
NewPositionName = p.positionName == null ? "" : p.positionName,
|
||||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
|
||||
})
|
||||
|
|
@ -407,11 +431,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||
Reason = p.Reason == null ? "-" : p.Reason,
|
||||
|
|
@ -477,11 +501,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||
Reason = p.Reason == null ? "-" : p.Reason,
|
||||
|
|
@ -750,11 +774,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||
Reason = p.Reason == null ? "-" : p.Reason,
|
||||
|
|
@ -1173,11 +1197,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName.ToThaiNumber(),
|
||||
// NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
Reason = p.Reason == null ? "-" : p.Reason,
|
||||
})
|
||||
|
|
@ -1307,11 +1331,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
// NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
p.node == 4 ? $"{p.child4ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName} {p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName} {p.posMasterNo}".ToThaiNumber() : "",
|
||||
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
Reason = p.Reason == null ? "-" : p.Reason,
|
||||
})
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,14 +1,9 @@
|
|||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Models.Discipline;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using BMA.EHR.Application.Requests;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
|
|
@ -18,60 +13,33 @@ namespace BMA.EHR.Application.Repositories
|
|||
private readonly IDisciplineDbContext _dbDisContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly IConfiguration _configuration;
|
||||
public DisciplineRepository(IApplicationDBContext dbContext,
|
||||
IDisciplineDbContext dbDisContext,
|
||||
NotificationRepository repositoryNoti,
|
||||
IConfiguration configuration,
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_dbDisContext = dbDisContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
//เรื่องร้องเรียน
|
||||
public async Task NotifyDisciplineComplaint()
|
||||
{
|
||||
var cronjobNotis = await _dbDisContext.Set<DisciplineComplaint>()
|
||||
.Include(x => x.DisciplineComplaint_Profiles)
|
||||
.Where(x => x.DateNotification != null)
|
||||
.Where(x => x.DateNotification.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = cronjobNoti.DisciplineComplaint_Profiles.Select(x => x.PersonId),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
var org = JsonConvert.DeserializeObject<DirectorRequest>(_result);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
$"แจ้งเตือนบันทึกข้อมูลร้องเรียนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
$"แจ้งเตือนบันทึกข้อมูลร้องเรียนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
$"แจ้งเตือนบันทึกข้อมูลร้องเรียนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}"
|
||||
);
|
||||
}
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
|
@ -79,39 +47,16 @@ namespace BMA.EHR.Application.Repositories
|
|||
public async Task NotifyDisciplineInvestigate()
|
||||
{
|
||||
var cronjobNotis = await _dbDisContext.Set<DisciplineInvestigate>()
|
||||
.Include(x => x.DisciplineInvestigate_ProfileComplaints)
|
||||
.Where(x => x.InvestigationDateEnd != null && x.InvestigationDateEnd.Value.Date.AddDays(-7) == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = cronjobNoti.DisciplineInvestigate_ProfileComplaints.Select(x => x.PersonId),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
var org = JsonConvert.DeserializeObject<DirectorRequest>(_result);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
$"แจ้งเตือนบันทึกข้อมูลสืบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
$"แจ้งเตือนบันทึกข้อมูลสืบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
$"แจ้งเตือนบันทึกข้อมูลสืบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}"
|
||||
);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -120,39 +65,16 @@ namespace BMA.EHR.Application.Repositories
|
|||
public async Task NotifyDisciplineDisciplinary()
|
||||
{
|
||||
var cronjobNotis = await _dbDisContext.Set<DisciplineDisciplinary>()
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
.Where(x => x.DisciplinaryDateEnd != null && x.DisciplinaryDateEnd.Value.Date.AddDays(-7) == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = cronjobNoti.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(x => x.PersonId),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
var org = JsonConvert.DeserializeObject<DirectorRequest>(_result);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
$"แจ้งเตือนบันทึกข้อมูลสอบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
$"แจ้งเตือนบันทึกข้อมูลสอบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
$"แจ้งเตือนบันทึกข้อมูลสอบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}"
|
||||
);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
using Amazon.Runtime.Internal.Endpoints.StandardLibrary;
|
||||
using Amazon.S3.Model.Internal.MarshallTransformations;
|
||||
using Amazon.S3.Model.Internal.MarshallTransformations;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
|
|
@ -53,18 +52,15 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
#region " For Call External API "
|
||||
|
||||
protected async Task<string> GetExternalAPIAsync(string apiPath, string accessToken, string apiKey, CancellationToken cancellationToken = default)
|
||||
protected async Task<string> GetExternalAPIAsync(string apiPath, string accessToken, string apiKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
// กำหนด timeout เป็น 30 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||
var _res = await client.GetAsync(apiPath,cancellationToken: combinedCts.Token);
|
||||
client.DefaultRequestHeaders.Add("api_key", apiKey);
|
||||
var _res = await client.GetAsync(apiPath);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
|
@ -80,79 +76,10 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
protected async Task<string> SendExternalAPIAsync(HttpMethod method, string apiPath, string accessToken, object? body, string apiKey, CancellationToken cancellationToken = default)
|
||||
protected async Task<string> PostExternalAPIAsync(string apiPath, string accessToken, object? body, string apiKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
// กำหนด timeout เป็น 30 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
// สร้าง request message
|
||||
var request = new HttpRequestMessage(method, apiPath);
|
||||
|
||||
|
||||
var json = JsonConvert.SerializeObject(body);
|
||||
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||
var _res = await client.SendAsync(request, combinedCts.Token);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
return _result;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<string> PostExternalAPIAsync(string apiPath, string accessToken, object? body, string apiKey, CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
// กำหนด timeout เป็น 30 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
var json = JsonConvert.SerializeObject(body);
|
||||
var stringContent = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
//stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||
var _res = await client.PostAsync(apiPath, stringContent, combinedCts.Token);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
return _result;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task<bool> PostExternalAPIBooleanAsync(string apiPath, string accessToken, object? body, string apiKey, CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
// กำหนด timeout เป็น 30 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
var json = JsonConvert.SerializeObject(body);
|
||||
var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
|
||||
stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
|
|
@ -160,8 +87,36 @@ namespace BMA.EHR.Application.Repositories
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||
var _res = await client.PostAsync(apiPath, stringContent, combinedCts.Token);
|
||||
client.DefaultRequestHeaders.Add("api_key", apiKey);
|
||||
var _res = await client.PostAsync(apiPath, stringContent);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
return _result;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task<bool> PostExternalAPIBooleanAsync(string apiPath, string accessToken, object? body, string apiKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(body);
|
||||
var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
|
||||
stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", apiKey);
|
||||
var _res = await client.PostAsync(apiPath, stringContent);
|
||||
return _res.IsSuccessStatusCode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -2,11 +2,8 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO.Pipes;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Leaves
|
||||
{
|
||||
|
|
@ -46,38 +43,6 @@ namespace BMA.EHR.Application.Repositories.Leaves
|
|||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<string> PostExternalAPIAsync(string apiPath, string accessToken, object? body, string apiKey, CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
// กำหนด timeout เป็น 30 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
var json = JsonConvert.SerializeObject(body);
|
||||
var stringContent = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
//stringContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", apiKey);
|
||||
var _res = await client.PostAsync(apiPath, stringContent, combinedCts.Token);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
return _result;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual async Task<IReadOnlyList<T>> GetAllAsync()
|
||||
{
|
||||
return await _dbSet.ToListAsync();
|
||||
|
|
@ -103,24 +68,6 @@ namespace BMA.EHR.Application.Repositories.Leaves
|
|||
return entity;
|
||||
}
|
||||
|
||||
public virtual async Task<IReadOnlyList<T>> AddRangeAsync(List<T> entities)
|
||||
{
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (entity is EntityBase)
|
||||
{
|
||||
(entity as EntityBase).CreatedUserId = UserId ?? "";
|
||||
(entity as EntityBase).CreatedFullName = FullName ?? "System Administrator";
|
||||
(entity as EntityBase).CreatedAt = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
await _dbSet.AddRangeAsync(entities);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
public virtual async Task<T> UpdateAsync(T entity)
|
||||
{
|
||||
if (entity is EntityBase)
|
||||
|
|
|
|||
|
|
@ -1,587 +0,0 @@
|
|||
using Amazon.S3.Model;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Messaging;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Leave.Commons;
|
||||
using BMA.EHR.Domain.Models.Leave.Requests;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||
{
|
||||
public class LeaveBeginningRepository : GenericLeaveRepository<Guid, LeaveBeginning>
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ILeaveDbContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly EmailSenderService _emailSenderService;
|
||||
|
||||
/// <summary>
|
||||
/// Keyed locks to serialize get-or-create for LeaveBeginning rows by (ProfileId, LeaveYear, LeaveTypeId).
|
||||
/// Prevents duplicate inserts when concurrent requests (e.g. UI calling /user/check twice) hit the same key.
|
||||
/// </summary>
|
||||
private static readonly ConcurrentDictionary<string, SemaphoreSlim> _getOrAddLocks = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destuctor "
|
||||
|
||||
public LeaveBeginningRepository(ILeaveDbContext dbContext,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
UserProfileRepository userProfileRepository,
|
||||
IConfiguration configuration,
|
||||
EmailSenderService emailSenderService) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_organizationCommonRepository = organizationCommonRepository;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_configuration = configuration;
|
||||
_emailSenderService = emailSenderService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
protected Guid UserOrganizationId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (UserId != null || UserId != "")
|
||||
return _userProfileRepository.GetUserOCId(Guid.Parse(UserId!), AccessToken);
|
||||
else
|
||||
return Guid.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public async Task<List<LeaveBeginning>> GetAllByYearAsync(int year)
|
||||
{
|
||||
return await _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.Where(x => x.LeaveYear == year)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<LeaveBeginning?> GetByYearAndTypeIdAsync(int year, Guid typeId)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId);
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task UpdateLeaveUsageAsync(int year, Guid typeId, Guid userId, double day)
|
||||
{
|
||||
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||
if (pf == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
var data = await _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
data.LeaveDaysUsed += day;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task UpdateLeaveCountAsync(int year, Guid typeId, Guid userId, int count)
|
||||
{
|
||||
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||
if (pf == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
var data = await _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
data.LeaveCount += count;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task ProcessEarlyLeaveRequest(int year)
|
||||
{
|
||||
// Get Early Leave Request (กรองตามปีงบประมาณ: 1 ต.ค. (year-1) – 30 ก.ย. (year))
|
||||
var fiscalStart = new DateTime(year - 1, 10, 1);
|
||||
var fiscalEnd = new DateTime(year, 9, 30);
|
||||
|
||||
var leaveReq = await _dbContext.Set<LeaveRequest>()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
.Where(x => x.LeaveStartDate.Date <= fiscalEnd && x.LeaveEndDate.Date >= fiscalStart)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var leave in leaveReq)
|
||||
{
|
||||
await GetByYearAndTypeIdForUserWithUpdateAsync(year, leave.Type.Id, leave.KeycloakUserId);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ProcessEarlyLeaveRequestSchedule()
|
||||
{
|
||||
int year = DateTime.Now.Year;
|
||||
await ProcessEarlyLeaveRequest(year);
|
||||
}
|
||||
|
||||
public async Task<LeaveBeginning?> GetByYearAndTypeIdForUserAsync(int year, Guid typeId, Guid userId)
|
||||
{
|
||||
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||
if (pf == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||
|
||||
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||
|
||||
LeaveBeginning Factory()
|
||||
{
|
||||
var limit = 0.0;
|
||||
|
||||
var prev = _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
// คำนวณปีงบประมาณจาก startDate (ปีงบประมาณเริ่ม 1 ต.ค. และสิ้นสุด 30 ก.ย.)
|
||||
var isCurrentYear = DateTime.Now.Year == year;
|
||||
|
||||
|
||||
var prevRemain = 0.0;
|
||||
if (prev != null)
|
||||
{
|
||||
prevRemain = isCurrentYear ? prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0) : 0.0;
|
||||
}
|
||||
|
||||
if (govAge >= 180)
|
||||
{
|
||||
if (govAge >= 3650)
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 30) limit = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 20) limit = 20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 0.0;
|
||||
}
|
||||
|
||||
return new LeaveBeginning
|
||||
{
|
||||
LeaveYear = year,
|
||||
LeaveTypeId = typeId,
|
||||
ProfileId = pf.Id,
|
||||
Prefix = pf.Prefix,
|
||||
FirstName = pf.FirstName,
|
||||
LastName = pf.LastName,
|
||||
LeaveDaysUsed = 0,
|
||||
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||
RootDnaId = pf.RootDnaId,
|
||||
Child1DnaId = pf.Child1DnaId,
|
||||
Child2DnaId = pf.Child2DnaId,
|
||||
Child3DnaId = pf.Child3DnaId,
|
||||
Child4DnaId = pf.Child4DnaId
|
||||
};
|
||||
}
|
||||
|
||||
return await GetOrAddForUserAsync(year, typeId, pf.Id, Factory);
|
||||
}
|
||||
|
||||
public async Task<LeaveBeginning?> GetByYearAndTypeIdForUserWithUpdateAsync(int year, Guid typeId, Guid userId)
|
||||
{
|
||||
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||
if (pf == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||
|
||||
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||
|
||||
|
||||
var limit = 0.0;
|
||||
|
||||
var prev = _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
var prevRemain = 0.0;
|
||||
|
||||
|
||||
|
||||
if (prev != null)
|
||||
{
|
||||
prevRemain = prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0);
|
||||
}
|
||||
|
||||
if (govAge >= 180)
|
||||
{
|
||||
if (govAge >= 3650)
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 30) limit = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 20) limit = 20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 0.0;
|
||||
}
|
||||
|
||||
var data = await _dbContext.Set<LeaveBeginning>()
|
||||
.Where(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == pf.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
data.LeaveDays = leaveType?.Code == "LV-005" ? limit : 0;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// return new LeaveBeginning
|
||||
// {
|
||||
// LeaveYear = year,
|
||||
// LeaveTypeId = typeId,
|
||||
// ProfileId = pf.Id,
|
||||
// Prefix = pf.Prefix,
|
||||
// FirstName = pf.FirstName,
|
||||
// LastName = pf.LastName,
|
||||
// LeaveDaysUsed = 0,
|
||||
// LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||
// RootDnaId = pf.RootDnaId,
|
||||
// Child1DnaId = pf.Child1DnaId,
|
||||
// Child2DnaId = pf.Child2DnaId,
|
||||
// Child3DnaId = pf.Child3DnaId,
|
||||
// Child4DnaId = pf.Child4DnaId
|
||||
// };
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<LeaveBeginning?> GetByYearAndTypeIdForUser(int year, Guid typeId, GetProfileByKeycloakIdDto? pf)
|
||||
{
|
||||
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||
|
||||
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||
|
||||
LeaveBeginning Factory()
|
||||
{
|
||||
var limit = 0.0;
|
||||
|
||||
var prev = _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
// คำนวณปีงบประมาณจาก startDate (ปีงบประมาณเริ่ม 1 ต.ค. และสิ้นสุด 30 ก.ย.)
|
||||
var isCurrentYear = DateTime.Now.Year == year;
|
||||
|
||||
var prevRemain = 0.0;
|
||||
if (prev != null)
|
||||
{
|
||||
prevRemain = isCurrentYear ? prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0) : 0.0;
|
||||
}
|
||||
|
||||
if (govAge >= 180)
|
||||
{
|
||||
if (govAge >= 3650)
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 30) limit = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 20) limit = 20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 0.0;
|
||||
}
|
||||
|
||||
return new LeaveBeginning
|
||||
{
|
||||
LeaveYear = year,
|
||||
LeaveTypeId = typeId,
|
||||
ProfileId = pf.Id,
|
||||
Prefix = pf.Prefix,
|
||||
FirstName = pf.FirstName,
|
||||
LastName = pf.LastName,
|
||||
LeaveDaysUsed = 0,
|
||||
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||
RootDnaId = pf.RootDnaId,
|
||||
Child1DnaId = pf.Child1DnaId,
|
||||
Child2DnaId = pf.Child2DnaId,
|
||||
Child3DnaId = pf.Child3DnaId,
|
||||
Child4DnaId = pf.Child4DnaId
|
||||
};
|
||||
}
|
||||
|
||||
return await GetOrAddForUserAsync(year, typeId, pf.Id, Factory);
|
||||
}
|
||||
|
||||
public async Task<LeaveBeginning?> GetByYearAndTypeIdForUser2Async(int year, Guid typeId, Guid userId)
|
||||
{
|
||||
// var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
||||
var pf = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken);
|
||||
if (pf == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||
|
||||
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||
|
||||
LeaveBeginning Factory()
|
||||
{
|
||||
var limit = 0.0;
|
||||
|
||||
var prev = _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefault(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
// คำนวณปีงบประมาณจาก startDate (ปีงบประมาณเริ่ม 1 ต.ค. และสิ้นสุด 30 ก.ย.)
|
||||
var isCurrentYear = DateTime.Now.Year == year;
|
||||
|
||||
var prevRemain = 0.0;
|
||||
if (prev != null)
|
||||
{
|
||||
prevRemain = isCurrentYear ? prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0) : 0.0;
|
||||
}
|
||||
|
||||
if (govAge >= 180)
|
||||
{
|
||||
if (govAge >= 3650)
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 30) limit = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 20) limit = 20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 0.0;
|
||||
}
|
||||
|
||||
return new LeaveBeginning
|
||||
{
|
||||
LeaveYear = year,
|
||||
LeaveTypeId = typeId,
|
||||
ProfileId = pf.Id,
|
||||
Prefix = pf.Prefix,
|
||||
FirstName = pf.FirstName,
|
||||
LastName = pf.LastName,
|
||||
LeaveDaysUsed = 0,
|
||||
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||
RootDnaId = pf.RootDnaId,
|
||||
Child1DnaId = pf.Child1DnaId,
|
||||
Child2DnaId = pf.Child2DnaId,
|
||||
Child3DnaId = pf.Child3DnaId,
|
||||
Child4DnaId = pf.Child4DnaId
|
||||
};
|
||||
}
|
||||
|
||||
return await GetOrAddForUserAsync(year, typeId, pf.Id, Factory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get-or-create a LeaveBeginning row for (ProfileId, LeaveYear, LeaveTypeId) with concurrency protection.
|
||||
/// Uses a keyed SemaphoreSlim to serialize within-process requests, and re-queries after acquiring the lock.
|
||||
/// If a cross-process insert wins (unique index violation), the duplicate key exception is caught and the row
|
||||
/// created by the winner is returned.
|
||||
/// </summary>
|
||||
private async Task<LeaveBeginning?> GetOrAddForUserAsync(int year, Guid typeId, Guid profileId, Func<LeaveBeginning> factory)
|
||||
{
|
||||
var key = $"{profileId}_{year}_{typeId}";
|
||||
var semaphore = _getOrAddLocks.GetOrAdd(key, _ => new SemaphoreSlim(1, 1));
|
||||
await semaphore.WaitAsync();
|
||||
try
|
||||
{
|
||||
// Re-query inside the lock — another thread may have created it while we waited.
|
||||
var existing = await _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == profileId);
|
||||
if (existing != null)
|
||||
{
|
||||
return existing;
|
||||
}
|
||||
|
||||
var entity = factory();
|
||||
_dbContext.Set<LeaveBeginning>().Add(entity);
|
||||
try
|
||||
{
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
catch (DbUpdateException)
|
||||
{
|
||||
// Cross-process/cross-server race hit the unique index (IX_LeaveBeginnings_ProfileId_LeaveYear_LeaveTypeId).
|
||||
// Detach the failed insert and return the row created by the winner.
|
||||
_dbContext.Detach(entity);
|
||||
var winner = await _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefaultAsync(x => x.LeaveYear == year && x.LeaveTypeId == typeId && x.ProfileId == profileId);
|
||||
return winner;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
semaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<LeaveBeginning>> GetAllByYearAndTypeAsync(int year, Guid typeId, List<ProfileData> userIdList)
|
||||
{
|
||||
|
||||
var updateList = new List<LeaveBeginning>();
|
||||
var result = new List<LeaveBeginning>();
|
||||
|
||||
var beginningList = await _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.Where(x => x.LeaveYear == year && x.LeaveTypeId == typeId)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var pf in userIdList)
|
||||
{
|
||||
//var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(id, AccessToken);
|
||||
//if (pf == null)
|
||||
//{
|
||||
// continue; // Goto Next Id
|
||||
//}
|
||||
|
||||
var profile = await _userProfileRepository.GetProfileByProfileIdAsync(pf.Id, AccessToken);
|
||||
if (profile == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var govAge = (pf?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
|
||||
|
||||
var leaveType = await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Id == typeId);
|
||||
|
||||
var data = beginningList.FirstOrDefault(x => x.ProfileId == pf.Id);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
var limit = 0.0;
|
||||
|
||||
var prev = await _dbContext.Set<LeaveBeginning>()
|
||||
.Include(x => x.LeaveType)
|
||||
.FirstOrDefaultAsync(x => x.LeaveYear == year - 1 && x.LeaveTypeId == typeId && x.ProfileId == pf.Id);
|
||||
|
||||
var prevRemain = 0.0;
|
||||
if (prev != null)
|
||||
{
|
||||
prevRemain = prev.LeaveDays - (prev.LeaveDaysUsed ?? 0.0);
|
||||
}
|
||||
|
||||
if (govAge >= 180)
|
||||
{
|
||||
if (govAge >= 3650)
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 30) limit = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 10 + prevRemain;
|
||||
if (limit > 20) limit = 20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 0.0;
|
||||
}
|
||||
|
||||
data = new LeaveBeginning
|
||||
{
|
||||
LeaveYear = year,
|
||||
LeaveTypeId = typeId,
|
||||
ProfileId = pf.Id,
|
||||
Prefix = pf.Prefix,
|
||||
FirstName = pf.FirstName,
|
||||
LastName = pf.LastName,
|
||||
LeaveDaysUsed = 0,
|
||||
LeaveDays = leaveType?.Code == "LV-005" ? limit : 0,
|
||||
RootDnaId = profile.RootDnaId,
|
||||
Child1DnaId = profile.Child1DnaId,
|
||||
Child2DnaId = profile.Child2DnaId,
|
||||
Child3DnaId = profile.Child3DnaId,
|
||||
Child4DnaId = profile.Child4DnaId
|
||||
};
|
||||
|
||||
updateList.Add(data);
|
||||
}
|
||||
result.Add(data);
|
||||
}
|
||||
if (!updateList.Any())
|
||||
{
|
||||
await _dbContext.Set<LeaveBeginning>().AddRangeAsync(updateList);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class ProfileData
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
|
||||
public string Prefix { get; set; } = string.Empty;
|
||||
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? DateStart { get; set; } = null;
|
||||
|
||||
public DateTime? DateAppoint { get; set; } = null;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -9,8 +9,6 @@ using BMA.EHR.Domain.Shared;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||
{
|
||||
|
|
@ -74,38 +72,48 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
await base.AddAsync(entity);
|
||||
|
||||
var userId = UserId != null ? Guid.Parse(UserId) : Guid.Empty;
|
||||
// var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken ?? "");
|
||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken ?? "");
|
||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken ?? "");
|
||||
var profile_id = profile == null ? Guid.Empty : profile.Id;
|
||||
|
||||
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลากรณีพิเศษ (ไม่มีแจ้งเตือนไปยังผู้บังคับบัญชา) #969
|
||||
// send noti + inbox + mail
|
||||
// send inbox and notification
|
||||
var subject_str = $"มีการขออนุมัติลงเวลากรณีพิเศษ";
|
||||
var body_str = $"โปรดพิจารณาคำร้องขอลงเวลาในกรณีพิเศษจาก {profile.Prefix}{profile.FirstName} {profile.LastName} ในวันที่ {entity.CheckDate.Date.ToThaiShortDate2()}";
|
||||
|
||||
var subject = subject_str;
|
||||
var body = body_str;
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
|
||||
|
||||
var inbox = new Inbox
|
||||
var rootOc = _userProfileRepository.GetRootOcId(profile_id, AccessToken);
|
||||
var approver = string.Empty;
|
||||
var list = new List<OrganizationApproverResponse>();
|
||||
if (rootOc != null)
|
||||
{
|
||||
Subject = subject_str,
|
||||
Body = body_str,
|
||||
ReceiverUserId = profile.CommanderId == Guid.Empty || profile.CommanderId == null ? Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6") : profile.CommanderId.Value,
|
||||
Payload = "",
|
||||
};
|
||||
_appContext.Set<Inbox>().Add(inbox);
|
||||
|
||||
var noti = new Notification
|
||||
list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
|
||||
}
|
||||
if (list.Count > 0)
|
||||
{
|
||||
Body = body_str,
|
||||
ReceiverUserId = profile.CommanderId == Guid.Empty || profile.CommanderId == null ? Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6") : profile.CommanderId.Value,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_appContext.Set<Notification>().Add(noti);
|
||||
await _appContext.SaveChangesAsync();
|
||||
var appr = list.FirstOrDefault();
|
||||
|
||||
// send inbox and notification
|
||||
var subject_str = $"มีการขออนุมัติลงเวลากรณีพิเศษ";
|
||||
var body_str = $"โปรดพิจารณาคำร้องขอลงเวลาในกรณีพิเศษจาก {profile.Prefix}{profile.FirstName} {profile.LastName} ในวันที่ {entity.CheckDate.Date.ToThaiShortDate2()}";
|
||||
|
||||
var subject = subject_str;
|
||||
var body = body_str;
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
|
||||
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = subject_str,
|
||||
Body = body_str,
|
||||
ReceiverUserId = appr.Id == Guid.Empty ? Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6") : appr.Id,
|
||||
Payload = "",
|
||||
};
|
||||
_appContext.Set<Inbox>().Add(inbox);
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = body_str,
|
||||
ReceiverUserId = appr.Id == Guid.Empty ? Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6") : appr.Id,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_appContext.Set<Notification>().Add(noti);
|
||||
await _appContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
|
@ -145,147 +153,6 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<AdditionalCheckRequest>> GetAdditionalCheckRequestsByAdminRole(int year, int month, string role, string nodeId, int? node, string? keyword)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _dbContext.Set<AdditionalCheckRequest>().AsQueryable()
|
||||
.Where(x => (x.CheckDate.Year == year && x.CheckDate.Month == month))
|
||||
.OrderByDescending(x => x.CreatedAt.Date)
|
||||
.ToListAsync();
|
||||
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
data = data.Where(x =>
|
||||
(
|
||||
(x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword)
|
||||
|| x.Description.Contains(keyword)
|
||||
|
||||
).ToList();
|
||||
}
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
data = data
|
||||
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))))
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
data = data
|
||||
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
data = data
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!)).ToList();
|
||||
}
|
||||
// else if (role == "PARENT")
|
||||
// {
|
||||
// data = data
|
||||
// .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null && x.Child1DnaId != Guid.Empty).ToList();
|
||||
// }
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
data = data.Where(x =>
|
||||
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) &&
|
||||
(x.Child1DnaId == Guid.Empty || x.Child1DnaId == null) :
|
||||
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) &&
|
||||
(x.Child2DnaId == Guid.Empty || x.Child2DnaId == null) :
|
||||
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) &&
|
||||
(x.Child3DnaId == Guid.Empty || x.Child3DnaId == null) :
|
||||
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) &&
|
||||
(x.Child4DnaId == Guid.Empty || x.Child4DnaId == null) :
|
||||
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||
true
|
||||
).ToList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<AdditionalCheckRequest>> GetAdditionalCheckRequestsByAdminRole2(DateTime startDate, DateTime endDate, string role, string nodeId, int? node, string? keyword, string? status)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _dbContext.Set<AdditionalCheckRequest>().AsQueryable()
|
||||
.Where(x => (x.CheckDate.Date >= startDate.Date && x.CheckDate.Date <= endDate.Date))
|
||||
.OrderByDescending(x => x.CreatedAt.Date)
|
||||
.ToListAsync();
|
||||
|
||||
if(!string.IsNullOrEmpty(status))
|
||||
data = data.Where(x => x.Status == status).ToList();
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
data = data.Where(x =>
|
||||
(
|
||||
(x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword)
|
||||
|| x.Description.Contains(keyword)
|
||||
|
||||
).ToList();
|
||||
}
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
data = data
|
||||
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))))
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
data = data
|
||||
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
data = data
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!)).ToList();
|
||||
}
|
||||
// else if (role == "PARENT")
|
||||
// {
|
||||
// data = data
|
||||
// .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null && x.Child1DnaId != Guid.Empty).ToList();
|
||||
// }
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
data = data.Where(x =>
|
||||
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) &&
|
||||
(x.Child1DnaId == Guid.Empty || x.Child1DnaId == null) :
|
||||
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) &&
|
||||
(x.Child2DnaId == Guid.Empty || x.Child2DnaId == null) :
|
||||
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) &&
|
||||
(x.Child3DnaId == Guid.Empty || x.Child3DnaId == null) :
|
||||
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) &&
|
||||
(x.Child4DnaId == Guid.Empty || x.Child4DnaId == null) :
|
||||
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||
true
|
||||
).ToList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,191 +0,0 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||
{
|
||||
public class CheckInJobStatusRepository : GenericLeaveRepository<Guid, CheckInJobStatus>
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ILeaveDbContext _dbContext;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public CheckInJobStatusRepository(ILeaveDbContext dbContext,
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูล Job Status จาก TaskId
|
||||
/// </summary>
|
||||
public async Task<CheckInJobStatus?> GetByTaskIdAsync(Guid taskId)
|
||||
{
|
||||
var data = await _dbContext.Set<CheckInJobStatus>()
|
||||
.Where(x => x.TaskId == taskId)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูล Job Status จาก UserId และสถานะ
|
||||
/// </summary>
|
||||
public async Task<List<CheckInJobStatus>> GetByUserIdAndStatusAsync(Guid userId, string status)
|
||||
{
|
||||
var data = await _dbContext.Set<CheckInJobStatus>()
|
||||
.Where(x => x.KeycloakUserId == userId && x.Status == status)
|
||||
.OrderByDescending(x => x.CreatedDate)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูล Job Status ที่ยัง pending หรือ processing
|
||||
/// </summary>
|
||||
public async Task<List<CheckInJobStatus>> GetPendingOrProcessingJobsAsync(Guid userId)
|
||||
{
|
||||
var data = await _dbContext.Set<CheckInJobStatus>()
|
||||
.Where(x => x.KeycloakUserId == userId &&
|
||||
(x.Status == "PENDING" || x.Status == "PROCESSING"))
|
||||
//.OrderByDescending(x => x.CreatedDate)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปเดตสถานะเป็น Processing
|
||||
/// </summary>
|
||||
public async Task<CheckInJobStatus> UpdateToProcessingAsync(Guid taskId)
|
||||
{
|
||||
var job = await GetByTaskIdAsync(taskId);
|
||||
if (job != null)
|
||||
{
|
||||
job.Status = "PROCESSING";
|
||||
job.ProcessingDate = DateTime.Now;
|
||||
await UpdateAsync(job);
|
||||
}
|
||||
return job!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปเดตสถานะเป็น Completed
|
||||
/// </summary>
|
||||
public async Task<CheckInJobStatus> UpdateToCompletedAsync(Guid taskId, string? additionalData = null)
|
||||
{
|
||||
var job = await GetByTaskIdAsync(taskId);
|
||||
if (job != null)
|
||||
{
|
||||
job.Status = "COMPLETED";
|
||||
job.CompletedDate = DateTime.Now;
|
||||
if (!string.IsNullOrEmpty(additionalData))
|
||||
{
|
||||
job.AdditionalData = additionalData;
|
||||
}
|
||||
await UpdateAsync(job);
|
||||
}
|
||||
return job!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปเดตสถานะเป็น Failed
|
||||
/// </summary>
|
||||
public async Task<CheckInJobStatus> UpdateToFailedAsync(Guid taskId, string errorMessage)
|
||||
{
|
||||
var job = await GetByTaskIdAsync(taskId);
|
||||
if (job != null)
|
||||
{
|
||||
job.Status = "FAILED";
|
||||
job.CompletedDate = DateTime.Now;
|
||||
job.ErrorMessage = errorMessage;
|
||||
await UpdateAsync(job);
|
||||
}
|
||||
return job!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูลงานที่ค้างอยู่ในสถานะ PENDING หรือ PROCESSING เกินเวลาที่กำหนด (นาที)
|
||||
/// </summary>
|
||||
public async Task<List<CheckInJobStatus>> GetStalePendingOrProcessingJobsAsync(int timeoutMinutes = 30)
|
||||
{
|
||||
//var cutoffDate = DateTime.Now.AddMinutes(-timeoutMinutes);
|
||||
var cutoffDate = DateTime.Now.AddMinutes(-timeoutMinutes);
|
||||
var staleJobs = await _dbContext.Set<CheckInJobStatus>()
|
||||
.Where(x => (x.Status == "PENDING" || x.Status == "PROCESSING")
|
||||
&& x.CreatedDate <= cutoffDate)
|
||||
.OrderBy(x => x.CreatedDate)
|
||||
.ToListAsync();
|
||||
|
||||
return staleJobs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูลงานที่ค้างอยู่ในสถานะ PENDING หรือ PROCESSING เกินเวลาที่กำหนด (นาที) ของ user คนใดคนหนึ่ง
|
||||
/// </summary>
|
||||
public async Task<List<CheckInJobStatus>> GetStalePendingOrProcessingJobsByUserAsync(Guid userId, int timeoutMinutes = 30)
|
||||
{
|
||||
var cutoffDate = DateTime.Now.AddMinutes(-timeoutMinutes);
|
||||
//var cutoffDate = new DateTime(2026, 5, 28, 23, 59, 59);
|
||||
var staleJobs = await _dbContext.Set<CheckInJobStatus>()
|
||||
.Where(x => x.KeycloakUserId == userId
|
||||
&& (x.Status == "PENDING" || x.Status == "PROCESSING")
|
||||
&& x.CreatedDate < cutoffDate)
|
||||
.OrderBy(x => x.CreatedDate)
|
||||
.ToListAsync();
|
||||
|
||||
return staleJobs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mark งานที่ค้างเกินเวลาที่กำหนดเป็น FAILED
|
||||
/// </summary>
|
||||
public async Task<int> MarkStaleJobsAsFailedAsync(int timeoutMinutes = 30)
|
||||
{
|
||||
var staleJobs = await GetStalePendingOrProcessingJobsAsync(timeoutMinutes);
|
||||
|
||||
foreach (var job in staleJobs)
|
||||
{
|
||||
job.Status = "FAILED";
|
||||
job.CompletedDate = DateTime.Now;
|
||||
job.ErrorMessage = $"งานค้างในสถานะ {job.Status} เกิน {timeoutMinutes} นาที ระบบทำเครื่องหมายเป็น FAILED อัตโนมัติ";
|
||||
}
|
||||
|
||||
if (staleJobs.Any())
|
||||
{
|
||||
_dbContext.Set<CheckInJobStatus>().UpdateRange(staleJobs);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
return staleJobs.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ล้างข้อมูล Job Status ที่เก่าเกิน X วัน
|
||||
/// </summary>
|
||||
public async Task<int> CleanupOldJobsAsync(int daysOld = 30)
|
||||
{
|
||||
var cutoffDate = DateTime.Now.AddDays(-daysOld);
|
||||
var oldJobs = await _dbContext.Set<CheckInJobStatus>()
|
||||
.Where(x => x.CreatedDate < cutoffDate)
|
||||
.ToListAsync();
|
||||
|
||||
_dbContext.Set<CheckInJobStatus>().RemoveRange(oldJobs);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
return oldJobs.Count;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -61,12 +61,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return await _dbContext.Set<DutyTime>().Where(x => x.IsActive).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<DutyTime?> GetDefaultAsync(CancellationToken cancellationToken = default)
|
||||
public async Task<DutyTime?> GetDefaultAsync()
|
||||
{
|
||||
// กำหนด timeout เป็น 30 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
return await _dbContext.Set<DutyTime>().Where(x => x.IsDefault).FirstOrDefaultAsync(combinedCts.Token);
|
||||
return await _dbContext.Set<DutyTime>().Where(x => x.IsDefault).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -1,795 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.Json;
|
||||
using System.IO;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories.Leaves.LeaveRequests;
|
||||
using BMA.EHR.Application.Repositories.MetaData;
|
||||
using BMA.EHR.Application.Responses.Profiles;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||
{
|
||||
public class LeaveProcessJobStatusRepository: GenericLeaveRepository<Guid, LeaveProcessJobStatus>
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ILeaveDbContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly HolidayRepository _holidayRepository;
|
||||
private readonly DutyTimeRepository _dutyTimeRepository;
|
||||
private readonly UserDutyTimeRepository _userDutyTimeRepository;
|
||||
private readonly ProcessUserTimeStampRepository _processUserTimeStampRepository;
|
||||
private readonly LeaveRequestRepository _leaveRequestRepository;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly IWebHostEnvironment _env;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public LeaveProcessJobStatusRepository(ILeaveDbContext dbContext,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
UserProfileRepository userProfileRepository,
|
||||
HolidayRepository holidayRepository,
|
||||
DutyTimeRepository dutyTimeRepository,
|
||||
UserDutyTimeRepository userDutyTimeRepository,
|
||||
ProcessUserTimeStampRepository processUserTimeStampRepository,
|
||||
LeaveRequestRepository leaveRequestRepository,
|
||||
IConfiguration configuration,
|
||||
IWebHostEnvironment env) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_holidayRepository = holidayRepository;
|
||||
_configuration = configuration;
|
||||
_leaveRequestRepository = leaveRequestRepository;
|
||||
_dutyTimeRepository = dutyTimeRepository;
|
||||
_userDutyTimeRepository = userDutyTimeRepository;
|
||||
_processUserTimeStampRepository = processUserTimeStampRepository;
|
||||
_env = env;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูล Job Status จาก TaskId
|
||||
/// </summary>
|
||||
public async Task<LeaveProcessJobStatus?> GetByTaskIdAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูล Job Status จาก UserId และสถานะ
|
||||
/// </summary>
|
||||
public async Task<List<LeaveProcessJobStatus>> GetByUserIdAndStatusAsync(Guid userId, string status)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||
.Where(x => x.CreatedUserId == userId.ToString("D") && x.Status == status)
|
||||
.OrderByDescending(x => x.CreatedDate)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูล Job Status จาก UserId
|
||||
/// </summary>
|
||||
public async Task<List<LeaveProcessJobStatus>> GetByUserIdAsync(Guid userId)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||
.Where(x => x.CreatedUserId == userId.ToString("D"))
|
||||
.OrderByDescending(x => x.CreatedDate)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ดึงข้อมูล Job Status ที่ยัง pending หรือ processing
|
||||
/// </summary>
|
||||
public async Task<List<LeaveProcessJobStatus>> GetPendingOrProcessingJobsAsync(Guid userId)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||
.Where(x => x.CreatedUserId == userId.ToString("D") &&
|
||||
(x.Status == "PENDING" || x.Status == "PROCESSING"))
|
||||
//.OrderByDescending(x => x.CreatedDate)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<LeaveProcessJobStatus>> GetPendingJobsAsync()
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveProcessJobStatus>()
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปเดตสถานะเป็น Processing
|
||||
/// </summary>
|
||||
public async Task<LeaveProcessJobStatus> UpdateToProcessingAsync(Guid id)
|
||||
{
|
||||
var job = await GetByTaskIdAsync(id);
|
||||
if (job != null)
|
||||
{
|
||||
job.Status = "PROCESSING";
|
||||
job.ProcessingDate = DateTime.Now;
|
||||
await UpdateAsync(job);
|
||||
}
|
||||
return job!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปเดตสถานะเป็น Completed
|
||||
/// </summary>
|
||||
public async Task<LeaveProcessJobStatus> UpdateToCompletedAsync(Guid id, string? additionalData = null)
|
||||
{
|
||||
var job = await GetByTaskIdAsync(id);
|
||||
if (job != null)
|
||||
{
|
||||
job.Status = "COMPLETED";
|
||||
job.CompletedDate = DateTime.Now;
|
||||
await UpdateAsync(job);
|
||||
}
|
||||
return job!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปเดตสถานะเป็น Failed
|
||||
/// </summary>
|
||||
public async Task<LeaveProcessJobStatus> UpdateToFailedAsync(Guid id, string errorMessage)
|
||||
{
|
||||
var job = await GetByTaskIdAsync(id);
|
||||
if (job != null)
|
||||
{
|
||||
job.Status = "FAILED";
|
||||
job.CompletedDate = DateTime.Now;
|
||||
job.ErrorMessage = errorMessage;
|
||||
await UpdateAsync(job);
|
||||
}
|
||||
return job!;
|
||||
}
|
||||
|
||||
public async Task ProcessTaskAsync(Guid rootDnaId, DateTime? startDate, DateTime? endDate)
|
||||
{
|
||||
|
||||
var profiles = new List<GetProfileByKeycloakIdRootDto>();
|
||||
var dateStart = startDate?.Date ?? DateTime.Now.Date;
|
||||
var dateEnd = endDate?.Date ?? DateTime.Now.Date;
|
||||
|
||||
var holidays = await _holidayRepository.GetHolidayAsync(dateStart, dateEnd);
|
||||
var weekend = _holidayRepository.GetWeekEnd(dateStart, dateEnd);
|
||||
var excludeDates = holidays.Union(weekend).ToList();
|
||||
|
||||
var dateList = new List<LoopDate>();
|
||||
for (DateTime i = dateStart; i <= dateEnd; i = i.AddDays(1))
|
||||
{
|
||||
if (holidays.Contains(i))
|
||||
{
|
||||
var d = await _holidayRepository.GetHolidayAsync(i);
|
||||
dateList.Add(new LoopDate
|
||||
{
|
||||
date = i,
|
||||
isHoliday = true,
|
||||
isWeekEnd = false,
|
||||
dateRemark = d
|
||||
});
|
||||
}
|
||||
else if (weekend.Contains(i))
|
||||
{
|
||||
dateList.Add(new LoopDate
|
||||
{
|
||||
date = i,
|
||||
isHoliday = true,
|
||||
isWeekEnd = false,
|
||||
dateRemark = "วันหยุด"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
dateList.Add(new LoopDate
|
||||
{
|
||||
date = i,
|
||||
isHoliday = false,
|
||||
isWeekEnd = false,
|
||||
dateRemark = ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
|
||||
if (defaultRound == null)
|
||||
{
|
||||
throw new Exception("ไม่พบรอบการลงเวลา Default");
|
||||
}
|
||||
|
||||
var employees = new List<DateResultReport>();
|
||||
|
||||
foreach (var dd in dateList.Where(x => !x.isHoliday && !x.isWeekEnd))
|
||||
{
|
||||
profiles = await _userProfileRepository.GetAllOfficerByRootDnaId(rootDnaId.ToString(),dd.date);
|
||||
foreach (var p in profiles)
|
||||
{
|
||||
var count = 1;
|
||||
var keycloakUserId = p.Keycloak ?? Guid.Empty;
|
||||
|
||||
var timeStamps = await _processUserTimeStampRepository.GetTimestampByDateAsync(keycloakUserId, dd.date);
|
||||
|
||||
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";
|
||||
|
||||
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id, dd.date);
|
||||
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
|
||||
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
|
||||
|
||||
var duty = userRound ?? defaultRound;
|
||||
|
||||
// check วันลาของแต่ละคน
|
||||
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(keycloakUserId, dd.date);
|
||||
var remarkStr = string.Empty;
|
||||
var status = string.Empty;
|
||||
var stampType = string.Empty;
|
||||
var stampAmount = 0.0;
|
||||
|
||||
if (leaveReq != null)
|
||||
{
|
||||
switch (leaveReq.Type.Code.ToUpper())
|
||||
{
|
||||
case "LV-001":
|
||||
case "LV-002":
|
||||
case "LV-005":
|
||||
remarkStr += leaveReq.Type.Name;
|
||||
var leaveRange = leaveReq.LeaveRange == null ? "" : leaveReq.LeaveRange.ToUpper();
|
||||
|
||||
if(leaveReq.LeaveStartDate.Date == leaveReq.LeaveEndDate.Date)
|
||||
{
|
||||
if (leaveRange == "MORNING")
|
||||
remarkStr += "ครึ่งวันเช้า";
|
||||
else if (leaveRange == "AFTERNOON")
|
||||
remarkStr += "ครึ่งวันบ่าย";
|
||||
|
||||
|
||||
// var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||
// if (leaveRangeEnd == "MORNING")
|
||||
// remarkStr += "ครึ่งวันเช้า";
|
||||
// else if (leaveRangeEnd == "AFTERNOON")
|
||||
// remarkStr += "ครึ่งวันบ่าย";
|
||||
|
||||
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||
if (leaveRange != leaveRangeEnd)
|
||||
{
|
||||
if (leaveRangeEnd == "MORNING")
|
||||
remarkStr += " - ครึ่งวันเช้า";
|
||||
else if (leaveRangeEnd == "AFTERNOON")
|
||||
remarkStr += " - ครึ่งวันบ่าย";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dd.date == leaveReq.LeaveStartDate.Date)
|
||||
{
|
||||
if (leaveRange == "MORNING")
|
||||
remarkStr += "ครึ่งวันเช้า";
|
||||
else if (leaveRange == "AFTERNOON")
|
||||
remarkStr += "ครึ่งวันบ่าย";
|
||||
}
|
||||
else if(dd.date == leaveReq.LeaveEndDate.Date)
|
||||
{
|
||||
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||
if (leaveRangeEnd == "MORNING")
|
||||
remarkStr += "ครึ่งวันเช้า";
|
||||
else if (leaveRangeEnd == "AFTERNOON")
|
||||
remarkStr += "ครึ่งวันบ่าย";
|
||||
else
|
||||
remarkStr += "เต็มวัน";
|
||||
}
|
||||
else
|
||||
{
|
||||
remarkStr += "เต็มวัน";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
remarkStr += leaveReq.Type.Name;
|
||||
break;
|
||||
}
|
||||
status = "LEAVE";
|
||||
if(leaveReq.LeaveStartDate.Date == dd.date)
|
||||
{
|
||||
stampType = leaveReq.LeaveRange ?? "";
|
||||
stampAmount = leaveReq.LeaveRange != "ALL" ? 0.5 : 1;
|
||||
}
|
||||
else if(leaveReq.LeaveEndDate.Date == dd.date)
|
||||
{
|
||||
stampAmount = leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||
stampType = leaveReq.LeaveRangeEnd ?? "";
|
||||
}
|
||||
else
|
||||
stampAmount = leaveReq.LeaveRange != "ALL" || leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||
if(stampType == "ALL") stampType = "FULL_DAY";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timeStamps == null)
|
||||
{
|
||||
if (dd.date <= DateTime.Now.Date)
|
||||
{
|
||||
remarkStr = "ขาดราชการ";
|
||||
status = "ABSENT";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
if (dd.isHoliday == true)
|
||||
{
|
||||
remarkStr = $"วันหยุด ({dd.dateRemark})";
|
||||
status = "HOLIDAY";
|
||||
}
|
||||
else if (dd.isWeekEnd)
|
||||
{
|
||||
remarkStr = dd.dateRemark;
|
||||
status = "WEEKEND";
|
||||
}
|
||||
}
|
||||
else remarkStr = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
// check status ของการลงเวลา
|
||||
if (timeStamps.CheckOut != null)
|
||||
{
|
||||
if (timeStamps.CheckOutStatus == "ABSENT")
|
||||
{
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckOut ? $" (นอกสถานที่:{timeStamps.CheckOutLocationName})".Trim() : "");
|
||||
status = "ABSENT";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
}
|
||||
else if (timeStamps.CheckInStatus == "ABSENT")
|
||||
{
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
status = "ABSENT";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
}
|
||||
else if (timeStamps.CheckInStatus == "LATE")
|
||||
{
|
||||
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
status = "LATE";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
//lateTotal += 1;
|
||||
}
|
||||
else
|
||||
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timeStamps.CheckInStatus == "ABSENT")
|
||||
{
|
||||
status = "ABSENT";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
}
|
||||
else if (timeStamps.CheckInStatus == "LATE")
|
||||
{
|
||||
status = "LATE";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
//lateTotal += 1;
|
||||
}
|
||||
else
|
||||
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var emp = new DateResultReport
|
||||
{
|
||||
profileId = p.Id.ToString(),
|
||||
stampDate = dd.date,
|
||||
stampType = stampType,
|
||||
stampAmount = stampAmount,
|
||||
remark = remarkStr,
|
||||
status = status
|
||||
};
|
||||
|
||||
employees.Add(emp);
|
||||
count++;
|
||||
}
|
||||
|
||||
// Write employees to JSON file
|
||||
// var fileName = $"employees_{DateTime.Now:yyyyMMdd_HHmmss}.txt";
|
||||
// var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Exports", fileName);
|
||||
|
||||
// // Ensure directory exists
|
||||
// var directory = Path.GetDirectoryName(filePath);
|
||||
// if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
|
||||
// {
|
||||
// Directory.CreateDirectory(directory);
|
||||
// }
|
||||
|
||||
// var jsonOptions = new JsonSerializerOptions
|
||||
// {
|
||||
// WriteIndented = true,
|
||||
// Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||
// };
|
||||
|
||||
// var jsonContent = JsonSerializer.Serialize(employees, jsonOptions);
|
||||
// await File.WriteAllTextAsync(filePath, jsonContent);
|
||||
}
|
||||
|
||||
//call api
|
||||
var apiPath = $"{_configuration["API"]}/org/unauthorize/profile/absent-late/batch";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
var body = new
|
||||
{
|
||||
records = employees.Where(x => x.status == "ABSENT" || x.status == "LATE").ToList()
|
||||
};
|
||||
|
||||
var apiResult = await PostExternalAPIAsync(apiPath, AccessToken ?? "", body, apiKey);
|
||||
if(apiResult == "")
|
||||
{
|
||||
throw new Exception($"เรียก API {apiPath} ไม่สำเร็จ");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ProcessEmpTaskAsync(Guid rootDnaId, DateTime? startDate, DateTime? endDate)
|
||||
{
|
||||
|
||||
var profiles = new List<GetProfileByKeycloakIdRootDto>();
|
||||
var dateStart = startDate?.Date ?? DateTime.Now.Date;
|
||||
var dateEnd = endDate?.Date ?? DateTime.Now.Date;
|
||||
|
||||
var holidays = await _holidayRepository.GetHolidayAsync(dateStart, dateEnd);
|
||||
var weekend = _holidayRepository.GetWeekEnd(dateStart, dateEnd);
|
||||
var excludeDates = holidays.Union(weekend).ToList();
|
||||
|
||||
var dateList = new List<LoopDate>();
|
||||
for (DateTime i = dateStart; i <= dateEnd; i = i.AddDays(1))
|
||||
{
|
||||
if (holidays.Contains(i))
|
||||
{
|
||||
var d = await _holidayRepository.GetHolidayAsync(i);
|
||||
dateList.Add(new LoopDate
|
||||
{
|
||||
date = i,
|
||||
isHoliday = true,
|
||||
isWeekEnd = false,
|
||||
dateRemark = d
|
||||
});
|
||||
}
|
||||
else if (weekend.Contains(i))
|
||||
{
|
||||
dateList.Add(new LoopDate
|
||||
{
|
||||
date = i,
|
||||
isHoliday = true,
|
||||
isWeekEnd = false,
|
||||
dateRemark = "วันหยุด"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
dateList.Add(new LoopDate
|
||||
{
|
||||
date = i,
|
||||
isHoliday = false,
|
||||
isWeekEnd = false,
|
||||
dateRemark = ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
|
||||
if (defaultRound == null)
|
||||
{
|
||||
throw new Exception("ไม่พบรอบการลงเวลา Default");
|
||||
}
|
||||
|
||||
var employees = new List<DateResultReport>();
|
||||
|
||||
foreach (var dd in dateList.Where(x => !x.isHoliday && !x.isWeekEnd))
|
||||
{
|
||||
profiles = await _userProfileRepository.GetAllEmployeeByRootDnaId(rootDnaId.ToString(),dd.date);
|
||||
foreach (var p in profiles)
|
||||
{
|
||||
var count = 1;
|
||||
var keycloakUserId = p.Keycloak ?? Guid.Empty;
|
||||
|
||||
var timeStamps = await _processUserTimeStampRepository.GetTimestampByDateAsync(keycloakUserId, dd.date);
|
||||
|
||||
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";
|
||||
|
||||
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id, dd.date);
|
||||
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
|
||||
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
|
||||
|
||||
var duty = userRound ?? defaultRound;
|
||||
|
||||
// check วันลาของแต่ละคน
|
||||
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(keycloakUserId, dd.date);
|
||||
var remarkStr = string.Empty;
|
||||
var status = string.Empty;
|
||||
var stampType = string.Empty;
|
||||
var stampAmount = 0.0;
|
||||
|
||||
if (leaveReq != null)
|
||||
{
|
||||
switch (leaveReq.Type.Code.ToUpper())
|
||||
{
|
||||
case "LV-001":
|
||||
case "LV-002":
|
||||
case "LV-005":
|
||||
remarkStr += leaveReq.Type.Name;
|
||||
var leaveRange = leaveReq.LeaveRange == null ? "" : leaveReq.LeaveRange.ToUpper();
|
||||
|
||||
if(leaveReq.LeaveStartDate.Date == leaveReq.LeaveEndDate.Date)
|
||||
{
|
||||
if (leaveRange == "MORNING")
|
||||
remarkStr += "ครึ่งวันเช้า";
|
||||
else if (leaveRange == "AFTERNOON")
|
||||
remarkStr += "ครึ่งวันบ่าย";
|
||||
|
||||
|
||||
// var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||
// if (leaveRangeEnd == "MORNING")
|
||||
// remarkStr += "ครึ่งวันเช้า";
|
||||
// else if (leaveRangeEnd == "AFTERNOON")
|
||||
// remarkStr += "ครึ่งวันบ่าย";
|
||||
|
||||
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||
if (leaveRange != leaveRangeEnd)
|
||||
{
|
||||
if (leaveRangeEnd == "MORNING")
|
||||
remarkStr += " - ครึ่งวันเช้า";
|
||||
else if (leaveRangeEnd == "AFTERNOON")
|
||||
remarkStr += " - ครึ่งวันบ่าย";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dd.date == leaveReq.LeaveStartDate.Date)
|
||||
{
|
||||
if (leaveRange == "MORNING")
|
||||
remarkStr += "ครึ่งวันเช้า";
|
||||
else if (leaveRange == "AFTERNOON")
|
||||
remarkStr += "ครึ่งวันบ่าย";
|
||||
}
|
||||
else if(dd.date == leaveReq.LeaveEndDate.Date)
|
||||
{
|
||||
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||
if (leaveRangeEnd == "MORNING")
|
||||
remarkStr += "ครึ่งวันเช้า";
|
||||
else if (leaveRangeEnd == "AFTERNOON")
|
||||
remarkStr += "ครึ่งวันบ่าย";
|
||||
}
|
||||
else
|
||||
{
|
||||
remarkStr += "เต็มวัน";
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
remarkStr += leaveReq.Type.Name;
|
||||
break;
|
||||
}
|
||||
status = "LEAVE";
|
||||
if(leaveReq.LeaveStartDate.Date == dd.date)
|
||||
{
|
||||
stampType = leaveReq.LeaveRange ?? "";
|
||||
stampAmount = leaveReq.LeaveRange != "ALL" ? 0.5 : 1;
|
||||
}
|
||||
else if(leaveReq.LeaveEndDate.Date == dd.date)
|
||||
{
|
||||
stampAmount = leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||
stampType = leaveReq.LeaveRangeEnd ?? "";
|
||||
}
|
||||
else
|
||||
stampAmount = leaveReq.LeaveRange != "ALL" || leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||
if(stampType == "ALL") stampType = "FULL_DAY";
|
||||
//stampAmount = leaveReq.LeaveRange != "ALL" || leaveReq.LeaveRangeEnd != "ALL" ? 0.5 : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timeStamps == null)
|
||||
{
|
||||
if (dd.date <= DateTime.Now.Date)
|
||||
{
|
||||
remarkStr = "ขาดราชการ";
|
||||
status = "ABSENT";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
if (dd.isHoliday == true)
|
||||
{
|
||||
remarkStr = $"วันหยุด ({dd.dateRemark})";
|
||||
status = "HOLIDAY";
|
||||
}
|
||||
else if (dd.isWeekEnd)
|
||||
{
|
||||
remarkStr = dd.dateRemark;
|
||||
status = "WEEKEND";
|
||||
}
|
||||
}
|
||||
else remarkStr = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
// check status ของการลงเวลา
|
||||
if (timeStamps.CheckOut != null)
|
||||
{
|
||||
if (timeStamps.CheckOutStatus == "ABSENT")
|
||||
{
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckOut ? $" (นอกสถานที่:{timeStamps.CheckOutLocationName})".Trim() : "");
|
||||
status = "ABSENT";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
}
|
||||
else if (timeStamps.CheckInStatus == "ABSENT")
|
||||
{
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
status = "ABSENT";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
}
|
||||
else if (timeStamps.CheckInStatus == "LATE")
|
||||
{
|
||||
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
status = "LATE";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
//lateTotal += 1;
|
||||
}
|
||||
else
|
||||
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timeStamps.CheckInStatus == "ABSENT")
|
||||
{
|
||||
status = "ABSENT";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
}
|
||||
else if (timeStamps.CheckInStatus == "LATE")
|
||||
{
|
||||
status = "LATE";
|
||||
stampType = "FULL_DAY";
|
||||
stampAmount = 1;
|
||||
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
//lateTotal += 1;
|
||||
}
|
||||
else
|
||||
remarkStr = !timeStamps.IsLocationCheckIn ? $" นอกสถานที่:{timeStamps.CheckInLocationName}".Trim() : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var emp = new DateResultReport
|
||||
{
|
||||
profileId = p.Id.ToString(),
|
||||
stampDate = dd.date,
|
||||
stampType = stampType,
|
||||
stampAmount = stampAmount,
|
||||
remark = remarkStr,
|
||||
status = status
|
||||
};
|
||||
|
||||
employees.Add(emp);
|
||||
count++;
|
||||
}
|
||||
|
||||
// Write employees to JSON file
|
||||
// var fileName = $"employees_{DateTime.Now:yyyyMMdd_HHmmss}.txt";
|
||||
// var filePath = Path.Combine(_env.ContentRootPath, "Exports", fileName);
|
||||
|
||||
// // Ensure directory exists
|
||||
// var directory = Path.GetDirectoryName(filePath);
|
||||
// if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
|
||||
// {
|
||||
// Directory.CreateDirectory(directory);
|
||||
// }
|
||||
|
||||
// var jsonOptions = new JsonSerializerOptions
|
||||
// {
|
||||
// WriteIndented = true,
|
||||
// Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||
// };
|
||||
|
||||
// var jsonContent = JsonSerializer.Serialize(employees, jsonOptions);
|
||||
// Console.WriteLine($"Writing file to: {filePath}");
|
||||
// await File.WriteAllTextAsync(filePath, jsonContent);
|
||||
// Console.WriteLine($"File written successfully: {fileName}");
|
||||
}
|
||||
|
||||
// call api
|
||||
var apiPath = $"{_configuration["API"]}/org/unauthorize/profile-employee/absent-late/batch";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
var body = new
|
||||
{
|
||||
records = employees.Where(x => x.status == "ABSENT" || x.status == "LATE").ToList()
|
||||
};
|
||||
|
||||
var apiResult = await PostExternalAPIAsync(apiPath, AccessToken ?? "", body, apiKey);
|
||||
if(apiResult == "")
|
||||
{
|
||||
throw new Exception($"เรียก API {apiPath} ไม่สำเร็จ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task ProcessPendingJobsAsync()
|
||||
{
|
||||
var pendingJobs = await GetPendingJobsAsync();
|
||||
Console.WriteLine($"พบงานที่ค้างอยู่ในสถานะ PENDING จำนวน {pendingJobs.Count} งาน");
|
||||
|
||||
foreach (var job in pendingJobs)
|
||||
{
|
||||
try
|
||||
{
|
||||
// อัปเดตสถานะเป็น Processing
|
||||
await UpdateToProcessingAsync(job.Id);
|
||||
|
||||
// ทำงานที่ต้องการที่นี่ (เช่น เรียก API, ประมวลผลข้อมูล ฯลฯ)
|
||||
await ProcessTaskAsync(job.RootDnaId,job.StartDate, job.EndDate);
|
||||
await ProcessEmpTaskAsync(job.RootDnaId,job.StartDate, job.EndDate);
|
||||
|
||||
// อัปเดตสถานะเป็น Completed
|
||||
await UpdateToCompletedAsync(job.Id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// หากเกิดข้อผิดพลาด อัปเดตสถานะเป็น Failed พร้อมข้อความแสดงข้อผิดพลาด
|
||||
await UpdateToFailedAsync(job.Id, ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
class LoopDate
|
||||
{
|
||||
public DateTime date { get; set; }
|
||||
|
||||
public bool isHoliday { get; set; }
|
||||
|
||||
public bool isWeekEnd { get; set; }
|
||||
|
||||
public string dateRemark { get; set; }
|
||||
|
||||
}
|
||||
|
||||
class DateResultReport
|
||||
{
|
||||
public string? profileId { get; set; }
|
||||
public DateTime stampDate { get; set; }
|
||||
public string stampType { get; set; }
|
||||
public double stampAmount { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string status { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -139,68 +139,6 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<ProcessUserTimeStamp>> GetTimestampByDateLateAsync(string type, string role, string nodeId, int? node, string nodeIdByReq, int? nodeByReq, DateTime StartDate, DateTime EndDate)
|
||||
{
|
||||
var data = new List<ProcessUserTimeStamp>();
|
||||
data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable()
|
||||
.Where(x => x.CheckInStatus == "LATE")
|
||||
.Where(u => u.CheckIn.Date >= StartDate && u.CheckIn.Date <= EndDate)
|
||||
.Where(x => x.ProfileType == type.Trim().ToUpper()).ToListAsync();
|
||||
// กรองตามสิทธิ์ admin ก่อน
|
||||
if (role == "CHILD")
|
||||
{
|
||||
data = data.Where(x =>
|
||||
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId) :
|
||||
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId) :
|
||||
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId) :
|
||||
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId) :
|
||||
node == 0 ? x.RootDnaId == Guid.Parse(nodeId) :
|
||||
node == null ? true : true
|
||||
).ToList();
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
data = data.Where(x =>
|
||||
node == 4 ? x.Child3DnaId == Guid.Parse(nodeId) :
|
||||
node == 3 ? x.Child2DnaId == Guid.Parse(nodeId) :
|
||||
node == 2 ? x.Child1DnaId == Guid.Parse(nodeId) :
|
||||
node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId) :
|
||||
node == null ? true : true
|
||||
).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
data = data.Where(x => x.RootDnaId == Guid.Parse(nodeId)).ToList();
|
||||
}
|
||||
// else if (role == "PARENT")
|
||||
// {
|
||||
// data = data.Where(x => x.RootDnaId == Guid.Parse(nodeId) && x.Child1DnaId != null).ToList();
|
||||
// }
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
data = data.Where(x =>
|
||||
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
|
||||
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
|
||||
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
|
||||
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
|
||||
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||
true
|
||||
).ToList();
|
||||
}
|
||||
// กรองตามที่ fe ส่งมา
|
||||
if (role == "ROOT" || role == "OWNER" || role == "CHILD" || role == "BROTHER" || role == "PARENT")
|
||||
{
|
||||
data = data.Where(x =>
|
||||
nodeByReq == 4 ? x.Child4DnaId == Guid.Parse(nodeIdByReq) :
|
||||
nodeByReq == 3 ? x.Child3DnaId == Guid.Parse(nodeIdByReq) :
|
||||
nodeByReq == 2 ? x.Child2DnaId == Guid.Parse(nodeIdByReq) :
|
||||
nodeByReq == 1 ? x.Child1DnaId == Guid.Parse(nodeIdByReq) :
|
||||
nodeByReq == 0 ? x.RootDnaId == Guid.Parse(nodeIdByReq) : true
|
||||
).ToList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<ProcessUserTimeStamp?> GetLastRecord(Guid keycloakId)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
|
|
@ -213,12 +151,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
|
||||
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryAsync(Guid keycloakId, int year, int page = 1, int pageSize = 10, string keyword = "")
|
||||
{
|
||||
var fiscalDateStart = new DateTime(year - 1, 10, 1);
|
||||
var fiscalDateEnd = new DateTime(year, 9, 30);
|
||||
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
.Where(u => u.CheckIn.Date >= fiscalDateStart && u.CheckIn.Date <= fiscalDateEnd)
|
||||
.Where(u => u.CheckIn.Year == year)
|
||||
.OrderByDescending(u => u.CheckIn.Date)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
|
|
@ -227,19 +162,6 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryAsync2(Guid keycloakId, int year)
|
||||
{
|
||||
var fiscalDateStart = new DateTime(year - 1, 10, 1);
|
||||
var fiscalDateEnd = new DateTime(year, 9, 30);
|
||||
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
.Where(u => u.CheckIn.Date >= fiscalDateStart && u.CheckIn.Date <= fiscalDateEnd)
|
||||
.OrderByDescending(u => u.CheckIn.Date)
|
||||
.ToListAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<int> GetTimeStampHistoryForAdminCountAsync(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
|
|
@ -272,55 +194,6 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryForAdminRoleAsync(DateTime startDate, DateTime endDate, string role, string nodeId, int? node)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.CheckIn.Date >= startDate.Date && u.CheckIn.Date <= endDate.Date)
|
||||
.OrderBy(u => u.CheckIn)
|
||||
|
||||
.ToListAsync();
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
data = data
|
||||
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))))
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
data = data
|
||||
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
data = data
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!))
|
||||
.ToList();
|
||||
}
|
||||
// else if (role == "PARENT")
|
||||
// {
|
||||
// data = data
|
||||
// .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null)
|
||||
// .ToList();
|
||||
// }
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
data = data.Where(x =>
|
||||
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
|
||||
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
|
||||
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
|
||||
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
|
||||
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||
true
|
||||
).ToList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<ProcessUserTimeStamp?> GetTimeStampById(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
{
|
||||
var data = _dbContext.Set<UserDutyTime>()
|
||||
.Where(u => !u.IsProcess)
|
||||
.Where(u => u.EffectiveDate.Value.Date <= DateTime.Now.AddHours(7).Date)
|
||||
.Where(u => u.EffectiveDate.Value.Date <= DateTime.Now.Date)
|
||||
.ToList();
|
||||
|
||||
foreach (var d in data)
|
||||
|
|
@ -101,17 +101,13 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<UserDutyTime?> GetLastEffectRound(Guid profileId, DateTime? effectiveDate = null, CancellationToken cancellationToken = default)
|
||||
public async Task<UserDutyTime?> GetLastEffectRound(Guid profileId)
|
||||
{
|
||||
// กำหนด timeout เป็น 30 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
effectiveDate ??= DateTime.Now;
|
||||
var data = await _dbContext.Set<UserDutyTime>()
|
||||
.Where(x => x.ProfileId == profileId)
|
||||
.Where(x => x.EffectiveDate.Value.Date <= effectiveDate.Value.Date)
|
||||
.Where(x => x.IsProcess)
|
||||
.OrderByDescending(x => x.EffectiveDate)
|
||||
.FirstOrDefaultAsync(combinedCts.Token);
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,16 +74,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<UserTimeStamp?> GetLastRecord(Guid keycloakId, CancellationToken cancellationToken = default)
|
||||
public async Task<UserTimeStamp?> GetLastRecord(Guid keycloakId)
|
||||
{
|
||||
// กำหนด timeout เป็น 30 นาที
|
||||
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(30));
|
||||
using var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token);
|
||||
|
||||
var data = await _dbContext.Set<UserTimeStamp>()
|
||||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
.OrderByDescending(u => u.CheckIn)
|
||||
.FirstOrDefaultAsync(combinedCts.Token);
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
@ -94,7 +90,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
.Where(u => u.CheckIn.Year == year)
|
||||
.OrderBy(u => u.CheckIn)
|
||||
|
||||
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
|
|
@ -105,61 +101,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
var data = await _dbContext.Set<UserTimeStamp>()
|
||||
.Where(u => u.CheckIn.Date >= startDate.Date && u.CheckIn.Date <= endDate.Date)
|
||||
.OrderBy(u => u.CheckIn)
|
||||
|
||||
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<UserTimeStamp>> GetTimeStampHistoryForAdminRoleAsync(DateTime startDate, DateTime endDate, string role, string nodeId, int? node)
|
||||
{
|
||||
var data = await _dbContext.Set<UserTimeStamp>()
|
||||
.Where(u => u.CheckIn.Date >= startDate.Date && u.CheckIn.Date <= endDate.Date)
|
||||
.OrderBy(u => u.CheckIn)
|
||||
|
||||
.ToListAsync();
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
data = data
|
||||
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))))
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
data = data
|
||||
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))
|
||||
.ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
data = data
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!))
|
||||
.ToList();
|
||||
}
|
||||
// else if (role == "PARENT")
|
||||
// {
|
||||
// data = data
|
||||
// .Where(x => x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId != null)
|
||||
// .ToList();
|
||||
// }
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
data = data.Where(x =>
|
||||
node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) && x.Child1DnaId == null :
|
||||
node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) && x.Child2DnaId == null :
|
||||
node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) && x.Child3DnaId == null :
|
||||
node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) && x.Child4DnaId == null :
|
||||
node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) :
|
||||
true
|
||||
).ToList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<UserTimeStamp?> GetTimeStampById(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<UserTimeStamp>()
|
||||
|
|
|
|||
|
|
@ -51,13 +51,12 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
// // throw new Exception(GlobalMessages.DataNotFound);
|
||||
// }
|
||||
|
||||
//var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||
var profileId = "";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
|
|
|||
|
|
@ -55,13 +55,12 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
// // throw new Exception(GlobalMessages.DataNotFound);
|
||||
// }
|
||||
|
||||
//var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||
var profileId = "";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
|
@ -132,13 +131,12 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
// {
|
||||
// return 0;
|
||||
// }
|
||||
//var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||
var profileId = "";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
|
@ -187,44 +185,6 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
}
|
||||
|
||||
private async Task<string> GetMyProfileIdAsync()
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/get-profileId";
|
||||
var response = await GetExternalAPIAsync(apiUrl, AccessToken!, _configuration["API_KEY"]!);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(response))
|
||||
return string.Empty;
|
||||
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(response);
|
||||
if (org == null || org.result == null)
|
||||
return string.Empty;
|
||||
|
||||
return org.result.profileId ?? string.Empty;
|
||||
}
|
||||
|
||||
public async Task<int> DeleteAllMyNotificationsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var profileId = await GetMyProfileIdAsync();
|
||||
if (string.IsNullOrEmpty(profileId))
|
||||
return 0;
|
||||
|
||||
var notifications = await _dbContext.Set<Notification>()
|
||||
.Where(x => x.ReceiverUserId == Guid.Parse(profileId))
|
||||
.Where(x => x.DeleteDate == null)
|
||||
.ToListAsync();
|
||||
|
||||
_dbContext.Set<Notification>().RemoveRange(notifications);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return notifications.Count;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task PushNotificationAsync(Guid ReceiverUserId, string Subject, string Body, string Payload = "", string NotiLink = "", bool IsSendInbox = false, bool IsSendMail = false)
|
||||
{
|
||||
try
|
||||
|
|
@ -263,22 +223,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null && org.result != "")
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
//}
|
||||
|
|
@ -305,40 +250,25 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
/* if (IsSendInbox == true)
|
||||
{
|
||||
_dbContext.Set<Inbox>().Add(new Inbox
|
||||
{
|
||||
Subject = Subject,
|
||||
Body = Body,
|
||||
ReceiverUserId = ReceiverUserId,
|
||||
Payload = Payload,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}*/
|
||||
/* if (IsSendInbox == true)
|
||||
{
|
||||
_dbContext.Set<Inbox>().Add(new Inbox
|
||||
{
|
||||
Subject = Subject,
|
||||
Body = Body,
|
||||
ReceiverUserId = ReceiverUserId,
|
||||
Payload = Payload,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}*/
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null && org.result != "")
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -397,22 +327,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null && org.result != "")
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
|
@ -428,11 +343,6 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
public Guid ReceiverUserId { get; set; }
|
||||
public string NotiLink { get; set; }
|
||||
}
|
||||
|
||||
public class ResultRequest
|
||||
{
|
||||
public string result { get; set; }
|
||||
}
|
||||
public async Task PushNotificationsLinkAsync(NotisLinkRequest[] ReceiverUserIds, string Subject, string Body, string Payload = "", bool IsSendInbox = false, bool IsSendMail = false)
|
||||
{
|
||||
try
|
||||
|
|
@ -470,22 +380,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId.ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null && org.result != "")
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
|
@ -540,22 +435,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (data.IsSendMail == true)
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{data.ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null && org.result != "")
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
|
@ -602,22 +482,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null && org.result != "")
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,16 +26,6 @@ namespace BMA.EHR.Application.Repositories.MetaData
|
|||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<string> GetHolidayAsync(DateTime date, string category = "NORMAL")
|
||||
{
|
||||
var data = await _dbContext.Set<Holiday>().AsQueryable()
|
||||
.Where(x => x.Category == category)
|
||||
.Where(x => x.HolidayDate.Date == date.Date)
|
||||
.Select(x => x.Name)
|
||||
.FirstOrDefaultAsync();
|
||||
return data ?? string.Empty;
|
||||
}
|
||||
|
||||
public async Task<List<DateTime>> GetHolidayAsync(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
||||
{
|
||||
var data = await _dbContext.Set<Holiday>().AsQueryable()
|
||||
|
|
@ -49,16 +39,12 @@ namespace BMA.EHR.Application.Repositories.MetaData
|
|||
|
||||
public async Task<int> GetHolidayCountAsync(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
||||
{
|
||||
var query = _dbContext.Set<Holiday>().AsQueryable()
|
||||
var data = await _dbContext.Set<Holiday>().AsQueryable()
|
||||
.Where(x => x.Category == category)
|
||||
.Where(x => x.HolidayDate.Date >= startDate && x.HolidayDate.Date <= endDate);
|
||||
.Where(x => x.HolidayDate.Date >= startDate && x.HolidayDate.Date <= endDate)
|
||||
.CountAsync();
|
||||
|
||||
if (category == "NORMAL")
|
||||
query = query.Where(x => x.HolidayDate.DayOfWeek != DayOfWeek.Saturday && x.HolidayDate.DayOfWeek != DayOfWeek.Sunday);
|
||||
else
|
||||
query = query.Where(x => x.HolidayDate.DayOfWeek != DayOfWeek.Sunday);
|
||||
|
||||
return await query.CountAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
public List<DateTime> GetWeekEnd(DateTime startDate, DateTime endDate, string category = "NORMAL")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Amazon.S3;
|
||||
using Amazon.S3;
|
||||
using Amazon.S3.Model;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
|
@ -37,9 +37,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true,
|
||||
SignatureVersion = "V4", // รองรับ MinIO
|
||||
AuthenticationRegion = "th-middle-rack-1" // บาง MinIO ใช้ region "us-east-1" โดย default
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
_s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Amazon.S3;
|
||||
using Amazon.S3;
|
||||
using Amazon.S3.Model;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -40,9 +40,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true,
|
||||
SignatureVersion = "V4", // รองรับ MinIO
|
||||
AuthenticationRegion = "th-middle-rack-1" // บาง MinIO ใช้ region "us-east-1" โดย default
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
_s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config);
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true,
|
||||
SignatureVersion = "V4", // รองรับ MinIO
|
||||
AuthenticationRegion = "th-middle-rack-1" // บาง MinIO ใช้ region "us-east-1" โดย default
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
_s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Amazon.S3;
|
||||
using Amazon.S3;
|
||||
using Amazon.S3.Model;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
|
|
@ -39,9 +39,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = _configuration["MinIO:Endpoint"],
|
||||
ForcePathStyle = true,
|
||||
SignatureVersion = "V4", // รองรับ MinIO
|
||||
AuthenticationRegion = "th-middle-rack-1" // บาง MinIO ใช้ region "us-east-1" โดย default
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
_s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config);
|
||||
|
|
@ -155,40 +153,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<FormFile> GetImageToFormFileAsync(string refId)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var memoryStream = new MemoryStream();
|
||||
var request = new GetObjectRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = refId
|
||||
};
|
||||
|
||||
using var response = await _s3Client.GetObjectAsync(request);
|
||||
using var responseStream = response.ResponseStream;
|
||||
|
||||
await responseStream.CopyToAsync(memoryStream);
|
||||
|
||||
var finalBytes = memoryStream.ToArray();
|
||||
|
||||
var finalStream = new MemoryStream(finalBytes);
|
||||
var fileName = Path.GetFileName(refId);
|
||||
var contentType = response.Headers.ContentType ?? "image/jpeg";
|
||||
|
||||
return new FormFile(finalStream, 0, finalStream.Length, "file", fileName)
|
||||
{
|
||||
Headers = new HeaderDictionary(),
|
||||
ContentType = contentType
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteFileAsync(Guid fileId)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ using System.Net.Http.Headers;
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using System.Security.Claims;
|
||||
using System.Net.Http.Json;
|
||||
using BMA.EHR.Application.Responses.Leaves;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
|
|
@ -59,14 +58,9 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization =
|
||||
new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = await client.GetAsync(apiPath);
|
||||
if (!req.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception("Error calling permission API");
|
||||
}
|
||||
var res = await req.Content.ReadAsStringAsync();
|
||||
return res;
|
||||
}
|
||||
|
|
@ -77,39 +71,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<GetPermissionWithActingResultDto?> GetPermissionWithActingAPIAsync(string action, string system)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/permission/dotnet-acting/{action}/{system}";
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization =
|
||||
new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var req = await client.GetAsync(apiPath);
|
||||
if (!req.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception("Error calling permission API");
|
||||
}
|
||||
var apiResult = await req.Content.ReadAsStringAsync();
|
||||
//return res;
|
||||
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetPermissionWithActingResultDto>(apiResult);
|
||||
return raw;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<dynamic> GetPermissionOrgAPIAsync(string action, string system, string profileId)
|
||||
{
|
||||
try
|
||||
|
|
@ -119,7 +80,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = await client.GetAsync(apiPath);
|
||||
var res = await req.Content.ReadAsStringAsync();
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -2,40 +2,24 @@
|
|||
using BMA.EHR.Domain.Models.Placement;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
/// <summary>
|
||||
/// Response model จาก Org API (check-isLeave)
|
||||
/// </summary>
|
||||
public class OrgProfileResult
|
||||
{
|
||||
public string citizenId { get; set; } = "";
|
||||
public string? profileId { get; set; }
|
||||
public bool isLeave { get; set; }
|
||||
public bool isActive { get; set; }
|
||||
}
|
||||
|
||||
public class PlacementRepository : GenericRepository<Guid, Placement>
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PlacementRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor, IConfiguration configuration) : base(dbContext, httpContextAccessor)
|
||||
public PlacementRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -92,148 +76,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Job อัพเดทสถานะผู้สอบผ่านที่ลาออกไปแล้วแต่ยังไม่ส่งไปออกคำสั่ง
|
||||
/// และอัพเดทบุคคลภายนอกที่เข้ามาอยู่ในระบบแล้ว
|
||||
/// ทำงานทุกวันเวลา 05:00 น.
|
||||
/// </summary>
|
||||
public async Task UpdateStatusPlacementProfiles()
|
||||
{
|
||||
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] === STARTED ===");
|
||||
|
||||
// 1. Query ทั้ง 2 กรณี: ทุกคนที่ยังไม่ DONE
|
||||
var allCitizenIds = await _dbContext.Set<PlacementProfile>()
|
||||
.Where(p => !string.IsNullOrEmpty(p.CitizenId)
|
||||
&& p.PlacementStatus != "DONE"
|
||||
// && p.CitizenId == "2536721883131"
|
||||
)
|
||||
.Select(p => new { p.CitizenId, p.IsOfficer })
|
||||
.ToListAsync();
|
||||
|
||||
if (!allCitizenIds.Any())
|
||||
{
|
||||
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] No profiles to process");
|
||||
return;
|
||||
}
|
||||
|
||||
var officerCount = allCitizenIds.Count(x => x.IsOfficer == true);
|
||||
var notOfficerCount = allCitizenIds.Count(x => x.IsOfficer == false);
|
||||
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] พบข้าราชการ {officerCount} คน, บุคคลภายนอก {notOfficerCount} คน");
|
||||
|
||||
// 2. ส่ง citizenIds ทั้งหมดไป Org API ครั้งเดียว
|
||||
var citizenIds = allCitizenIds.Select(x => x.CitizenId).Distinct().ToList();
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/check-isLeave";
|
||||
|
||||
List<OrgProfileResult> orgResults = new();
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
|
||||
var payload = new { citizenIds };
|
||||
var jsonPayload = JsonConvert.SerializeObject(payload);
|
||||
var content = new StringContent(jsonPayload, System.Text.Encoding.UTF8, "application/json");
|
||||
|
||||
try
|
||||
{
|
||||
var response = await client.PostAsync(apiUrl, content);
|
||||
var result = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var responseObj = JsonConvert.DeserializeAnonymousType(result, new
|
||||
{
|
||||
status = 0,
|
||||
message = "",
|
||||
result = new List<OrgProfileResult>()
|
||||
});
|
||||
|
||||
orgResults = responseObj?.result ?? new();
|
||||
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] Org API ตอบกลับ {orgResults.Count} รายการ");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] Call API failed: {ex.Message}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!orgResults.Any())
|
||||
{
|
||||
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] ไม่มีรายการต้องอัปเดต");
|
||||
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] === COMPLETED ===");
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. แยกข้อมูลตามเงื่อนไข
|
||||
var leaveCitizenIds = orgResults.Where(x => x.isLeave).Select(x => x.citizenId).ToList();
|
||||
var inSystemProfiles = orgResults.Where(x => x.isActive && !x.isLeave && !string.IsNullOrEmpty(x.profileId)).ToList();
|
||||
|
||||
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] ลาออก {leaveCitizenIds.Count} รายการ, อยู่ที่ทะเบียนประวัติ {inSystemProfiles.Count} รายการ");
|
||||
|
||||
// 4. Split Batch Update (500 รายการ/batch)
|
||||
var batchSize = 500;
|
||||
var totalUpdated = 0;
|
||||
|
||||
// 4.1 Update คนลาออก → IsOfficer = false
|
||||
if (leaveCitizenIds.Any())
|
||||
{
|
||||
var totalBatches = (int)Math.Ceiling((double)leaveCitizenIds.Count / batchSize);
|
||||
for (int i = 0; i < totalBatches; i++)
|
||||
{
|
||||
var batch = leaveCitizenIds.Skip(i * batchSize).Take(batchSize).ToList();
|
||||
|
||||
var profilesToUpdate = await _dbContext.Set<PlacementProfile>()
|
||||
.Where(p => !string.IsNullOrEmpty(p.CitizenId)
|
||||
&& batch.Contains(p.CitizenId)
|
||||
&& p.IsOfficer == true)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var profile in profilesToUpdate)
|
||||
{
|
||||
profile.profileId = null;
|
||||
profile.IsOfficer = false;
|
||||
}
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
totalUpdated += profilesToUpdate.Count;
|
||||
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] [ลาออก] Batch {i + 1}/{totalBatches} → อัปเดต {profilesToUpdate.Count} รายการ");
|
||||
}
|
||||
}
|
||||
|
||||
// 4.2 Update คนที่อยู่ในทะเบียนประวัติ → profileId + IsOfficer = true
|
||||
if (inSystemProfiles.Any())
|
||||
{
|
||||
var totalBatches = (int)Math.Ceiling((double)inSystemProfiles.Count / batchSize);
|
||||
for (int i = 0; i < totalBatches; i++)
|
||||
{
|
||||
var batch = inSystemProfiles.Skip(i * batchSize).Take(batchSize).ToList();
|
||||
var batchCitizenIds = batch.Select(x => x.citizenId).ToList();
|
||||
|
||||
var profilesToUpdate = await _dbContext.Set<PlacementProfile>()
|
||||
.Where(p => !string.IsNullOrEmpty(p.CitizenId)
|
||||
&& batchCitizenIds.Contains(p.CitizenId)
|
||||
&& p.IsOfficer == false)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var profile in profilesToUpdate)
|
||||
{
|
||||
var orgProfile = batch.FirstOrDefault(x => x.citizenId == profile.CitizenId);
|
||||
if (orgProfile != null)
|
||||
{
|
||||
profile.profileId = orgProfile.profileId;
|
||||
profile.IsOfficer = true;
|
||||
}
|
||||
}
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
totalUpdated += profilesToUpdate.Count;
|
||||
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] [เข้าระบบ] Batch {i + 1}/{totalBatches} → อัปเดต {profilesToUpdate.Count} รายการ");
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine($"[Job:UpdateStatusPlacementProfiles] อัปเดตรวมทั้งหมด {totalUpdated} รายการ");
|
||||
Console.WriteLine("[Job:UpdateStatusPlacementProfiles] === COMPLETED ===");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using BMA.EHR.Domain.Shared;
|
|||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using static BMA.EHR.Domain.Extensions.DateTimeExtension;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
|
|
@ -83,128 +82,76 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน ");
|
||||
sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน ");
|
||||
}
|
||||
var candidate = await _dbExamContext.Set<Candidate>()
|
||||
.Where(x => x.Id == id)
|
||||
.Include(p => p.PeriodExam)
|
||||
.Include(p => p.Educations)
|
||||
.Include(p => p.PositionExam)
|
||||
.Include(p => p.ProfileImg)
|
||||
.FirstOrDefaultAsync();
|
||||
var data = await _dbExamContext.Set<Candidate>().AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
AvatarId = p.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ProfileImg.Id,
|
||||
ExamIdenNumber = p.ExamIdenNumber == null ? "-" : p.ExamIdenNumber.ToThaiNumber(),
|
||||
PositionName = p.PositionExam == null ? "-" : p.PositionExam.PositionName.ToThaiNumber(),
|
||||
PositionLevelName = p.PositionExam == null ? "-" : p.PositionExam.PositionLevelName.ToThaiNumber(),
|
||||
PeriodExamName = p.PeriodExam == null ? "-" : p.PeriodExam.Name.ToThaiNumber(),
|
||||
PeriodExamRound = p.PeriodExam == null ? "-" : p.PeriodExam.Round.ToString().ToThaiNumber(),
|
||||
PeriodExamYear = p.PeriodExam == null ? "-" : (p.PeriodExam.Year + 543).ToString().ToThaiNumber(),
|
||||
|
||||
if (candidate == null)
|
||||
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}",
|
||||
Religion = p.ReligionName == null ? "-" : p.ReligionName,
|
||||
Nationality = p.Nationality == null ? "-" : p.Nationality,
|
||||
DateOfBirth = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.ToThaiFullDate2().ToThaiNumber(),
|
||||
Age = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.CalculateAgeStrV2(0, 0).ToThaiNumber(),
|
||||
CitizenId = p.CitizenId == null ? "-" : p.CitizenId.ToThaiNumber(),
|
||||
|
||||
EducationLevelExamName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelExamName.ToThaiNumber(),
|
||||
EducationName = p.Educations.FirstOrDefault() == null ? null : (p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาตรี" || p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาโท" || p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาเอก" ? p.Educations.FirstOrDefault().EducationName : null),
|
||||
EducationMajor = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationMajor.ToThaiNumber(),
|
||||
EducationLocation = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLocation,
|
||||
EducationEndDate = p.Educations.FirstOrDefault() == null || p.Educations.FirstOrDefault().EducationEndDate == null ? "-" : p.Educations.FirstOrDefault().EducationEndDate.Value.ToThaiFullDate2().ToThaiNumber(),
|
||||
EducationScores = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationScores.ToThaiNumber(),
|
||||
EducationType = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationType,
|
||||
EducationLevelHighName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelHighName,
|
||||
|
||||
OccupationPositionType = p.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" : (p.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" : (p.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-")),
|
||||
OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition,
|
||||
OccupationSalary = p.OccupationSalary == null ? "-" : p.OccupationSalary.Value.ToString("N0").ToThaiNumber(),
|
||||
OccupationGroup = p.OccupationGroup == null ? "-" : p.OccupationGroup,
|
||||
OccupationPile = p.OccupationPile == null ? "-" : p.OccupationPile,
|
||||
OccupationOrg = p.OccupationOrg == null ? "-" : p.OccupationOrg,
|
||||
OccupationTelephone = p.OccupationTelephone == null ? "-" : p.OccupationTelephone.ToThaiNumber(),
|
||||
|
||||
CareersTotal = sb.ToString().ToThaiNumber(),
|
||||
// Careers = p.Careers.Select(y => new
|
||||
// {
|
||||
// Position = y.Position,
|
||||
// Type = y.Type,
|
||||
// DurationStart = y.DurationStart.ToThaiShortDate2(),
|
||||
// DurationEnd = y.DurationEnd.ToThaiShortDate2(),
|
||||
// RangeDate = y.RangeDate,
|
||||
// }).ToList(),
|
||||
|
||||
RegistAddress = p.RegistAddress == null ? "-" : p.RegistAddress.ToThaiNumber(),
|
||||
RegistProvinceName = p.RegistProvinceName == null ? "-" : p.RegistProvinceName,
|
||||
RegistDistrictName = p.RegistDistrictName == null ? "-" : p.RegistDistrictName,
|
||||
RegistSubDistrictName = p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName,
|
||||
RegistZipCode = p.RegistZipCode == null ? "-" : p.RegistZipCode.ToThaiNumber(),
|
||||
CurrentAddress = p.CurrentAddress == null ? (p.RegistAddress == null ? "-" : p.RegistAddress.ToThaiNumber()) : p.CurrentAddress.ToThaiNumber(),
|
||||
CurrentProvinceName = p.CurrentProvinceName == null ? (p.RegistProvinceName == null ? "-" : p.RegistProvinceName) : p.CurrentProvinceName,
|
||||
CurrentDistrictName = p.CurrentDistrictName == null ? (p.RegistDistrictName == null ? "-" : p.RegistDistrictName) : p.CurrentDistrictName,
|
||||
CurrentSubDistrictName = p.CurrentSubDistrictName == null ? (p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName) : p.CurrentSubDistrictName,
|
||||
CurrentZipCode = p.CurrentZipCode == null ? (p.RegistZipCode == null ? "-" : p.RegistZipCode.ToThaiNumber()) : p.CurrentZipCode.ToThaiNumber(),
|
||||
Telephone = p.Telephone == null ? "-" : p.Telephone.ToThaiNumber(),
|
||||
Email = p.Email == null ? "-" : p.Email,
|
||||
|
||||
ContactFullName = $"{p.ContactPrefixName}{p.ContactFirstname} {p.ContactLastname}",
|
||||
ContactRelations = p.ContactRelations == null ? "-" : p.ContactRelations,
|
||||
ContactTel = p.ContactTel == null ? "-" : p.ContactTel.ToThaiNumber(),
|
||||
|
||||
RegisterDate = p.RegisterDate == null ? "-" : p.RegisterDate.Value.ToThaiFullDate().ToThaiNumber(),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.CandidateNotFound);
|
||||
|
||||
List<string> editorConfirmLists;
|
||||
|
||||
var textOnly = string.IsNullOrEmpty(candidate.PeriodExam?.EditorConfirm)
|
||||
? null
|
||||
: Regex.Replace(
|
||||
candidate.PeriodExam.EditorConfirm,
|
||||
"<[^>]+>",
|
||||
string.Empty
|
||||
)
|
||||
.Replace(" ", " ")
|
||||
.Trim();
|
||||
|
||||
if (!string.IsNullOrEmpty(textOnly))
|
||||
{
|
||||
// ลบข้อความทั้งหมดก่อน "1." เพื่อให้เริ่มต้นที่ข้อแรกเสมอ
|
||||
var cleanedText = Regex.Replace(textOnly, @"^.*?1\.", "1.").Trim();
|
||||
|
||||
// ถ้าข้อ 3 จบด้วย "มาตรา 1374." แล้วเลข 4. ติดกับประโยค ให้แทรกขึ้นบรรทัดใหม่เป็นข้อ 4.
|
||||
if (!cleanedText.Contains("\n4.") && Regex.IsMatch(cleanedText, @"1374\.\s*"))
|
||||
{
|
||||
cleanedText = Regex.Replace(cleanedText, @"1374\.\s*", "137\n4. ");
|
||||
}
|
||||
|
||||
// แยกข้อความเป็นแต่ละข้อ โดย split เมื่อเจอ pattern "ตัวเลข. "
|
||||
// ใช้ lookahead (?=...) เพื่อไม่กินตัวเลขทิ้ง และให้ตัวเลขยังอยู่ในผลลัพธ์
|
||||
editorConfirmLists = Regex.Split(cleanedText, @"(?=\d+\. )")
|
||||
.Where(s => !string.IsNullOrWhiteSpace(s))
|
||||
.Select(s => s.Replace("\n", "").Replace("\r", "").Trim())
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
editorConfirmLists = new List<string> { "-" };
|
||||
}
|
||||
|
||||
return new
|
||||
{
|
||||
candidate.Id,
|
||||
AvatarId = candidate.ProfileImg?.Id ?? Guid.Empty,
|
||||
ExamIdenNumber = candidate.ExamIdenNumber ?? "-",
|
||||
PositionName = candidate.PositionExam?.PositionName ?? "-",
|
||||
PositionLevelName = candidate.PositionExam?.PositionLevelName ?? "-",
|
||||
PeriodExamName = candidate.PeriodExam?.Name ?? "-",
|
||||
PeriodExamRound = candidate.PeriodExam?.Round.ToString() ?? "-",
|
||||
PeriodExamYear = candidate.PeriodExam != null ? (candidate.PeriodExam.Year + 543).ToString() : "-",
|
||||
FullName = $"{candidate.PrefixName}{candidate.FirstName} {candidate.LastName}",
|
||||
Religion = candidate.ReligionName ?? "-",
|
||||
Nationality = candidate.Nationality ?? "-",
|
||||
DateOfBirth = candidate.DateOfBirth?.ToThaiFullDate2() ?? "-",
|
||||
Age = candidate.DateOfBirth?.CalculateAgeStrV2(0, 0) ?? "-",
|
||||
CitizenId = candidate.CitizenId ?? "-",
|
||||
|
||||
EducationLevelExamName = candidate.Educations.FirstOrDefault()?.EducationLevelExamName ?? "-",
|
||||
EducationName = (candidate.Educations.FirstOrDefault()?.EducationLevelExamName is "ปริญญาตรี" or "ปริญญาโท" or "ปริญญาเอก")
|
||||
? candidate.Educations.FirstOrDefault()?.EducationName
|
||||
: null,
|
||||
EducationMajor = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-",
|
||||
EducationLocation = candidate.Educations.FirstOrDefault()?.EducationLocation ?? "-",
|
||||
EducationEndDate = candidate.Educations.FirstOrDefault()?.EducationEndDate?.ToThaiFullDate2() ?? "-",
|
||||
EducationScores = candidate.Educations.FirstOrDefault()?.EducationScores ?? "-",
|
||||
EducationType = candidate.Educations.FirstOrDefault()?.EducationType ?? "-",
|
||||
EducationLevelHighName = candidate.Educations.FirstOrDefault()?.EducationLevelHighName ?? "-",
|
||||
|
||||
OccupationPositionType = candidate.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" :
|
||||
candidate.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" :
|
||||
candidate.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-",
|
||||
OccupationPosition = candidate.OccupationPosition ?? "-",
|
||||
OccupationSalary = candidate.OccupationSalary.HasValue
|
||||
? (candidate.OccupationSalary.Value % 1 == 0
|
||||
? candidate.OccupationSalary.Value.ToString("N0")
|
||||
: candidate.OccupationSalary.Value.ToString("N2"))
|
||||
: "-",
|
||||
OccupationGroup = candidate.OccupationGroup ?? "-",
|
||||
OccupationPile = candidate.OccupationPile ?? "-",
|
||||
OccupationOrg = candidate.OccupationOrg ?? "-",
|
||||
OccupationTelephone = candidate.OccupationTelephone ?? "-",
|
||||
|
||||
CareersTotal = sb.ToString(),
|
||||
|
||||
RegistAddress = candidate.RegistAddress ?? "-",
|
||||
RegistProvinceName = candidate.RegistProvinceName ?? "-",
|
||||
RegistDistrictName = candidate.RegistDistrictName ?? "-",
|
||||
RegistSubDistrictName = candidate.RegistSubDistrictName ?? "-",
|
||||
RegistZipCode = candidate.RegistZipCode ?? "-",
|
||||
CurrentAddress = candidate.CurrentAddress ?? candidate.RegistAddress ?? "-",
|
||||
CurrentProvinceName = candidate.CurrentProvinceName ?? candidate.RegistProvinceName ?? "-",
|
||||
CurrentDistrictName = candidate.CurrentDistrictName ?? candidate.RegistDistrictName ?? "-",
|
||||
CurrentSubDistrictName = candidate.CurrentSubDistrictName ?? candidate.RegistSubDistrictName ?? "-",
|
||||
CurrentZipCode = candidate.CurrentZipCode ?? candidate.RegistZipCode ?? "-",
|
||||
Telephone = candidate.Telephone ?? "-",
|
||||
Email = candidate.Email ?? "-",
|
||||
|
||||
ContactFullName = $"{candidate.ContactPrefixName}{candidate.ContactFirstname} {candidate.ContactLastname}",
|
||||
ContactRelations = candidate.ContactRelations ?? "-",
|
||||
ContactTel = candidate.ContactTel ?? "-",
|
||||
|
||||
RegisterDate = candidate.RegisterDate?.ToThaiFullDate() ?? "-",
|
||||
|
||||
IsBachelors = candidate.PositionExam != null && !string.IsNullOrEmpty(candidate.PositionExam.PositionLevelName) && candidate.PositionExam.PositionLevelName.Trim() == "ปฏิบัติการ"
|
||||
? new List<object>
|
||||
{
|
||||
new { label = "ชื่อปริญญา", value = candidate.Educations.FirstOrDefault()?.EducationName ?? "-" },
|
||||
new { label = "สาขาวิชา/วิชาเอก", value = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-" }
|
||||
}
|
||||
: new List<object>
|
||||
{
|
||||
new { label = "สาขาวิชา/วิชาเอก", value = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-" }
|
||||
},
|
||||
|
||||
EditorConfirms = editorConfirmLists
|
||||
};
|
||||
return data;
|
||||
}
|
||||
public async Task<dynamic> GetExamCareerCandidateAsync(Guid id)
|
||||
{
|
||||
|
|
@ -229,10 +176,10 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
{
|
||||
Position = item.Position,
|
||||
Type = item.Type,
|
||||
DurationStart = item.DurationStart,
|
||||
DurationEnd = item.DurationEnd,
|
||||
RangeDate = item.RangeDate,
|
||||
Index = retVal.ToString(),
|
||||
DurationStart = item.DurationStart.ToThaiNumber(),
|
||||
DurationEnd = item.DurationEnd.ToThaiNumber(),
|
||||
RangeDate = item.RangeDate.ToThaiNumber(),
|
||||
Index = retVal.ToString().ToThaiNumber(),
|
||||
};
|
||||
data.Add(_data);
|
||||
retVal++;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using BMA.EHR.Application.Common.Interfaces;
|
|||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Commands.Core;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
|
@ -13,14 +12,9 @@ using BMA.EHR.Domain.Shared;
|
|||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Metadata;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
{
|
||||
|
|
@ -33,7 +27,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly InsigniaPeriodsRepository _repositoryInsignia;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly string CRLF = "\r\n";
|
||||
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
|
|
@ -48,7 +41,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
InsigniaPeriodsRepository repositoryInsignia,
|
||||
NotificationRepository repositoryNoti,
|
||||
IWebHostEnvironment hostEnvironment,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
|
|
@ -59,7 +51,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
_repositoryInsignia = repositoryInsignia;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -135,26 +126,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
return thaiYear;
|
||||
}
|
||||
|
||||
public async Task<dynamic> GetNameInsigniaNote(Guid id)
|
||||
{
|
||||
var note = await _dbContext.Set<InsigniaNote>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (note == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
string name = note.Name.ToString().ToThaiNumber();
|
||||
return name;
|
||||
}
|
||||
|
||||
public async Task<dynamic> GetYearInsigniaNote(Guid id)
|
||||
{
|
||||
var note = await _dbContext.Set<InsigniaNote>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (note == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
string thaiYear = note.Year.ToThaiYear().ToString().ToThaiNumber();
|
||||
return thaiYear;
|
||||
}
|
||||
|
||||
public async Task<dynamic> Get2YearInsigniaPeriod(Guid id)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
|
|
@ -772,89 +743,36 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
}
|
||||
|
||||
//44-บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ
|
||||
public async Task<dynamic> GetSummaryCoinReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
public async Task<dynamic> GetSummaryCoinReport(Guid id)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
/* var data_insignia = await _dbContext.Set<InsigniaRequestProfile>()
|
||||
//.Include(x => x.Profile)
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null)
|
||||
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ")
|
||||
.Select(x => new
|
||||
{
|
||||
//Gendor = x.Profile.Gender == null ? null : x.Profile.Gender.Name,
|
||||
Gendor = x.Gender, //_userProfileRepository.GetOfficerProfileById(x.ProfileId, AccessToken).Gender ?? "",
|
||||
RequestInsigniaName = x.RequestInsignia.Name,
|
||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})",
|
||||
OcId = x.Request.OrganizationId
|
||||
})
|
||||
.ToListAsync();*/
|
||||
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null)
|
||||
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ");
|
||||
var data_insignia = await _dbContext.Set<InsigniaRequestProfile>()
|
||||
//.Include(x => x.Profile)
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null)
|
||||
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ")
|
||||
.Select(x => new
|
||||
{
|
||||
//Gendor = x.Profile.Gender == null ? null : x.Profile.Gender.Name,
|
||||
Gendor = x.Gender, //_userProfileRepository.GetOfficerProfileById(x.ProfileId, AccessToken).Gender ?? "",
|
||||
RequestInsigniaName = x.RequestInsignia.Name,
|
||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})",
|
||||
OcId = x.Request.OrganizationId
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
if (type == "officer")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
|
||||
}
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var data = await data_insigniaQuery
|
||||
.Select(x => new
|
||||
{
|
||||
Gendor = x.Gender, // Gender as is, directly from x.Gender
|
||||
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
|
||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})", // Insignia's full name and short name
|
||||
OcId = x.Request.OrganizationId // Organization ID
|
||||
})
|
||||
.ToListAsync();
|
||||
var org = _userProfileRepository.GetOc(nodeId, node, AccessToken);
|
||||
var organizationName = $"{(!string.IsNullOrEmpty(org.Child4) ? org.Child4 + "/" : "")}{(!string.IsNullOrEmpty(org.Child3) ? org.Child3 + "/" : "")}{(!string.IsNullOrEmpty(org.Child2) ? org.Child2 + "/" : "")}{(!string.IsNullOrEmpty(org.Child1) ? org.Child1 + "/" : "")}{org.Root ?? ""}";
|
||||
var insignia = (from r in data
|
||||
var insignia = (from r in data_insignia
|
||||
group r by new { OcId = r.OcId, InsigniaInitial = r.InsigniaInitial } into g
|
||||
select new
|
||||
{
|
||||
RowNo = 1,
|
||||
DepartmentName = organizationName,
|
||||
//_userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken).Root,
|
||||
//_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
||||
DepartmentName = _userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken).Root, //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
||||
InsigniaInitial = g.Key.InsigniaInitial,
|
||||
G1Male = g.Sum(x => x.Gendor == "ชาย" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0).ToString().ToThaiNumber(),
|
||||
G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0).ToString().ToThaiNumber(),
|
||||
|
|
@ -893,7 +811,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
select new
|
||||
{
|
||||
RowNo = 1,
|
||||
DepartmentName = _userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken)?.Root ?? "-", //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
||||
DepartmentName = _userProfileRepository.GetOc(g.Key.OcId, 0, AccessToken).Root, //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
||||
G1Male = g.Sum(x => x.Gendor == "ชาย" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0),
|
||||
G1Female = g.Sum(x => x.Gendor == "หญิง" && x.RequestInsigniaName == "เหรียญจักรพรรดิมาลา" ? 1 : 0),
|
||||
G2Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||
|
|
@ -914,7 +832,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
}
|
||||
|
||||
//45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา
|
||||
public async Task<dynamic> GetCoinReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
public async Task<dynamic> GetCoinReport(Guid id)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
|
@ -945,102 +863,38 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
})
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var dataQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Include(x => x.Request)
|
||||
.ThenInclude(x => x.Period)
|
||||
.Include(x => x.Request)
|
||||
/*.ThenInclude(x => x.Organization)*/
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Where(r => r.Request.Period == period
|
||||
&& r.IsApprove == true
|
||||
&& r.Status == "PENDING"
|
||||
&& r.RequestInsignia.InsigniaType != null
|
||||
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ");
|
||||
|
||||
if (type == "officer")
|
||||
{
|
||||
dataQuery = dataQuery.Where(r => r.ProfileType == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
dataQuery = dataQuery.Where(r => r.ProfileType == "employee");
|
||||
}
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
dataQuery = dataQuery.Where(r => r.RootDnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
dataQuery = dataQuery.Where(r => r.Child1DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
dataQuery = dataQuery.Where(r => r.Child2DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
dataQuery = dataQuery.Where(r => r.Child3DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
dataQuery = dataQuery.Where(r => r.Child4DnaId == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Grouping by ProfileId and InsigniaId, and calculating the sum for Male and Female
|
||||
var data = await dataQuery
|
||||
.GroupBy(r => new
|
||||
{
|
||||
r.RequestInsignia.ShortName,
|
||||
r.RequestInsignia.Name,
|
||||
r.ProfileId,
|
||||
r.Prefix,
|
||||
r.FirstName,
|
||||
r.LastName,
|
||||
r.Gender,
|
||||
r.Root,
|
||||
r.RootId,
|
||||
r.Child1,
|
||||
r.Child1Id,
|
||||
r.Child2,
|
||||
r.Child2Id,
|
||||
r.Child3,
|
||||
r.Child3Id,
|
||||
r.Child4,
|
||||
r.Child4Id,
|
||||
r.RequestInsignia.Id,
|
||||
r.Request.OrganizationId
|
||||
})
|
||||
.Select(group => new
|
||||
{
|
||||
InsigniaInitial = group.Key.ShortName,
|
||||
InsigniaName = group.Key.Name,
|
||||
ProfileId = group.Key.ProfileId,
|
||||
FullName = $"{group.Key.Prefix}{group.Key.FirstName} {group.Key.LastName}",
|
||||
Gender = group.Key.Gender,
|
||||
Root = group.Key.Root ?? "",
|
||||
RootId = group.Key.RootId,
|
||||
Child1 = group.Key.Child1 ?? "",
|
||||
Child1Id = group.Key.Child1Id,
|
||||
Child2 = group.Key.Child2 ?? "",
|
||||
Child2Id = group.Key.Child2Id,
|
||||
Child3 = group.Key.Child3 ?? "",
|
||||
Child3Id = group.Key.Child3Id,
|
||||
Child4 = group.Key.Child4 ?? "",
|
||||
Child4Id = group.Key.Child4Id,
|
||||
Male = group.Count(r => r.Gender == "Male"), // Count male entries
|
||||
Female = group.Count(r => r.Gender == "Female"), // Count female entries
|
||||
InsigniaId = group.Key.Id,
|
||||
OCName = _userProfileRepository.GetOc(group.Key.OrganizationId, 0, AccessToken).Root
|
||||
})
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
var data = (from r in await _dbContext.Set<InsigniaRequestProfile>()
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Gender)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Prefix)
|
||||
.Include(x => x.Request)
|
||||
.ThenInclude(x => x.Period)
|
||||
.Include(x => x.Request)
|
||||
//.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.ToListAsync()
|
||||
where r.Request.Period == period
|
||||
&& r.IsApprove == true
|
||||
&& r.Status == "PENDING"
|
||||
&& r.RequestInsignia.InsigniaType != null
|
||||
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ"
|
||||
select new
|
||||
{
|
||||
InsigniaInitial = r.RequestInsignia.ShortName,
|
||||
InsigniaName = r.RequestInsignia.Name,
|
||||
ProfileId = r.ProfileId,
|
||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
// $"{r.Profile.Prefix?.Name}{r.Profile.FirstName} {r.Profile.LastName}",
|
||||
Gender = r.Gender,
|
||||
Male = gender.Sum(x => x.Male),
|
||||
Female = gender.Sum(x => x.Female),
|
||||
InsigniaId = r.RequestInsignia.Id,
|
||||
OCName = _userProfileRepository.GetOc(r.Request.OrganizationId, 0, AccessToken).Root, //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
|
||||
})
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
// loop to add temp row with 50 rows per page
|
||||
var insigniaList = data.Select(x => new { InsigniaId = x.InsigniaId, InsigniaInitial = x.InsigniaInitial, InsigniaName = x.InsigniaName })
|
||||
|
|
@ -1059,16 +913,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
ProfileId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
FullName = "",
|
||||
Gender = "",
|
||||
Root = "",
|
||||
RootId = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
Child1 = "",
|
||||
Child1Id = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
Child2 = "",
|
||||
Child2Id = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
Child3 = "",
|
||||
Child3Id = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
Child4 = "",
|
||||
Child4Id = (Guid?)Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
Male = 0,
|
||||
Female = 0,
|
||||
InsigniaId = ins.InsigniaId,
|
||||
|
|
@ -1115,330 +959,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
return s_data;
|
||||
}
|
||||
|
||||
public async Task<dynamic> GeInsigniaRequestProfiles(Guid id)
|
||||
{
|
||||
var profile = await _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(x => new
|
||||
{
|
||||
Fullname = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||
Position = x.Position ?? "",
|
||||
Oc = (x.Child4 == null ? "" : x.Child4 + " ") +
|
||||
(x.Child3 == null ? "" : x.Child3 + " ") +
|
||||
(x.Child2 == null ? "" : x.Child2 + " ") +
|
||||
(x.Child1 == null ? "" : x.Child1 + " ") +
|
||||
(x.Root == null ? "" : x.Root),
|
||||
BirthDate = x.BirthDate == null ? "" : x.BirthDate.Value.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||
DateAppoint = x.DateAppoint == null ? "" : x.DateAppoint.Value.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||
ProfileId = x.ProfileId
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (profile == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
var profileSalarys = await _userProfileRepository.GetProfileSalaryById(profile.ProfileId, AccessToken);
|
||||
var salarys = profileSalarys.Select(x => new
|
||||
{
|
||||
DateAffect = x.DateAffect == null ? "" : x.DateAffect.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||
Position = x.Position ?? "",
|
||||
Root = x.Root,
|
||||
Child1 = x.Child1,
|
||||
Child2 = x.Child2,
|
||||
Child3 = x.Child3,
|
||||
Child4 = x.Child4,
|
||||
Oc = (x.Child4 == null ? "" : x.Child4 + " ") +
|
||||
(x.Child3 == null ? "" : x.Child3 + " ") +
|
||||
(x.Child2 == null ? "" : x.Child2 + " ") +
|
||||
(x.Child1 == null ? "" : x.Child1 + " ") +
|
||||
(x.Root == null ? "" : x.Root),
|
||||
Age = x.Age == null ? "" : x.Age.ToString().ToThaiNumber(),
|
||||
Amount = x.Amount == null ? "" : x.Amount.ToString("N0", new CultureInfo("th-TH")).ToThaiNumber(),
|
||||
Remark = x.Remark == null ? "" : x.Remark.ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var result = new
|
||||
{
|
||||
profile.Fullname,
|
||||
profile.Position,
|
||||
profile.Oc,
|
||||
profile.BirthDate,
|
||||
profile.DateAppoint,
|
||||
Salarys = salarys
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
|
||||
public async Task<dynamic> GetEvaluationResultReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null);
|
||||
/*.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ");*/
|
||||
if (type == "officer")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
|
||||
}
|
||||
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var data = await data_insigniaQuery
|
||||
.Select(x => new
|
||||
{
|
||||
ProfileId = x.ProfileId,
|
||||
FullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
|
||||
Reason = x.Reason,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var seq = 1;
|
||||
var resultList = new List<object>();
|
||||
foreach (var d in data)
|
||||
{
|
||||
var _baseAPI = _configuration["API"];
|
||||
var _apiUrl = $"{_baseAPI}/org/unauthorize/calculateEvaluation/{type}";
|
||||
using (var _client = new HttpClient())
|
||||
{
|
||||
_client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||
var _res = await _client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var orgResponse = JObject.Parse(_result);
|
||||
var resultItems = orgResponse["result"];
|
||||
|
||||
// ค้นหาข้อมูลที่ตรงกันกับ ProfileId
|
||||
var matchedData = resultItems
|
||||
.Where(item => item["profileId"].ToString() == d.ProfileId.ToString())
|
||||
.FirstOrDefault();
|
||||
|
||||
if (matchedData != null)
|
||||
{
|
||||
resultList.Add(new
|
||||
{
|
||||
rowNo = seq++.ToString().ToThaiNumber(),
|
||||
d.ProfileId,
|
||||
d.FullName,
|
||||
d.RequestInsigniaName,
|
||||
yearAPR1 = matchedData["yearAPR1"]?.ToString() ?? "-",
|
||||
periodAPR1 = matchedData["periodAPR1"]?.ToString() ?? "-",
|
||||
resultAPR1 = matchedData["resultAPR1"]?.ToString() ?? "-",
|
||||
yearOCT1 = matchedData["yearOCT1"]?.ToString() ?? "-",
|
||||
periodOCT1 = matchedData["periodOCT1"]?.ToString() ?? "-",
|
||||
resultOCT1 = matchedData["resultOCT1"]?.ToString() ?? "-",
|
||||
yearAPR2 = matchedData["yearAPR2"]?.ToString() ?? "-",
|
||||
periodAPR2 = matchedData["periodAPR2"]?.ToString() ?? "-",
|
||||
resultAPR2 = matchedData["resultAPR2"]?.ToString() ?? "-",
|
||||
yearOCT2 = matchedData["yearOCT2"]?.ToString() ?? "-",
|
||||
periodOCT2 = matchedData["periodOCT2"]?.ToString() ?? "-",
|
||||
resultOCT2 = matchedData["resultOCT2"]?.ToString() ?? "-",
|
||||
yearAPR3 = matchedData["yearAPR3"]?.ToString() ?? "-",
|
||||
periodAPR3 = matchedData["periodAPR3"]?.ToString() ?? "-",
|
||||
resultAPR3 = matchedData["resultAPR3"]?.ToString() ?? "-",
|
||||
yearOCT3 = matchedData["yearOCT3"]?.ToString() ?? "-",
|
||||
periodOCT3 = matchedData["periodOCT3"]?.ToString() ?? "-",
|
||||
resultOCT3 = matchedData["resultOCT3"]?.ToString() ?? "-",
|
||||
yearAPR4 = matchedData["yearAPR4"]?.ToString() ?? "-",
|
||||
periodAPR4 = matchedData["periodAPR4"]?.ToString() ?? "-",
|
||||
resultAPR4 = matchedData["resultAPR4"]?.ToString() ?? "-",
|
||||
yearOCT4 = matchedData["yearOCT4"]?.ToString() ?? "-",
|
||||
periodOCT4 = matchedData["periodOCT4"]?.ToString() ?? "-",
|
||||
resultOCT4 = matchedData["resultOCT4"]?.ToString() ?? "-",
|
||||
yearAPR5 = matchedData["yearAPR5"]?.ToString() ?? "-",
|
||||
periodAPR5 = matchedData["periodAPR5"]?.ToString() ?? "-",
|
||||
resultAPR5 = matchedData["resultAPR5"]?.ToString() ?? "-",
|
||||
yearOCT5 = matchedData["yearOCT5"]?.ToString() ?? "-",
|
||||
periodOCT5 = matchedData["periodOCT5"]?.ToString() ?? "-",
|
||||
resultOCT5 = matchedData["resultOCT5"]?.ToString() ?? "-",
|
||||
remark = d.Reason ?? "-"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
resultList.Add(new
|
||||
{
|
||||
rowNo = seq++.ToString().ToThaiNumber(),
|
||||
d.ProfileId,
|
||||
d.FullName,
|
||||
d.RequestInsigniaName,
|
||||
yearAPR1 = "-",
|
||||
periodAPR1 = "-",
|
||||
resultAPR1 = "-",
|
||||
yearOCT1 = "-",
|
||||
periodOCT1 = "-",
|
||||
resultOCT1 = "-",
|
||||
yearAPR2 = "-",
|
||||
periodAPR2 = "-",
|
||||
resultAPR2 = "-",
|
||||
yearOCT2 = "-",
|
||||
periodOCT2 = "-",
|
||||
resultOCT2 = "-",
|
||||
yearAPR3 = "-",
|
||||
periodAPR3 = "-",
|
||||
resultAPR3 = "-",
|
||||
yearOCT3 = "-",
|
||||
periodOCT3 = "-",
|
||||
resultOCT3 = "-",
|
||||
yearAPR4 = "-",
|
||||
periodAPR4 = "-",
|
||||
resultAPR4 = "-",
|
||||
yearOCT4 = "-",
|
||||
periodOCT4 = "-",
|
||||
resultOCT4 = "-",
|
||||
yearAPR5 = "-",
|
||||
periodAPR5 = "-",
|
||||
resultAPR5 = "-",
|
||||
yearOCT5 = "-",
|
||||
periodOCT5 = "-",
|
||||
resultOCT5 = "-",
|
||||
remark = "-"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี NEW
|
||||
public async Task<dynamic> GetEvaluationResult5YearReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Where(x => x.Request.Period.Id == period.Id)
|
||||
.Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "PENDING")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null);
|
||||
|
||||
if (type == "officer")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
|
||||
}
|
||||
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var data = await data_insigniaQuery
|
||||
.Select(x => new
|
||||
{
|
||||
ProfileId = x.ProfileId,
|
||||
FullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
|
||||
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
|
||||
Reason = x.Reason,
|
||||
Agency = x.Root,
|
||||
ResultAPR1 = x.APR1,
|
||||
ResultOCT1 = x.OCT1,
|
||||
ResultAPR2 = x.APR2,
|
||||
ResultOCT2 = x.OCT2,
|
||||
ResultAPR3 = x.APR3,
|
||||
ResultOCT3 = x.OCT3,
|
||||
ResultAPR4 = x.APR4,
|
||||
ResultOCT4 = x.OCT4,
|
||||
ResultAPR5 = x.APR5,
|
||||
ResultOCT5 = x.OCT5
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var seq = 1;
|
||||
var resultList = new List<object>();
|
||||
foreach (var d in data)
|
||||
{
|
||||
resultList.Add(new
|
||||
{
|
||||
rowNo = seq++.ToString().ToThaiNumber(),
|
||||
d.ProfileId,
|
||||
d.FullName,
|
||||
d.RequestInsigniaName,
|
||||
Agency = d.Agency,
|
||||
ResultAPR1 = d.ResultAPR1 ?? "-",
|
||||
ResultOCT1 = d.ResultOCT1 ?? "-",
|
||||
ResultAPR2 = d.ResultAPR2 ?? "-",
|
||||
ResultOCT2 = d.ResultOCT2 ?? "-",
|
||||
ResultAPR3 = d.ResultAPR3 ?? "-",
|
||||
ResultOCT3 = d.ResultOCT3 ?? "-",
|
||||
ResultAPR4 = d.ResultAPR4 ?? "-",
|
||||
ResultOCT4 = d.ResultOCT4 ?? "-",
|
||||
ResultAPR5 = d.ResultAPR5 ?? "-",
|
||||
ResultOCT5 = d.ResultOCT5 ?? "-",
|
||||
Remark = d.Reason ?? "-"
|
||||
});
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
//noti ยื่นเสนอคน
|
||||
public async Task NotifyInsignia()
|
||||
{
|
||||
|
|
@ -1575,53 +1095,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
}
|
||||
}
|
||||
|
||||
public void CalculateInsigniaRequestBkkByType(string type = "officer")
|
||||
{
|
||||
CalInsigniaRequestBkkByType(type).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
//คำนวนผู้ได้รับเครื่องราชฯ
|
||||
public async Task CalInsigniaRequestBkkByType(string type = "officer")
|
||||
{
|
||||
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
||||
.Include(x => x.InsigniaRequests)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
insigniaPeriods = insigniaPeriods
|
||||
.Where(x => x.StartDate <= DateTime.Now.Date && x.InsigniaRequests.Where(x => x.ProfileType!.ToLower().Trim() == type.Trim().ToLower()).Count() == 0).ToList();
|
||||
|
||||
foreach (var insigniaPeriod in insigniaPeriods)
|
||||
{
|
||||
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
|
||||
if (organizations == null)
|
||||
continue;
|
||||
insigniaPeriod.RevisionId = Guid.Parse(organizations[0].OrgRevisionId);
|
||||
foreach (var organization in organizations)
|
||||
{
|
||||
if (organization == null)
|
||||
continue;
|
||||
|
||||
var result = await _repositoryInsignia.GetInsigniaRequestByTypeAsync(insigniaPeriod.Id, organization.Id, type);
|
||||
if (result != null)
|
||||
{
|
||||
Guid period = result.PeriodId;
|
||||
string requestStatus = result.RequestStatus;
|
||||
var candidate = await _repositoryInsignia.GetInsigniaCandidateBKKByTypeAsync(insigniaPeriod.Id, organization.Id, type);
|
||||
// ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
if (candidate != null)
|
||||
await _repositoryInsignia.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate, type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task CalInsignaiRequestBkk()
|
||||
{
|
||||
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
||||
|
|
@ -1635,10 +1109,13 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
{
|
||||
if (insigniaPeriod.StartDate >= DateTime.Now.Date || insigniaPeriod.InsigniaRequests.Count > 0)
|
||||
continue;
|
||||
//var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||
//if (organizationType == null)
|
||||
// continue;
|
||||
//var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
|
||||
if (organizations == null)
|
||||
continue;
|
||||
insigniaPeriod.RevisionId = Guid.Parse(organizations[0].OrgRevisionId);
|
||||
foreach (var organization in organizations)
|
||||
{
|
||||
if (organization == null)
|
||||
|
|
@ -1662,226 +1139,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<dynamic> GetKhr5TotalReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaNote>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
var data_insigniaQuery = _dbContext.Set<InsigniaNoteProfile>()
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Where(x => x.InsigniaNote.Id == period.Id)
|
||||
// .Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "DONE")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null);
|
||||
|
||||
if (type == "officer")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "employee");
|
||||
}
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
var data = await data_insigniaQuery.Select(x => new
|
||||
{
|
||||
Gendor = x.Gender ?? "",
|
||||
InsigniaTypeName = x.RequestInsignia.InsigniaType.Name,
|
||||
RequestInsigniaName = x.RequestInsignia.Name,
|
||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})", // Insignia's full name and short name
|
||||
OcId = x.Root
|
||||
}).ToListAsync();
|
||||
var insignia = (from r in data
|
||||
group r by new { OcId = r.OcId, r.InsigniaTypeName, r.RequestInsigniaName } into g
|
||||
select new
|
||||
{
|
||||
RowNo = 1,
|
||||
DepartmentName = g.Key.OcId,
|
||||
InsigniaTypeName = g.Key.InsigniaTypeName,
|
||||
RequestInsigniaName = g.Key.RequestInsigniaName,
|
||||
Male = g.Sum(x => x.Gendor == "ชาย" ? 1 : 0),
|
||||
Female = g.Sum(x => x.Gendor == "หญิง" ? 1 : 0),
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return insignia;
|
||||
}
|
||||
public async Task<dynamic> GetKhr6TotalReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaNote>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
var data_insigniaQuery = _dbContext.Set<InsigniaNoteProfile>()
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Where(x => x.InsigniaNote.Id == period.Id)
|
||||
// .Where(x => x.IsApprove == true)
|
||||
.Where(x => x.Status == "DONE")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null);
|
||||
|
||||
if (type == "officer")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "employee");
|
||||
}
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
var data = await data_insigniaQuery.Select(x => new
|
||||
{
|
||||
Gendor = x.Gender ?? "",
|
||||
InsigniaTypeName = x.RequestInsignia.InsigniaType.Name,
|
||||
RequestInsigniaName = x.RequestInsignia.Name,
|
||||
IsApprove = x.IsApprove,
|
||||
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})", // Insignia's full name and short name
|
||||
DatePayment = x.DatePayment,
|
||||
OcId = x.Root
|
||||
}).ToListAsync();
|
||||
var insignia = (from r in data
|
||||
group r by new { OcId = r.OcId, r.InsigniaTypeName, r.RequestInsigniaName } into g
|
||||
select new
|
||||
{
|
||||
RowNo = 1,
|
||||
DepartmentName = g.Key.OcId,
|
||||
InsigniaTypeName = g.Key.InsigniaTypeName,
|
||||
RequestInsigniaName = g.Key.RequestInsigniaName,
|
||||
/* Pending = g.Sum(x => x.IsApprove == false ? 1 : 0),
|
||||
Done = g.Sum(x => x.IsApprove == true ? 1 : 0),*/
|
||||
Pending = g.Sum(x => x.DatePayment == null ? 1 : 0),
|
||||
Done = g.Sum(x => x.DatePayment != null ? 1 : 0),
|
||||
Remark = "",
|
||||
}).ToList();
|
||||
|
||||
return insignia;
|
||||
}
|
||||
public async Task<dynamic> GetKhr4TotalReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaNote>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
var data_insigniaQuery = _dbContext.Set<InsigniaNoteProfile>()
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Where(x => x.InsigniaNote.Id == period.Id)
|
||||
.Where(x => x.Status == "DONE")
|
||||
.Where(x => x.RequestInsignia.InsigniaType != null);
|
||||
|
||||
if (type == "officer")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "officer");
|
||||
}
|
||||
else if (type == "employee")
|
||||
{
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType.Trim().ToLower() == "employee");
|
||||
}
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case 0:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootDnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3DnaId == nodeId);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4DnaId == nodeId);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
var data = await data_insigniaQuery.Select(x => new
|
||||
{
|
||||
CitizenId = x.CitizenId,
|
||||
Prefix = x.Prefix,
|
||||
FullName = $"{x.FirstName} {x.LastName}",
|
||||
PosTypeName = x.PosTypeName,
|
||||
PosLevelName = x.PosLevelName,
|
||||
Position = x.Position,
|
||||
Root = x.Root,
|
||||
OrganizationOrganizationReceive = x.OrganizationOrganizationReceive,
|
||||
OrganizationOrganizationSend = x.OrganizationOrganizationSend,
|
||||
IsApprove = x.IsApprove == true ? "ได้รับ" : "ไม่ได้รับ",
|
||||
RequestInsignia = x.RequestInsignia.Name,
|
||||
Number = x.Number,
|
||||
DatePayment = x.DatePayment,
|
||||
}).ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region 13 แบบมอบหมายงาน ฯ
|
||||
public async Task<object> GetProbationAssignAsync(Guid assign_id, string token)
|
||||
{
|
||||
var api_url = $"{_configuration["APIPROBATION"]}/assign?assign_id={assign_id}&isReport=true";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}/assign?assign_id={assign_id}";
|
||||
ProbationAssignResponse probation_assign;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
|
@ -82,15 +82,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace(" ", " ").ToString().ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var competencyGroups = probation_assign.result.competency_groups.Select(x => new
|
||||
{
|
||||
name = string.IsNullOrEmpty(x.name) ? string.Empty : x.name.ToThaiNumber(),
|
||||
level = string.IsNullOrEmpty(x.level) ? string.Empty : x.level.ToThaiNumber(),
|
||||
description = string.IsNullOrEmpty(x.description)
|
||||
? string.Empty
|
||||
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace(" ", " ").ToString().ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var outputs = probation_assign.result.outputs.Select(x => new
|
||||
{
|
||||
id = string.IsNullOrEmpty(x.id.ToString()) ? string.Empty : x.id.ToString().ToThaiNumber(),
|
||||
|
|
@ -98,26 +89,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
output_desc = string.IsNullOrEmpty(x.output_desc) ? string.Empty : x.output_desc.ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var skills = probation_assign.result.skills.Select(x => new
|
||||
{
|
||||
name = string.IsNullOrEmpty(x.title) ? string.Empty : x.title.ToThaiNumber(),
|
||||
level = string.IsNullOrEmpty(x.level) ? string.Empty : x.level.ToThaiNumber(),
|
||||
description = string.IsNullOrEmpty(x.description)
|
||||
? string.Empty
|
||||
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace(" ", " ").ToString().ToThaiNumber(),
|
||||
}).ToList();
|
||||
|
||||
var laws = probation_assign.result.laws.Where(x => x.selected == true).Select((x, Index) => new
|
||||
{
|
||||
title = string.IsNullOrEmpty(x.description) ? string.Empty : $"{(Index + 1).ToString().ToThaiNumber()}. {x.description.ToThaiNumber()}",
|
||||
}).ToList();
|
||||
|
||||
return new
|
||||
{
|
||||
Name = string.IsNullOrEmpty(probation_assign.result.profile.name) ? "-" : probation_assign.result.profile.name,
|
||||
Position = string.IsNullOrEmpty(probation_assign.result.profile.Position) ? "-" : probation_assign.result.profile.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(probation_assign.result.profile.positionLevelName) ? "-" : probation_assign.result.profile.positionLevelName,
|
||||
PositionAndLevel = string.IsNullOrEmpty(probation_assign.result.profile.PositionAndLevel) ? "-" : probation_assign.result.profile.PositionAndLevel,
|
||||
Department = string.IsNullOrEmpty(probation_assign.result.profile.Department) ? "-" : probation_assign.result.profile.Department,
|
||||
OrganizationOrganization = string.IsNullOrEmpty(probation_assign.result.profile.OrganizationOrganization) ? "-" : probation_assign.result.profile.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(probation_assign.result.profile.Oc) ? "-" : probation_assign.result.profile.Oc,
|
||||
|
|
@ -135,10 +111,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
Jobs = jobs,
|
||||
Knowledges = knowledges,
|
||||
Competencys = competencys,
|
||||
CompetencyGroups = competencyGroups,
|
||||
Outputs = outputs,
|
||||
Skills = skills,
|
||||
Laws = laws,
|
||||
OtherDesc = string.IsNullOrEmpty(probation_assign.result.assign.other_desc) ? "-" : probation_assign.result.assign.other_desc,
|
||||
Other4Desc = string.IsNullOrEmpty(probation_assign.result.assign.other4_desc) ? "-" : probation_assign.result.assign.other4_desc,
|
||||
Other5No1Desc = string.IsNullOrEmpty(probation_assign.result.assign.other5_no1_desc) ? "-" : probation_assign.result.assign.other5_no1_desc,
|
||||
|
|
@ -161,7 +134,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
|
@ -174,8 +147,26 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
var training_seminar = evaluate_record.result.evaluate.training_seminar == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ";
|
||||
var other_training = evaluate_record.result.evaluate.other_training == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ";
|
||||
|
||||
var expects = evaluate_record?.result?.evaluate?.achievements?.evaluate_expect_level ?? null;
|
||||
var outputs = evaluate_record?.result?.evaluate?.achievements?.evaluate_output_level ?? null;
|
||||
var expects = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
|
||||
? new
|
||||
{
|
||||
col1 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col1 == "/" ? "✓" : string.Empty,
|
||||
col2 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col2 == "/" ? "✓" : string.Empty,
|
||||
col3 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col3 == "/" ? "✓" : string.Empty,
|
||||
col4 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col4 == "/" ? "✓" : string.Empty,
|
||||
col5 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col5 == "/" ? "✓" : string.Empty,
|
||||
}
|
||||
: null;
|
||||
var outputs = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
|
||||
? new
|
||||
{
|
||||
col1 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col1 == "/" ? "✓" : string.Empty,
|
||||
col2 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col2 == "/" ? "✓" : string.Empty,
|
||||
col3 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col3 == "/" ? "✓" : string.Empty,
|
||||
col4 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col4 == "/" ? "✓" : string.Empty,
|
||||
col5 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col5 == "/" ? "✓" : string.Empty,
|
||||
}
|
||||
: null;
|
||||
var knows = evaluate_record.result.evaluate != null
|
||||
? new
|
||||
{
|
||||
|
|
@ -374,7 +365,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
DirectorDated = string.IsNullOrEmpty(evaluate_record.result.evaluate.sign_dated.ToString()) ? "-" : evaluate_record.result.evaluate.sign_dated.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Name = string.IsNullOrEmpty(evaluate_record.result.experimentee.name) ? string.Empty : evaluate_record.result.experimentee.name,
|
||||
Position = string.IsNullOrEmpty(evaluate_record.result.experimentee.Position) ? string.Empty : evaluate_record.result.experimentee.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(evaluate_record.result.experimentee.PositionLevelName) ? "-" : evaluate_record.result.experimentee.PositionLevelName,
|
||||
Department = string.IsNullOrEmpty(evaluate_record.result.experimentee.Department) ? string.Empty : evaluate_record.result.experimentee.Department,
|
||||
Organization = string.IsNullOrEmpty(evaluate_record.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_record.result.experimentee.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(evaluate_record.result.experimentee.Oc) ? string.Empty : evaluate_record.result.experimentee.Oc,
|
||||
|
|
@ -385,7 +375,13 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_record.result.evaluate.date_finish.ToString()) ? string.Empty : evaluate_record.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Role = evaluate_record.result.evaluate.role == "mentor" ? "ผู้ดูแลการทดลองปฏิบัติหน้าที่ราชการ" : "ผู้บังคับบัญชา",
|
||||
Expects = expects,
|
||||
ExpectDesc = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
|
||||
? evaluate_record.result.evaluate.achievements[0].evaluate_expect_desc
|
||||
: string.Empty,
|
||||
Outputs = outputs,
|
||||
OutputDesc = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
|
||||
? evaluate_record.result.evaluate.achievements[0].evaluate_output_desc
|
||||
: string.Empty,
|
||||
AchievementOtherDesc = evaluate_record.result.evaluate.achievement_other_desc,
|
||||
AchievementStrengthDesc = evaluate_record.result.evaluate.achievement_strength_desc,
|
||||
AchievementImproveDesc = evaluate_record.result.evaluate.achievement_improve_desc,
|
||||
|
|
@ -433,7 +429,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
|
@ -596,7 +592,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Name = string.IsNullOrEmpty(evaluate_assign.result.experimentee.name) ? string.Empty : evaluate_assign.result.experimentee.name,
|
||||
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
|
||||
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
|
||||
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
|
||||
|
|
@ -642,7 +637,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
|
@ -827,7 +822,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Name = string.IsNullOrEmpty(evaluate_assign.result.experimentee.name) ? string.Empty : evaluate_assign.result.experimentee.name,
|
||||
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
|
||||
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
|
||||
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
|
||||
|
|
@ -887,14 +881,14 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#endregion
|
||||
|
||||
#region 18 แบบรายงานการประเมินผล (สำหรับประธาน และ กรณีขยายเวลา)
|
||||
public async Task<object> GetEvaluateResultAssignAsync(Guid id, int no, string token)
|
||||
public async Task<object> GetEvaluateResultAssignAsync(Guid id, string token)
|
||||
{
|
||||
var api_url = $"{_configuration["APIPROBATION"]}/evaluate-result?assign_id={id}&evaluate_no={no}";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}/evaluate-result?assign_id={id}";
|
||||
EvaluateResultAssignResponse evaluate_assign;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, api_url);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
|
@ -909,18 +903,18 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
var developComplete2 = evaluate_assign.result.evaluate.develop_complete == 0
|
||||
? "🗹"
|
||||
: "☐";
|
||||
var passResult1 = evaluate_assign.result.evaluate.pass_result == 1 || evaluate_assign.result.evaluate.pass_result == 4
|
||||
? no == 1 ? "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป"
|
||||
: no == 1 ? "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป";
|
||||
var passResult1 = evaluate_assign.result.evaluate.pass_result == 1
|
||||
? "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็น ควรให้รับราชการต่อไป"
|
||||
: "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็น ควรให้รับราชการต่อไป";
|
||||
var passResult2 = evaluate_assign.result.evaluate.pass_result == 2
|
||||
? no == 1 ? "🗹 ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกจากราชการ" : "🗹 ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกราชการ"
|
||||
: no == 1 ? "☐ ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกจากราชการ" : "☐ ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกราชการ";
|
||||
? "🗹 ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกราชการต่อไป"
|
||||
: "☐ ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกราชการต่อไป";
|
||||
var passResult3 = evaluate_assign.result.evaluate.pass_result == 3
|
||||
? $"🗹 เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน"
|
||||
: "☐ เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก.....เดือน";
|
||||
|
||||
var passResult = evaluate_assign.result.evaluate.pass_result == 1 || evaluate_assign.result.evaluate.pass_result == 4
|
||||
? no == 1 ? "เห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "เห็นควรให้รับราชการต่อไป"
|
||||
var passResult = evaluate_assign.result.evaluate.pass_result == 1
|
||||
? "เห็นควรให้รับราชการต่อไป"
|
||||
: evaluate_assign.result.evaluate.pass_result == 2
|
||||
? "เห็นควรให้ออกจากราชการ"
|
||||
: $"เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน";
|
||||
|
|
@ -937,9 +931,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
return new
|
||||
{
|
||||
EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
|
||||
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
|
||||
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
|
||||
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
|
||||
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
|
||||
|
|
@ -947,12 +940,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
ExpandMonth = expandMonth,
|
||||
ChairmanName = string.IsNullOrEmpty(evaluate_assign.result.chairman.name) ? string.Empty : evaluate_assign.result.chairman.name,
|
||||
ChairmanPosition = string.IsNullOrEmpty(evaluate_assign.result.chairman.Position) ? string.Empty : evaluate_assign.result.chairman.Position,
|
||||
ChairmanDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.chairman_dated.ToString()) ? "-" : evaluate_assign.result.evaluate?.chairman_dated?.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
ChairmanDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.chairman_dated.ToString()) ? "-" : evaluate_assign.result.evaluate.chairman_dated.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
CommanderName = string.IsNullOrEmpty(evaluate_assign.result.commander.name) ? string.Empty : evaluate_assign.result.commander.name,
|
||||
CommanderPosition = string.IsNullOrEmpty(evaluate_assign.result.commander.position) ? string.Empty : evaluate_assign.result.commander.position,
|
||||
CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.commander.dated.ToString()) ? "-" : evaluate_assign.result.commander.dated?.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
CommanderPosition = string.IsNullOrEmpty(evaluate_assign.result.commander.Position) ? string.Empty : evaluate_assign.result.commander.Position,
|
||||
CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.director1_dated.ToString()) ? "-" : evaluate_assign.result.evaluate.director1_dated.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Name = evaluate_assign.result.experimentee.name,
|
||||
RoundNo = no.ToString().ToThaiNumber(),
|
||||
RoundNo = evaluate_assign.result.assign.round_no.ToString().ToThaiNumber(),
|
||||
DateStart = evaluate_assign.result.assign.date_start != string.Empty ? dateStart_ : "-",
|
||||
DateFinish = evaluate_assign.result.assign.date_finish != string.Empty ? dateFinish_ : "-",
|
||||
Develop1 = developComplete1,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Net.Http.Headers;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Reflection.Metadata;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
|
|
@ -10,7 +9,6 @@ using Microsoft.AspNetCore.Hosting;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
|
|
@ -23,23 +21,20 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public RetireReportRepository(IApplicationDBContext dbContext,
|
||||
MinIOService documentService,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
IWebHostEnvironment hostEnvironment,
|
||||
IConfiguration configuration)
|
||||
MinIOService documentService,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
_organizationCommonRepository = organizationCommonRepository;
|
||||
_documentService = documentService;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -69,43 +64,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
//}
|
||||
|
||||
#region รายงานประกาศเกษียณ
|
||||
public async Task<dynamic> GetProfileRetirementdAsync(Guid retireId, string token)
|
||||
public async Task<dynamic> GetProfileRetirementdAsync(Guid retireId)
|
||||
{
|
||||
var retire = await _dbContext.Set<RetirementPeriod>()
|
||||
.Include(x => x.RetirementProfiles)
|
||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||
// var retires = new List<dynamic>();
|
||||
var apiUrl = $"{_configuration["API"]}/org/root/search/sort";
|
||||
dynamic rootOrder = new List<string>();
|
||||
dynamic child1Order = new List<string>();
|
||||
dynamic child2Order = new List<string>();
|
||||
dynamic child3Order = new List<string>();
|
||||
dynamic child4Order = new List<string>();
|
||||
dynamic posTypeNameOrder = new List<string>();
|
||||
dynamic posLevelNameOrder = new List<string>();
|
||||
dynamic hospital = new List<string>();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||
|
||||
if (org != null && org.result != null)
|
||||
{
|
||||
rootOrder = org.result.root;
|
||||
child1Order = org.result.child1;
|
||||
child2Order = org.result.child2;
|
||||
child3Order = org.result.child3;
|
||||
child4Order = org.result.child4;
|
||||
posTypeNameOrder = org.result.posTypeNameOrder;
|
||||
posLevelNameOrder = org.result.posLevelNameOrder;
|
||||
hospital = org.result.hospital;
|
||||
}
|
||||
}
|
||||
if (retire == null)
|
||||
{
|
||||
var retireHistorys = await _dbContext.Set<RetirementPeriodHistory>().AsQueryable()
|
||||
|
|
@ -157,42 +121,20 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
profiles = profiles.OrderBy(x => x.order).ToList();
|
||||
}
|
||||
var mapProfiles = new List<ProfileRetireJsonRequest>();
|
||||
// string previousRoot = null;
|
||||
// string previousPosTypeName = null;
|
||||
// string previousPosLevelName = null;
|
||||
if (profiles.Count > 0)
|
||||
{
|
||||
mapProfiles = profiles
|
||||
// .OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
|
||||
// .ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
|
||||
// .ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
|
||||
.Select((profile, index) =>
|
||||
mapProfiles = profiles.Select((profile, index) => new ProfileRetireJsonRequest
|
||||
{
|
||||
// bool isDuplicateRoot = profile.root == previousRoot;
|
||||
// previousRoot = profile.root;
|
||||
// bool isDuplicatePosType = profile.posTypeName == previousPosTypeName;
|
||||
// previousPosTypeName = profile.posTypeName;
|
||||
// bool isDuplicatePosLevel = profile.posLevelName == previousPosLevelName;
|
||||
// previousPosLevelName = profile.posLevelName;
|
||||
return new ProfileRetireJsonRequest
|
||||
{
|
||||
order = retireHistorys.TypeReport == null ? (index + 1).ToString().ToThaiNumber() : $"{(index + 1).ToString().ToThaiNumber()}. ลำดับที่ {(profile.order).ToString().ToThaiNumber()}",
|
||||
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
|
||||
root = "",
|
||||
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
|
||||
(profile.child4 == null ? "" : profile.child4 + "\n") +
|
||||
(profile.child3 == null ? "" : profile.child3 + "\n") +
|
||||
(profile.child2 == null ? "" : profile.child2 + "\n") +
|
||||
(profile.child1 == null ? "" : profile.child1 + "\n") +
|
||||
(profile.reason == null ? "" : profile.reason),
|
||||
position = profile.position != "" && profile.position != null ? profile.position : "-",
|
||||
posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-",
|
||||
reason = profile.reason != "" && profile.reason != null ? profile.reason : "-",
|
||||
};
|
||||
order = (index + 1).ToString().ToThaiNumber(),
|
||||
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
|
||||
root = profile.root,
|
||||
position = profile.position != "" && profile.position != null ? profile.position : "-",
|
||||
posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-",
|
||||
reason = profile.reason != "" && profile.reason != null ? profile.reason : "-",
|
||||
}).ToList();
|
||||
}
|
||||
string SignDate = retireHistorys.SignDate != null ? DateTime.Parse(retireHistorys.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-";
|
||||
return new { SignDate, Detail = retireHistorys.Detail.ToThaiNumber(), retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profiles = mapProfiles };
|
||||
return new { SignDate, retireHistorys.Detail, retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profiles = mapProfiles };
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -266,67 +208,20 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
// retires.Add(data);
|
||||
// }
|
||||
var mapProfiles = new List<ProfileRetireJsonRequest>();
|
||||
string previousRoot = null;
|
||||
string previousChild1 = null;
|
||||
string previousPosTypeName = null;
|
||||
string previousPosLevelName = null;
|
||||
if (profile_retire.Count > 0)
|
||||
{
|
||||
if (retire.TypeReport == null)
|
||||
mapProfiles = profile_retire.Select((profile, index) => new ProfileRetireJsonRequest
|
||||
{
|
||||
profile_retire = profile_retire
|
||||
.OrderBy(x => string.IsNullOrEmpty(x.root) ? int.MaxValue : rootOrder.ToObject<List<string>>().IndexOf(x.root))
|
||||
.ThenBy(x => child1Order.ToObject<List<string>>().IndexOf(x.child1 ?? ""))
|
||||
.ThenBy(x => child2Order.ToObject<List<string>>().IndexOf(x.child2 ?? ""))
|
||||
.ThenBy(x => child3Order.ToObject<List<string>>().IndexOf(x.child3 ?? ""))
|
||||
.ThenBy(x => child4Order.ToObject<List<string>>().IndexOf(x.child4 ?? ""))
|
||||
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
|
||||
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
|
||||
.ThenBy(x => x.posNo).ToList();
|
||||
}
|
||||
mapProfiles = profile_retire.Select((profile, index) =>
|
||||
{
|
||||
bool isDuplicateRoot = profile.root == previousRoot;
|
||||
previousRoot = profile.root;
|
||||
if (isDuplicateRoot == false)
|
||||
{
|
||||
previousChild1 = null;
|
||||
previousPosTypeName = null;
|
||||
previousPosLevelName = null;
|
||||
}
|
||||
bool isDuplicateHospital = profile.child1 == previousChild1;
|
||||
previousChild1 = profile.child1;
|
||||
if (isDuplicateHospital == false)
|
||||
{
|
||||
previousPosTypeName = null;
|
||||
previousPosLevelName = null;
|
||||
}
|
||||
bool isDuplicatePosType = profile.posTypeName == previousPosTypeName;
|
||||
previousPosTypeName = profile.posTypeName;
|
||||
bool isDuplicatePosLevel = profile.posLevelName == previousPosLevelName;
|
||||
previousPosLevelName = profile.posLevelName;
|
||||
return new ProfileRetireJsonRequest
|
||||
{
|
||||
order = retire.TypeReport == null ? (index + 1).ToString().ToThaiNumber() : $"{(index + 1).ToString().ToThaiNumber()}. ลำดับที่ {(profile.order).ToString().ToThaiNumber()}",
|
||||
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
|
||||
root = (isDuplicateRoot ? "" : profile.root + "\n") +
|
||||
(isDuplicateHospital || !hospital.ToObject<List<string>>().Contains(profile.child1) ? "" : profile.child1 + "\n") +
|
||||
(isDuplicatePosType ? "" : $"ตำแหน่งประเภท{profile.posTypeName}" + "\n") +
|
||||
(isDuplicatePosLevel ? "" : $"ระดับ{profile.posLevelName}").ToThaiNumber(),
|
||||
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
|
||||
(profile.child4 == null ? "" : profile.child4 + "\n") +
|
||||
(profile.child3 == null ? "" : profile.child3 + "\n") +
|
||||
(profile.child2 == null ? "" : profile.child2 + "\n") +
|
||||
(profile.child1 == null || hospital.ToObject<List<string>>().Contains(profile.child1) ? "" : profile.child1 + "\n") +
|
||||
(profile.reason == null ? "" : profile.reason),
|
||||
position = profile.position != "" && profile.position != null ? profile.position : "-",
|
||||
posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-",
|
||||
reason = profile.reason != "" && profile.reason != null ? profile.reason : "-",
|
||||
};
|
||||
order = (index + 1).ToString().ToThaiNumber(),
|
||||
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
|
||||
root = profile.root,
|
||||
position = profile.position != "" && profile.position != null ? profile.position : "-",
|
||||
posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-",
|
||||
reason = profile.reason != "" && profile.reason != null ? profile.reason : "-",
|
||||
}).ToList();
|
||||
}
|
||||
string SignDate = retire.SignDate != null ? DateTime.Parse(retire.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-";
|
||||
return new { SignDate, Detail = retire.Detail.ToThaiNumber(), retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profiles = mapProfiles };
|
||||
return new { SignDate, retire.Detail, retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profiles = mapProfiles };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -356,6 +251,24 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
p.posMasterNo,
|
||||
p.posLevelName,
|
||||
p.posTypeName,
|
||||
|
||||
// ProfileId = p.Profile.Id,
|
||||
// Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||
// PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
||||
// p.Profile.FirstName,
|
||||
// p.Profile.LastName,
|
||||
// Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
||||
// PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
|
||||
// PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
||||
// PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
|
||||
// p.Profile.PositionLine,
|
||||
// p.Profile.PositionLineId,
|
||||
// PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
||||
// PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
|
||||
// p.Profile.PositionExecutive,
|
||||
// p.Profile.PositionExecutiveId,
|
||||
// Organization = p.Profile.Oc,
|
||||
// OrganizationId = p.Profile.OcId,
|
||||
p.position,
|
||||
p.Number,
|
||||
p.Date,
|
||||
|
|
@ -484,8 +397,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
p.Reason,
|
||||
p.ReasonResign,
|
||||
p.Remark,
|
||||
p.Status,
|
||||
salary = p.AmountOld,
|
||||
p.ApproveReason,
|
||||
|
|
@ -505,168 +416,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
p.CommanderRejectReason,
|
||||
p.CommanderRejectDate,
|
||||
p.RemarkHorizontal,
|
||||
Type = "OFFICER"
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
data = await _dbContext.Set<RetirementResignEmployee>().AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
p.prefix,
|
||||
p.firstName,
|
||||
p.lastName,
|
||||
p.profileId,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
p.Reason,
|
||||
p.ReasonResign,
|
||||
p.Remark,
|
||||
p.Status,
|
||||
salary = p.AmountOld,
|
||||
p.ApproveReason,
|
||||
p.RejectReason,
|
||||
p.IsActive,
|
||||
p.CreatedAt,
|
||||
p.PositionTypeOld,
|
||||
p.PositionLevelOld,
|
||||
p.PositionNumberOld,
|
||||
p.OrganizationPositionOld,
|
||||
p.OligarchReject,
|
||||
p.OligarchApproveReason,
|
||||
p.OligarchRejectReason,
|
||||
p.OligarchRejectDate,
|
||||
p.CommanderReject,
|
||||
p.CommanderApproveReason,
|
||||
p.CommanderRejectReason,
|
||||
p.CommanderRejectDate,
|
||||
p.RemarkHorizontal,
|
||||
Type = "EMPLOYEE",
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
var approverPositionExecutiveName = "...............";
|
||||
var approverStatus = "☐ อนุญาต";
|
||||
var approverRejectStatus = "☐ ยับยั้งการลาออกไว้จนถึงวันที่...................";
|
||||
var approver = "...................";
|
||||
var approverPosition = "...................";
|
||||
|
||||
var diffDate = "☐ ไม่น้อยกว่า ๓๐ วัน ☐ น้อยกว่า ๓๐ วัน";
|
||||
if (data.SendDate.HasValue && data.ActiveDate.HasValue)
|
||||
{
|
||||
var time = data.ActiveDate.Value - data.SendDate.Value;
|
||||
var day = time.TotalDays;
|
||||
if (day < 30)
|
||||
{
|
||||
diffDate = "☐ ไม่น้อยกว่า ๓๐ วัน ☑ น้อยกว่า ๓๐ วัน";
|
||||
}
|
||||
else
|
||||
{
|
||||
diffDate = "☑ ไม่น้อยกว่า ๓๐ วัน ☐ น้อยกว่า ๓๐ วัน";
|
||||
}
|
||||
}
|
||||
|
||||
var commanderDateUpdate = "วันที่...................";
|
||||
var commanderStatus = "☐ อนุญาต ตั้งแต่วันที่...................";
|
||||
var commanderCommentApprove = "...................";
|
||||
var commanderRejectStatus = "☐ ยับยั้งการลาออกไว้จนถึงวันที่...................";
|
||||
var commanderCommentReject = "...................";
|
||||
var commander = "...................";
|
||||
var commanderPosition = "...................";
|
||||
|
||||
if (data.Type == "OFFICER")
|
||||
{
|
||||
var Approver = _dbContext.Set<RetirementResignApprover>()
|
||||
.Where(x => x.RetirementResign.Id == data.Id && x.ApproveType == "APPROVER")
|
||||
.ToList();
|
||||
var Commander = _dbContext.Set<RetirementResignApprover>()
|
||||
.Where(x => x.RetirementResign.Id == data.Id && x.ApproveType == "COMMANDER")
|
||||
.OrderByDescending(x => x.Seq)
|
||||
.ToList();
|
||||
if (Approver.Count > 0)
|
||||
{
|
||||
approverPositionExecutiveName = Approver[0].PositionExecutiveName;
|
||||
approverStatus = Approver[0].ApproveStatus == "APPROVE" ? "☑ อนุญาต" : approverStatus;
|
||||
approverRejectStatus = Approver[0].ApproveStatus == "REJECT"
|
||||
? $"☑ ยับยั้งการลาออกไว้จนถึง{(Approver[0].RejectDate != null ? DateTime.Parse(Approver[0].RejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||
: approverRejectStatus;
|
||||
approver = $"{Approver[0].Prefix}{Approver[0].FirstName} {Approver[0].LastName}";
|
||||
approverPosition = Approver[0].PositionName;
|
||||
}
|
||||
if (Commander.Count > 0)
|
||||
{
|
||||
commanderDateUpdate = Commander.Count > 1
|
||||
? Commander[1].LastUpdatedAt != null
|
||||
? DateTime.Parse(Commander[1].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber()
|
||||
: commanderDateUpdate
|
||||
: Commander[0].LastUpdatedAt != null
|
||||
? DateTime.Parse(Commander[0].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber()
|
||||
: commanderDateUpdate;
|
||||
commanderStatus = Commander[0].ApproveStatus == "APPROVE"
|
||||
? $"☑ อนุญาต ตั้งแต่{(Commander[0].LastUpdatedAt != null ? DateTime.Parse(Commander[0].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||
: commanderStatus;
|
||||
commanderCommentApprove = Commander[0].ApproveStatus == "APPROVE"
|
||||
? !string.IsNullOrWhiteSpace(Commander[0].Comment) ? Commander[0].Comment : commanderCommentApprove
|
||||
: commanderCommentApprove;
|
||||
commanderRejectStatus = Commander[0].ApproveStatus == "REJECT"
|
||||
? $"☑ ยับยั้งการลาออกไว้จนถึง{(Commander[0].RejectDate != null ? DateTime.Parse(Commander[0].RejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||
: approverRejectStatus;
|
||||
commanderCommentReject = Commander[0].ApproveStatus == "REJECT"
|
||||
? !string.IsNullOrWhiteSpace(Commander[0].Comment) ? Commander[0].Comment : commanderCommentReject
|
||||
: commanderCommentReject;
|
||||
commander = $"{Commander[0].Prefix}{Commander[0].FirstName} {Commander[0].LastName}";
|
||||
commanderPosition = Commander[0].PositionName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var EmpApproves = _dbContext.Set<RetirementResignEmployeeApprover>()
|
||||
.Where(x => x.RetirementResignEmployee.Id == data.Id && x.ApproveType == "APPROVER")
|
||||
.ToList();
|
||||
var EmpCommander = _dbContext.Set<RetirementResignEmployeeApprover>()
|
||||
.Where(x => x.RetirementResignEmployee.Id == data.Id && x.ApproveType == "COMMANDER")
|
||||
.OrderByDescending(x => x.Seq)
|
||||
.ToList();
|
||||
if (EmpApproves.Count > 0)
|
||||
{
|
||||
approverPositionExecutiveName = EmpApproves[0].PositionExecutiveName;
|
||||
approverStatus = EmpApproves[0].ApproveStatus == "APPROVE" ? "☑ อนุญาต" : approverStatus;
|
||||
approverRejectStatus = EmpApproves[0].ApproveStatus == "REJECT"
|
||||
? $"☑ ยับยั้งการลาออกไว้จนถึง{(EmpApproves[0].RejectDate != null ? DateTime.Parse(EmpApproves[0].RejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||
: approverRejectStatus;
|
||||
approver = $"{EmpApproves[0].Prefix}{EmpApproves[0].FirstName} {EmpApproves[0].LastName}";
|
||||
approverPosition = EmpApproves[0].PositionName;
|
||||
}
|
||||
if (EmpCommander.Count > 0)
|
||||
{
|
||||
commanderDateUpdate = EmpCommander.Count > 1
|
||||
? EmpCommander[1].LastUpdatedAt != null
|
||||
? DateTime.Parse(EmpCommander[1].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber()
|
||||
: commanderDateUpdate
|
||||
: EmpCommander[0].LastUpdatedAt != null
|
||||
? DateTime.Parse(EmpCommander[0].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber()
|
||||
: commanderDateUpdate;
|
||||
commanderStatus = EmpCommander[0].ApproveStatus == "APPROVE"
|
||||
? $"☑ อนุญาต ตั้งแต่{(EmpCommander[0].LastUpdatedAt != null ? DateTime.Parse(EmpCommander[0].LastUpdatedAt.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||
: commanderStatus;
|
||||
commanderCommentApprove = EmpCommander[0].ApproveStatus == "APPROVE"
|
||||
? !string.IsNullOrWhiteSpace(EmpCommander[0].Comment) ? EmpCommander[0].Comment : commanderCommentApprove
|
||||
: commanderCommentApprove;
|
||||
commanderRejectStatus = EmpCommander[0].ApproveStatus == "REJECT"
|
||||
? $"☑ ยับยั้งการลาออกไว้จนถึง{(EmpCommander[0].RejectDate != null ? DateTime.Parse(EmpCommander[0].RejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "วันที่...................")}"
|
||||
: approverRejectStatus;
|
||||
commanderCommentReject = EmpCommander[0].ApproveStatus == "REJECT"
|
||||
? !string.IsNullOrWhiteSpace(EmpCommander[0].Comment) ? EmpCommander[0].Comment : commanderCommentReject
|
||||
: commanderCommentReject;
|
||||
commander = $"{EmpCommander[0].Prefix}{EmpCommander[0].FirstName} {EmpCommander[0].LastName}";
|
||||
commanderPosition = EmpCommander[0].PositionName;
|
||||
}
|
||||
}
|
||||
|
||||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
|
|
@ -674,14 +428,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
data.prefix,
|
||||
data.firstName,
|
||||
data.lastName,
|
||||
Location = string.IsNullOrEmpty(data.Location) ? string.Empty : data.Location.ToThaiNumber(),
|
||||
data.Location,
|
||||
FullName = $"{data.prefix}{data.firstName} {data.lastName}",
|
||||
SendDate = string.IsNullOrEmpty(data.SendDate.ToString()) ? string.Empty : DateTime.Parse(data.SendDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
ActiveDate = string.IsNullOrEmpty(data.ActiveDate.ToString()) ? string.Empty : DateTime.Parse(data.ActiveDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
data.Reason,
|
||||
data.ReasonResign,
|
||||
data.Remark,
|
||||
ReasonRemark = data.Reason == "OTHER" ? string.IsNullOrEmpty(data.Remark) ? data.ReasonResign : $"{data.ReasonResign}({data.Remark})" : data.ReasonResign,
|
||||
data.Status,
|
||||
data.salary,
|
||||
data.PositionTypeOld,
|
||||
|
|
@ -701,19 +452,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
data.CommanderRejectReason,
|
||||
CommanderRejectDate = string.IsNullOrEmpty(data.CommanderRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.CommanderRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
data.RemarkHorizontal,
|
||||
dear = approverPositionExecutiveName,
|
||||
approverStatus,
|
||||
approverRejectStatus,
|
||||
approver,
|
||||
approverPosition,
|
||||
diffDate,
|
||||
commanderDateUpdate,
|
||||
commanderStatus,
|
||||
commanderCommentApprove,
|
||||
commanderRejectStatus,
|
||||
commanderCommentReject,
|
||||
commander,
|
||||
commanderPosition
|
||||
};
|
||||
|
||||
return _data;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return new
|
||||
{
|
||||
//CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
||||
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
||||
};
|
||||
}
|
||||
|
|
@ -53,7 +52,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return new
|
||||
{
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
||||
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
||||
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
||||
};
|
||||
|
|
@ -68,7 +67,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
.FirstOrDefaultAsync();
|
||||
return new
|
||||
{
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
||||
Subject = $"ข้าราชการขอโอน",
|
||||
Name = $"{data.prefix}{data.firstName} {data.lastName}",
|
||||
Location = $"สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร ๑๗๓ ถนนดินสอ กทม. ๑๐๒๐๐",
|
||||
|
|
@ -85,7 +84,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return new
|
||||
{
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
||||
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
||||
Subject2 = $"ตรวจสอบหนี้สิน และภาระผูกพันกับกรุงเทพมหานครของข้าราชการ",
|
||||
Subject3 = $"ตรวจสอบหนี้สินและภาระผูกพันของข้าราชการ",
|
||||
|
|
@ -106,7 +105,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return new
|
||||
{
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
||||
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
||||
Subject2 = $"ตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ",
|
||||
Subject3 = $"ตรวจสอบภาระผูกพันกับกรุงเทพมหานครเกี่ยวกับการลาศึกษา อบรม ของข้าราชการ",
|
||||
|
|
@ -127,7 +126,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return new
|
||||
{
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate2().ToString().ToThaiNumber(),
|
||||
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
|
||||
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
|
||||
Subject2 = $"ตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ",
|
||||
Subject3 = $"ตรวจสอบภาระผูกพันกับกรุงเทพมหานครเกี่ยวกับการลาศึกษา อบรม ของข้าราชการ",
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,16 +1,8 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Models.Notifications;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
|
|
@ -19,28 +11,15 @@ namespace BMA.EHR.Application.Repositories
|
|||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly string URL = string.Empty;
|
||||
public RetirementRepository(IApplicationDBContext dbContext,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
UserProfileRepository userProfileRepository,
|
||||
IConfiguration configuration) : base(dbContext, httpContextAccessor)
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_configuration = configuration;
|
||||
URL = _configuration["VITE_URL_MGT"];
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
//ปลดออก
|
||||
public async Task NotifyDischarge()
|
||||
{
|
||||
|
|
@ -55,6 +34,11 @@ namespace BMA.EHR.Application.Repositories
|
|||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISCHARGE";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -73,6 +57,11 @@ namespace BMA.EHR.Application.Repositories
|
|||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISMISS";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -86,839 +75,18 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
//cronjobNoti.Profile.IsLeave = true;
|
||||
//cronjobNoti.Profile.LeaveReason = "LAYOFF";
|
||||
//cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public void TestMethod()
|
||||
{
|
||||
return;
|
||||
}
|
||||
public async Task<RetirementResign?> GetByIdAsync(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementResign>().AsQueryable()
|
||||
.Include(x => x.Approvers)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task OfficerApproveRetirementResign(Guid id)
|
||||
{
|
||||
var rawData = await GetByIdAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
rawData.Status = "PENDING";
|
||||
if (rawData.ApproveStep == "st1")
|
||||
{
|
||||
rawData.ApproveStep = "st2";
|
||||
}
|
||||
else if (rawData.ApproveStep == "st3")
|
||||
{
|
||||
rawData.ApproveStep = "st4";
|
||||
// TODO: Send notification to 1st Approver
|
||||
var _firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
// Send Notification
|
||||
var _noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = _firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(_noti1);
|
||||
}
|
||||
|
||||
// TODO: Send notification to 1st Commander
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "COMMANDER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task CommanderApproveRetirementResign(Guid id, string reason, DateTime? date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
|
||||
var rawData = await GetByIdAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
// if (rawData.ApproveStep != "st2")
|
||||
// {
|
||||
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
// }
|
||||
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
rawData.ApproveStep = "st3";
|
||||
|
||||
if (rawData.Group == "1.1")
|
||||
{
|
||||
// TODO: Send notification to 1st Approver
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CommanderRejectRetirementResign(Guid id, string reason, DateTime? date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
|
||||
var rawData = await GetByIdAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
// if (rawData.ApproveStep != "st2")
|
||||
// {
|
||||
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
// }
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
||||
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
|
||||
rawData.Status = "PENDING";
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
// rawData.LeaveComment = reason;
|
||||
// if (rawData.Group != "1.1")
|
||||
// {
|
||||
rawData.ApproveStep = "st3";
|
||||
// }
|
||||
|
||||
if (rawData.Group == "1.1")
|
||||
{
|
||||
// TODO: Send notification to 1st Approver
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task ApproveRetirementResign(Guid id, string reason, DateTime? date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
var rawData = await GetByIdAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
// if (rawData.ApproveStep != "st3")
|
||||
// {
|
||||
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
// }
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "APPROVE";
|
||||
// rawData.LeaveDirectorComment = reason;
|
||||
if (rawData.Group != "1.1")
|
||||
{
|
||||
rawData.ApproveStep = "st5";
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.ApproveStep = "st4";
|
||||
}
|
||||
|
||||
if (rawData.profileId != null)
|
||||
{
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณได้รับการอนุมัติ",
|
||||
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task RejectRetirementResign(Guid id, string reason, DateTime? date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
var rawData = await GetByIdAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
// if (rawData.ApproveStep != "st3")
|
||||
// {
|
||||
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
// }
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "REJECT";
|
||||
if (rawData.Group != "1.1")
|
||||
{
|
||||
rawData.ApproveStep = "st5";
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.ApproveStep = "st4";
|
||||
}
|
||||
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณไม่ได้รับการอนุมัติ \r\nเนื่องจาก{reason}",
|
||||
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<RetirementResignCancel?> GetByIdCancelAsync(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementResignCancel>().AsQueryable()
|
||||
.Include(x => x.Approvers)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task OfficerApproveRetirementResignCancel(Guid id)
|
||||
{
|
||||
var rawData = await GetByIdCancelAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
rawData.Status = "PENDING";
|
||||
if (rawData.ApproveStep == "st1")
|
||||
{
|
||||
rawData.ApproveStep = "st2";
|
||||
}
|
||||
else if (rawData.ApproveStep == "st3")
|
||||
{
|
||||
rawData.ApproveStep = "st4";
|
||||
// TODO: Send notification to 1st Approver
|
||||
var _firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
// Send Notification
|
||||
var _noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = _firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(_noti1);
|
||||
}
|
||||
|
||||
// TODO: Send notification to 1st Commander
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "COMMANDER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task CommanderApproveRetirementResignCancel(Guid id, string reason, DateTime? date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
|
||||
var rawData = await GetByIdCancelAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
// if (rawData.ApproveStep != "st2")
|
||||
// {
|
||||
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
// }
|
||||
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
rawData.ApproveStep = "st3";
|
||||
|
||||
if (rawData.Group == "1.1")
|
||||
{
|
||||
// TODO: Send notification to 1st Approver
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CommanderRejectRetirementResignCancel(Guid id, string reason, DateTime? date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
|
||||
var rawData = await GetByIdCancelAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
// if (rawData.ApproveStep != "st2")
|
||||
// {
|
||||
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
// }
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
||||
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
|
||||
rawData.Status = "PENDING";
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
// rawData.LeaveComment = reason;
|
||||
// if (rawData.Group != "1.1")
|
||||
// {
|
||||
rawData.ApproveStep = "st3";
|
||||
// }
|
||||
|
||||
if (rawData.Group == "1.1")
|
||||
{
|
||||
// TODO: Send notification to 1st Approver
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-detail-reject/{rawData.Id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task ApproveRetirementResignCancel(Guid id, string reason, DateTime? date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
var rawData = await GetByIdCancelAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
// if (rawData.ApproveStep != "st3")
|
||||
// {
|
||||
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
// }
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "APPROVE";
|
||||
// rawData.LeaveDirectorComment = reason;
|
||||
if (rawData.Group != "1.1")
|
||||
{
|
||||
rawData.ApproveStep = "st5";
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.ApproveStep = "st4";
|
||||
}
|
||||
|
||||
if (rawData.profileId != null)
|
||||
{
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณได้รับการอนุมัติ",
|
||||
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task RejectRetirementResignCancel(Guid id, string reason, DateTime? date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
var rawData = await GetByIdCancelAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
// if (rawData.ApproveStep != "st3")
|
||||
// {
|
||||
// throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
// }
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "REJECT";
|
||||
if (rawData.Group != "1.1")
|
||||
{
|
||||
rawData.ApproveStep = "st5";
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.ApproveStep = "st4";
|
||||
}
|
||||
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอยกเลิกลาออกของคุณไม่ได้รับการอนุมัติ \r\nเนื่องจาก{reason}",
|
||||
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,13 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Application.Requests
|
||||
{
|
||||
public class DirectorRequest
|
||||
{
|
||||
public DirectorRequestData[] result { get; set; }
|
||||
}
|
||||
public class DirectorRequestData
|
||||
{
|
||||
public string id { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -9,18 +9,4 @@ namespace BMA.EHR.Application.Requests
|
|||
public Guid? BorrowOrganizationId { get; set; }
|
||||
public Guid InsigniaNoteProfileId { get; set; }
|
||||
}
|
||||
|
||||
public class InsigniaReclaimRequest
|
||||
{
|
||||
public DateTime ReclaimDate { get; set; }
|
||||
public Guid InsigniaNoteProfileId { get; set; }
|
||||
|
||||
public string? ReclaimNote { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateInsigniaReclaimRequest
|
||||
{
|
||||
public DateTime ReclaimDate { get; set; }
|
||||
public string? ReclaimNote { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace BMA.EHR.Application.Requests
|
|||
public int Amount { get; set; }
|
||||
|
||||
public int Round { get; set; }
|
||||
public string[] EmpPosId { get; set; }
|
||||
public FormFile? File { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
public bool? MarkDiscipline { get; set; }
|
||||
public bool? MarkLeave { get; set; }
|
||||
public bool? MarkRate { get; set; }
|
||||
public bool? MarkInsignia { get; set; }
|
||||
public List<InsigniaRequestDoc>? Docs { get; set; }
|
||||
|
||||
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
||||
|
|
|
|||
|
|
@ -52,30 +52,9 @@ namespace BMA.EHR.Application.Requests
|
|||
public double? Amount { get; set; }
|
||||
public double? PositionSalaryAmount { get; set; }
|
||||
public Guid? RootId { get; set; }
|
||||
public Guid? RootDnaId { get; set; }
|
||||
public string? Root { get; set; }
|
||||
public Guid? Child1Id { get; set; }
|
||||
public Guid? Child1DnaId { get; set; }
|
||||
public string? Child1 { get; set; }
|
||||
public Guid? Child2Id { get; set; }
|
||||
public Guid? Child2DnaId { get; set; }
|
||||
public string? Child2 { get; set; }
|
||||
public Guid? Child3Id { get; set; }
|
||||
public Guid? Child3DnaId { get; set; }
|
||||
public string? Child3 { get; set; }
|
||||
public Guid? Child4Id { get; set; }
|
||||
public Guid? Child4DnaId { get; set; }
|
||||
public string? Child4 { get; set; }
|
||||
|
||||
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
||||
|
||||
public bool? MarkDiscipline { get; set; } = false;
|
||||
|
||||
public bool? MarkLeave { get; set; } = false;
|
||||
|
||||
public bool? MarkRate { get; set; } = false;
|
||||
|
||||
public bool? MarkInsignia { get; set; } = false;
|
||||
}
|
||||
|
||||
public class MatchingCondition
|
||||
|
|
|
|||
|
|
@ -10,9 +10,5 @@
|
|||
public string name { get; set; }
|
||||
|
||||
public string url { get; set; }
|
||||
|
||||
public bool? isReport { get; set; }
|
||||
|
||||
public bool? isTemplate { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ namespace BMA.EHR.Application.Responses
|
|||
public string Position { get; set; } = string.Empty;
|
||||
public string Department { get; set; } = string.Empty;
|
||||
public string Oc { get; set; } = string.Empty;
|
||||
public string PositionLevelName { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
public class Commander
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ namespace BMA.EHR.Application.Responses
|
|||
public string PositionLineId { get; set; } = string.Empty;
|
||||
public string OrganizationOrganization { get; set; } = string.Empty;
|
||||
public string Position { get; set; } = string.Empty;
|
||||
public string PositionLevelName { get; set; } = string.Empty;
|
||||
public string Department { get; set; } = string.Empty;
|
||||
public string Oc { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ namespace BMA.EHR.Application.Responses
|
|||
public string Department { get; set; }
|
||||
public string OrganizationOrganization { get; set; }
|
||||
public string Oc { get; set; }
|
||||
public string PositionLevelName { get; set; }
|
||||
}
|
||||
|
||||
public class Director
|
||||
|
|
@ -90,20 +89,19 @@ namespace BMA.EHR.Application.Responses
|
|||
public string role { get; set; }
|
||||
public DateTime createdAt { get; set; }
|
||||
public DateTime updatedAt { get; set; }
|
||||
public Achievement achievements { get; set; }
|
||||
public List<Achievement> achievements { get; set; }
|
||||
}
|
||||
|
||||
public class Achievement
|
||||
{
|
||||
// public string evaluate_expect_desc { get; set; }
|
||||
public List<EvaluateExpectLevel> evaluate_expect_level { get; set; }
|
||||
// public string evaluate_output_desc { get; set; }
|
||||
public List<EvaluateOutputLevel> evaluate_output_level { get; set; }
|
||||
public string evaluate_expect_desc { get; set; }
|
||||
public EvaluateExpectLevel evaluate_expect_level { get; set; }
|
||||
public string evaluate_output_desc { get; set; }
|
||||
public EvaluateOutputLevel evaluate_output_level { get; set; }
|
||||
}
|
||||
|
||||
public class EvaluateExpectLevel
|
||||
{
|
||||
public string? title { get; set; }
|
||||
public string col1 { get; set; }
|
||||
public string col2 { get; set; }
|
||||
public string col3 { get; set; }
|
||||
|
|
@ -113,7 +111,6 @@ namespace BMA.EHR.Application.Responses
|
|||
|
||||
public class EvaluateOutputLevel
|
||||
{
|
||||
public string? title { get; set; }
|
||||
public string col1 { get; set; }
|
||||
public string col2 { get; set; }
|
||||
public string col3 { get; set; }
|
||||
|
|
|
|||
|
|
@ -19,19 +19,15 @@ namespace BMA.EHR.Application.Responses
|
|||
|
||||
public class Commander
|
||||
{
|
||||
// public string personal_id { get; set; }
|
||||
public string personal_id { get; set; }
|
||||
public string name { get; set; }
|
||||
// public string PositionId { get; set; }
|
||||
// public string PositionLevelId { get; set; }
|
||||
// public string PositionLineId { get; set; }
|
||||
public string position { get; set; }
|
||||
// public string Department { get; set; }
|
||||
// public string OrganizationOrganization { get; set; }
|
||||
// public string Oc { get; set; }
|
||||
public DateTime? dated { get; set; }
|
||||
public string posLevel { get; set; }
|
||||
public string posType { get; set; }
|
||||
|
||||
public string PositionId { get; set; }
|
||||
public string PositionLevelId { get; set; }
|
||||
public string PositionLineId { get; set; }
|
||||
public string Position { get; set; }
|
||||
public string Department { get; set; }
|
||||
public string OrganizationOrganization { get; set; }
|
||||
public string Oc { get; set; }
|
||||
}
|
||||
|
||||
public class Chairman
|
||||
|
|
@ -68,7 +64,6 @@ namespace BMA.EHR.Application.Responses
|
|||
public string PositionLevelId { get; set; }
|
||||
public string PositionLineId { get; set; }
|
||||
public string Position { get; set; }
|
||||
public string PositionLevelName { get; set; }
|
||||
public string Department { get; set; }
|
||||
public string OrganizationOrganization { get; set; }
|
||||
public string Oc { get; set; }
|
||||
|
|
@ -104,9 +99,9 @@ namespace BMA.EHR.Application.Responses
|
|||
public int pass_result { get; set; }
|
||||
public int expand_month { get; set; }
|
||||
public string reson { get; set; }
|
||||
public DateTime? chairman_dated { get; set; }
|
||||
public DateTime? director1_dated { get; set; }
|
||||
public DateTime? director2_dated { get; set; }
|
||||
public DateTime chairman_dated { get; set; }
|
||||
public DateTime director1_dated { get; set; }
|
||||
public DateTime director2_dated { get; set; }
|
||||
public string createdAt { get; set; }
|
||||
public string updatedAt { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Insignias
|
||||
{
|
||||
public class PostProfileEmpInsigniaDto
|
||||
{
|
||||
public Guid profileEmployeeId { get; set; }
|
||||
|
||||
public int year { get; set; } = 0;
|
||||
|
||||
public string no { get; set; } = string.Empty;
|
||||
|
||||
public string volume { get; set; } = string.Empty;
|
||||
|
||||
public string section { get; set; } = string.Empty;
|
||||
|
||||
public string page { get; set; } = string.Empty;
|
||||
|
||||
public DateTime receiveDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
public Guid insigniaId { get; set; }
|
||||
|
||||
public DateTime dateAnnounce { get; set; } = DateTime.MinValue;
|
||||
|
||||
public string issue { get; set; } = string.Empty;
|
||||
|
||||
public string volumeNo { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? refCommandDate { get; set; }
|
||||
|
||||
public string refCommandNo { get; set; } = string.Empty;
|
||||
|
||||
public string note { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BMA.EHR.Application.Responses.Leaves
|
||||
{
|
||||
public class GetPermissionWithActingDto
|
||||
{
|
||||
public string privilege {get; set;} = string.Empty;
|
||||
public bool isAct {get; set;} = false;
|
||||
public List<ActingPermission> posMasterActs {get; set;} = new();
|
||||
}
|
||||
|
||||
public class ActingPermission
|
||||
{
|
||||
public string posNo {get; set;} = string.Empty;
|
||||
//public string? privilege {get; set;} = "PARENT";
|
||||
[JsonConverter(typeof(PrivilegeConverter))]
|
||||
public string privilege {get; set;} = "CHILD";
|
||||
|
||||
public Guid? rootDnaId {get; set;}
|
||||
public Guid? child1DnaId {get; set;}
|
||||
public Guid? child2DnaId {get; set;}
|
||||
public Guid? child3DnaId {get; set;}
|
||||
public Guid? child4DnaId {get; set;}
|
||||
}
|
||||
|
||||
public class GetPermissionWithActingResultDto
|
||||
{
|
||||
public int status {get; set;} = 0;
|
||||
public string message {get; set;} = string.Empty;
|
||||
public GetPermissionWithActingDto result {get; set;} = new();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Leaves
|
||||
{
|
||||
public class GetProfileLeaveByKeycloakDto
|
||||
{
|
||||
public string ProfileType { get; set; }
|
||||
public string Prefix { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string CitizenId { get; set; }
|
||||
public DateTime BirthDate { get; set; }
|
||||
public DateTime RetireDate { get; set; }
|
||||
public string GovAge { get; set; } = string.Empty;
|
||||
public string Age { get; set; } = string.Empty;
|
||||
public DateTime DateAppoint { get; set; }
|
||||
public DateTime DateCurrent { get; set; }
|
||||
public int? Amount { get; set; } = 0;
|
||||
public string? TelephoneNumber { get; set; } = string.Empty;
|
||||
public string Position { get; set; } = string.Empty;
|
||||
public string PosLevel { get; set; } = string.Empty;
|
||||
public string PosType { get; set; } = string.Empty;
|
||||
public string? PositionLeaveName { get; set; }
|
||||
public string? PosExecutiveName { get; set; }
|
||||
public string CurrentAddress { get; set; } = string.Empty;
|
||||
public string Oc { get; set; } = string.Empty;
|
||||
public bool isCommission { get; set; } = false;
|
||||
public string Root { get; set; } = string.Empty;
|
||||
public string? Child1 { get; set; }
|
||||
public string? Child2 { get; set; }
|
||||
public string? Child3 { get; set; }
|
||||
public string? Child4 { get; set; }
|
||||
public List<ProfileLeavePosition> Positions { get; set; } = new();
|
||||
public List<ProfileLeaveEducation> Educations { get; set; } = new();
|
||||
}
|
||||
|
||||
public class ProfileLeavePosition
|
||||
{
|
||||
public string? PositionName { get; set; } = string.Empty;
|
||||
public DateTime DateStart { get; set; }
|
||||
public DateTime DateEnd { get; set; }
|
||||
public string? PositionType { get; set; } = string.Empty;
|
||||
public string? PositionLevel { get; set; } = string.Empty;
|
||||
public string? OrgRoot { get; set; } = string.Empty;
|
||||
public string? OrgChild1 { get; set; } = string.Empty;
|
||||
public string? OrgChild2 { get; set; } = string.Empty;
|
||||
public string? OrgChild3 { get; set; } = string.Empty;
|
||||
public string? OrgChild4 { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class ProfileLeaveEducation
|
||||
{
|
||||
public string EducationLevel { get; set; } = string.Empty;
|
||||
public string Institute { get; set; } = string.Empty;
|
||||
public string? Country { get; set; } = string.Empty;
|
||||
public DateTime? FinishDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Leaves
|
||||
{
|
||||
public class GetProfileLeaveByKeycloakResultDto
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public int Status { get; set; } = -1;
|
||||
|
||||
public GetProfileLeaveByKeycloakDto? Result { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Leaves
|
||||
{
|
||||
public class GetSumApproveLeaveByRootDto
|
||||
{
|
||||
public string Root { get; set; } = string.Empty;
|
||||
|
||||
public double SumLeaveDay { get; set; }
|
||||
|
||||
public double sickDayCountMale { get; set; }
|
||||
public double maternityDayCountMale { get; set; }
|
||||
public double wifeDayCountMale { get; set; }
|
||||
public double personalDayCountMale { get; set; }
|
||||
public double restDayCountMale { get; set; }
|
||||
public double ordainDayCountMale { get; set; }
|
||||
public double absentDayCountMale { get; set; }
|
||||
public double studyDayCountMale { get; set; }
|
||||
public double agencyDayCountMale { get; set; }
|
||||
public double coupleDayCountMale { get; set; }
|
||||
public double therapyDayCountMale { get; set; }
|
||||
public double sickDayCountFemale { get; set; }
|
||||
public double maternityDayCountFemale { get; set; }
|
||||
public double wifeDayCountFemale { get; set; }
|
||||
public double personalDayCountFemale { get; set; }
|
||||
public double restDayCountFemale { get; set; }
|
||||
public double ordainDayCountFemale { get; set; }
|
||||
public double absentDayCountFemale { get; set; }
|
||||
public double studyDayCountFemale { get; set; }
|
||||
public double agencyDayCountFemale { get; set; }
|
||||
public double coupleDayCountFemale { get; set; }
|
||||
public double therapyDayCountFemale { get; set; }
|
||||
public double sickDayCountNo { get; set; }
|
||||
public double maternityDayCountNo { get; set; }
|
||||
public double wifeDayCountNo { get; set; }
|
||||
public double personalDayCountNo { get; set; }
|
||||
public double restDayCountNo { get; set; }
|
||||
public double ordainDayCountNo { get; set; }
|
||||
public double absentDayCountNo { get; set; }
|
||||
public double studyDayCountNo { get; set; }
|
||||
public double agencyDayCountNo { get; set; }
|
||||
public double coupleDayCountNo { get; set; }
|
||||
public double therapyDayCountNo { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
public string LeaveTypeCode { get; set; } = string.Empty;
|
||||
|
||||
public double SumLeaveDay { get; set; } = 0.0;
|
||||
|
||||
public int CountLeaveDay { get; set; } = 0;
|
||||
public double SumLeaveDay { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
public Guid LastUpdateUserId { get; set; }
|
||||
public string CreatedFullName { get; set; } = string.Empty;
|
||||
public string LastUpdateFullName { get; set; } = string.Empty;
|
||||
|
||||
public string OrgRootName { get; set; } = string.Empty;
|
||||
public string OrgRevisionId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,5 @@ namespace BMA.EHR.Application.Responses.Organizations
|
|||
public string? Child4 { get; set; }
|
||||
|
||||
public string? Child4ShortName { get; set; }
|
||||
|
||||
public Guid? RootDnaId { get; set; }
|
||||
public Guid? Child1DnaId { get; set; }
|
||||
public Guid? Child2DnaId { get; set; }
|
||||
public Guid? Child3DnaId { get; set; }
|
||||
public Guid? Child4DnaId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,7 @@
|
|||
public List<Job> jobs { get; set; }
|
||||
public List<Knowledge> knowledges { get; set; }
|
||||
public List<Competency> competencys { get; set; }
|
||||
public List<Competency> competency_groups { get; set; }
|
||||
public List<Output> outputs { get; set; }
|
||||
public List<Law> laws { get; set; }
|
||||
public List<Skill> skills { get; set; }
|
||||
}
|
||||
|
||||
public class Profile
|
||||
|
|
@ -31,8 +28,6 @@
|
|||
public string Position { get; set; } = string.Empty;
|
||||
public string Department { get; set; } = string.Empty;
|
||||
public string Oc { get; set; } = string.Empty;
|
||||
public string positionLevelName { get; set; } = string.Empty;
|
||||
public string PositionAndLevel { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Assign
|
||||
|
|
@ -77,21 +72,6 @@
|
|||
public string description { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Skill
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string level { get; set; } = string.Empty;
|
||||
public string title { get; set; } = string.Empty;
|
||||
public string description { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Law
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string description { get; set; } = string.Empty;
|
||||
public bool selected { get; set; }
|
||||
}
|
||||
|
||||
public class Competency
|
||||
{
|
||||
public string id { get; set; } = string.Empty;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
public string? posNo { get; set; }
|
||||
public string? root { get; set; }
|
||||
public string? reason { get; set; }
|
||||
public string? child { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetListProfileByKeycloakIdRootResultDto
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public int Status { get; set; } = -1;
|
||||
|
||||
public List<GetProfileByKeycloakIdRootDto> Result { get; set; } = new();
|
||||
}
|
||||
public class GetListProfileByKeycloakIdRootResultAddTotalDto
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public int Status { get; set; } = -1;
|
||||
|
||||
public GetProfileByKeycloakIdRootAddTotalDto Result { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetMarkStatusDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public bool? MarkDiscipline { get; set; } = false;
|
||||
public bool? MarkLeave { get; set; } = false;
|
||||
public bool? MarkRate { get; set; } = false;
|
||||
public bool? MarkInsignia { get; set; } = false;
|
||||
|
||||
public string? APR1 { get; set; }
|
||||
public string? APR2 { get; set; }
|
||||
public string? APR3 { get; set; }
|
||||
public string? APR4 { get; set; }
|
||||
public string? APR5 { get; set; }
|
||||
|
||||
public string? OCT1 { get; set; }
|
||||
public string? OCT2 { get; set; }
|
||||
public string? OCT3 { get; set; }
|
||||
public string? OCT4 { get; set; }
|
||||
public string? OCT5 { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetMarkStatusResultDto
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public int Status { get; set; } = -1;
|
||||
|
||||
public List<GetMarkStatusDto> Result { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetOcStaff
|
||||
{
|
||||
public Guid ProfileId { get; set; }
|
||||
public Guid Keycloak { get; set; }
|
||||
public string FullName { get; set; } = null!;
|
||||
public Guid? RootId { get; set; }
|
||||
public Guid? OrgChild1Id { get; set; }
|
||||
public Guid? OrgChild2Id { get; set; }
|
||||
public Guid? OrgChild3Id { get; set; }
|
||||
public Guid? OrgChild4Id { get; set; }
|
||||
public Guid? RootDnaId { get; set; }
|
||||
public Guid? Child1DnaId { get; set; }
|
||||
public Guid? Child2DnaId { get; set; }
|
||||
public Guid? Child3DnaId { get; set; }
|
||||
public Guid? Child4DnaId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class GetOcStaffResultDto
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public int Status { get; set; } = -1;
|
||||
|
||||
public List<GetOcStaff> Result { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetOrgProfileByProfileIdDto
|
||||
{
|
||||
public string? Root { get; set; }
|
||||
public string? Child1 { get; set; }
|
||||
public string? Child2 { get; set; }
|
||||
public string? Child3 { get; set; }
|
||||
public string? Child4 { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetOrgProfileByProfileIdResultDto
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public int Status { get; set; } = -1;
|
||||
|
||||
public GetOrgProfileByProfileIdDto? Result { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -44,8 +44,6 @@ namespace BMA.EHR.Application.Responses.Profiles
|
|||
public string? ProfileType { get; set; }
|
||||
public bool? IsLeave { get; set; }
|
||||
|
||||
public bool? IsProbation { get; set; }
|
||||
|
||||
public string? Root { get; set; }
|
||||
public string? Child1 { get; set; }
|
||||
public string? Child2 { get; set; }
|
||||
|
|
@ -56,37 +54,10 @@ namespace BMA.EHR.Application.Responses.Profiles
|
|||
public Guid? Child2Id { get; set; }
|
||||
public Guid? Child3Id { get; set; }
|
||||
public Guid? Child4Id { get; set; }
|
||||
public Guid? RootDnaId { get; set; }
|
||||
public Guid? Child1DnaId { get; set; }
|
||||
public Guid? Child2DnaId { get; set; }
|
||||
public Guid? Child3DnaId { get; set; }
|
||||
public Guid? Child4DnaId { get; set; }
|
||||
public double? Amount { get; set; }
|
||||
public double? PositionSalaryAmount { get; set; }
|
||||
public string? Commander { get; set; }
|
||||
|
||||
public Guid? CommanderId { get; set; }
|
||||
|
||||
public Guid? CommanderKeycloak { get; set; }
|
||||
|
||||
public string? TelephoneNumber { get; set; }
|
||||
|
||||
public string? CurrentAddress { get; set; }
|
||||
|
||||
public string? CurrentSubDistrict { get; set; }
|
||||
|
||||
public string? CurrentDistrict { get; set; }
|
||||
|
||||
public string? CurrentProvince { get; set; }
|
||||
|
||||
public string? CurrentZipCode { get; set; }
|
||||
|
||||
public string? PositionLeaveName { get; set; }
|
||||
|
||||
public string? PosExecutiveName { get; set; }
|
||||
|
||||
public string? CommanderPositionName { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
public class PosLevel
|
||||
|
|
@ -123,7 +94,7 @@ namespace BMA.EHR.Application.Responses.Profiles
|
|||
public Guid? LastUpdateUserId { get; set; }
|
||||
public string? CreatedFullName { get; set; }
|
||||
public string? LastUpdateFullName { get; set; }
|
||||
public string? PosNo { get; set; } = string.Empty;
|
||||
public string PosNo { get; set; } = string.Empty;
|
||||
|
||||
public double? Amount { get; set; }
|
||||
|
||||
|
|
@ -131,15 +102,15 @@ namespace BMA.EHR.Application.Responses.Profiles
|
|||
|
||||
public double? MouthSalaryAmount { get; set; }
|
||||
|
||||
public int? Order { get; set; }
|
||||
public int Order { get; set; }
|
||||
|
||||
public DateTime? Date { get; set; }
|
||||
|
||||
public string? PositionLevel { get; set; } = string.Empty;
|
||||
public string PositionLevel { get; set; } = string.Empty;
|
||||
|
||||
public string? PositionType { get; set; } = string.Empty;
|
||||
public string PositionType { get; set; } = string.Empty;
|
||||
|
||||
public string? Position { get; set; } = string.Empty;
|
||||
public string Position { get; set; } = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
using BMA.EHR.Domain.Models.HR;
|
||||
|
||||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetProfileByKeycloakIdRootDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string? Prefix { get; set; }
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
public string? CitizenId { get; set; }
|
||||
public Guid? Keycloak { get; set; }
|
||||
public string? PosNo { get; set; }
|
||||
public string? Position { get; set; }
|
||||
public string? PositionLevel { get; set; }
|
||||
public string? PositionType { get; set; }
|
||||
public string? Oc { get; set; }
|
||||
public string? OrgRootId { get; set; }
|
||||
public string? OrgChild1Id { get; set; }
|
||||
public string? OrgChild2Id { get; set; }
|
||||
public string? OrgChild3Id { get; set; }
|
||||
public string? OrgChild4Id { get; set; }
|
||||
|
||||
public DateTime? DateStart { get; set; }
|
||||
|
||||
public DateTime? DateAppoint { get; set; }
|
||||
|
||||
public string? RootDnaId { get; set; }
|
||||
public string? Child1DnaId { get; set; }
|
||||
public string? Child2DnaId { get; set; }
|
||||
public string? Child3DnaId { get; set; }
|
||||
public string? Child4DnaId { get; set; }
|
||||
}
|
||||
|
||||
public class GetProfileByKeycloakIdRootAddTotalDto
|
||||
{
|
||||
public List<GetProfileByKeycloakIdRootDto> Data { get; set; } = new();
|
||||
|
||||
public int Total { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -49,29 +49,6 @@ namespace BMA.EHR.Application.Responses.Profiles
|
|||
public double? Amount { get; set; }
|
||||
public double? PositionSalaryAmount { get; set; }
|
||||
public Guid? RootId { get; set; }
|
||||
public Guid? RootDnaId { get; set; }
|
||||
public string? Root { get; set; }
|
||||
public Guid? Child1Id { get; set; }
|
||||
public Guid? Child1DnaId { get; set; }
|
||||
public string? Child1 { get; set; }
|
||||
public Guid? Child2Id { get; set; }
|
||||
public Guid? Child2DnaId { get; set; }
|
||||
public string? Child2 { get; set; }
|
||||
public Guid? Child3Id { get; set; }
|
||||
public Guid? Child3DnaId { get; set; }
|
||||
public string? Child3 { get; set; }
|
||||
public Guid? Child4Id { get; set; }
|
||||
public Guid? Child4DnaId { get; set; }
|
||||
public string? Child4 { get; set; }
|
||||
|
||||
public string? ProfileType { get; set; }
|
||||
|
||||
public bool? MarkDiscipline { get; set; } = false;
|
||||
|
||||
public bool? MarkLeave { get; set; } = false;
|
||||
|
||||
public bool? MarkRate { get; set; } = false;
|
||||
|
||||
public bool? MarkInsignia { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetProfileSalaryDto
|
||||
{
|
||||
public DateTime DateAffect { get; set; }
|
||||
public string Position { get; set; } = string.Empty;
|
||||
public string Root { get; set; } = string.Empty;
|
||||
public string Child1 { get; set; } = string.Empty;
|
||||
public string Child2 { get; set; } = string.Empty;
|
||||
public string Child3 { get; set; } = string.Empty;
|
||||
public string Child4 { get; set; } = string.Empty;
|
||||
public int Age { get; set; } = 0;
|
||||
public int Amount { get; set; } = 0;
|
||||
public string Remark { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
namespace BMA.EHR.Application.Responses.Profiles
|
||||
{
|
||||
public class GetProfileSalaryResultDto
|
||||
{
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
public int Status { get; set; } = -1;
|
||||
|
||||
public List<GetProfileSalaryDto> Result { get; set; } = new();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue