Диплом: Автоматизация приема заявок на ремонт и модернизацию ВК в ООО Гео-Свет

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
95
--
-- Структура таблицы `ticket`
--
CREATE TABLE `ticket` (
`id` int(11) NOT NULL,
`statusid` int(11) DEFAULT NULL,
`authorid` int(11) DEFAULT NULL,
`userid` int(11) DEFAULT NULL,
`typeid` int(11) DEFAULT NULL,
`description` longtext COLLATE utf8_unicode_ci,
`createdat` datetime NOT NULL,
`modifiedat` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Структура таблицы `typeticket`
--
CREATE TABLE `typeticket` (
`id` int(11) NOT NULL,
`caption` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`active` tinyint(1) NOT NULL,
`createdat` datetime NOT NULL,
`modifiedat` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Структура таблицы `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`salt` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`createdat` datetime NOT NULL,
`modifiedat` datetime NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deleted` tinyint(1) NOT NULL,
`userfio` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`departmentid` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `comment`
--
ALTER TABLE `comment`
96
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_9474526C3412DD5F` (`authorid`),
ADD KEY `IDX_9474526C9274C08F` (`ticketid`);
--
-- Индексы таблицы `department`
--
ALTER TABLE `department`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `UNIQ_B63E2EC757698A6A` (`role`);
--
-- Индексы таблицы `status`
--
ALTER TABLE `status`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `ticket`
--
ALTER TABLE `ticket`
ADD PRIMARY KEY (`id`),
ADD KEY `IDX_97A0ADA36496D4DA` (`statusid`),
ADD KEY `IDX_97A0ADA33412DD5F` (`authorid`),
ADD KEY `IDX_97A0ADA3F132696E` (`userid`),
ADD KEY `IDX_97A0ADA3E70B032` (`typeid`);
--
-- Индексы таблицы `typeticket`
--
ALTER TABLE `typeticket`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `UNIQ_1483A5E9F85E0677` (`username`),
ADD KEY `IDX_1483A5E9A9580862` (`departmentid`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
97
--
-- AUTO_INCREMENT для таблицы `comment`
--
ALTER TABLE `comment`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT для таблицы `department`
--
ALTER TABLE `department`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;
--
-- AUTO_INCREMENT для таблицы `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT для таблицы `status`
--
ALTER TABLE `status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT для таблицы `ticket`
--
ALTER TABLE `ticket`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT для таблицы `typeticket`
--
ALTER TABLE `typeticket`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT для таблицы `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- Ограничения внешнего ключа сохраненных таблиц
--
--
-- Ограничения внешнего ключа таблицы `comment`
--
ALTER TABLE `comment`
ADD CONSTRAINT `FK_9474526C3412DD5F` FOREIGN KEY (`authorid`)
REFERENCES `users` (`id`),
ADD CONSTRAINT `FK_9474526C9274C08F` FOREIGN KEY (`ticketid`)
REFERENCES `ticket` (`id`);
--
-- Ограничения внешнего ключа таблицы `ticket`
--
98
ALTER TABLE `ticket`
ADD CONSTRAINT `FK_97A0ADA33412DD5F` FOREIGN KEY (`authorid`)
REFERENCES `users` (`id`),
ADD CONSTRAINT `FK_97A0ADA36496D4DA` FOREIGN KEY (`statusid`)
REFERENCES `status` (`id`),
ADD CONSTRAINT `FK_97A0ADA3E70B032` FOREIGN KEY (`typeid`)
REFERENCES `typeticket` (`id`),
ADD CONSTRAINT `FK_97A0ADA3F132696E` FOREIGN KEY (`userid`)
REFERENCES `users` (`id`);
--
-- Ограничения внешнего ключа таблицы `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `FK_1483A5E9A9580862` FOREIGN KEY (`departmentid`)
REFERENCES `department` (`id`);
99
Приложение 2 Исходный код программных модулей
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Comment;
use AppBundle\Entity\ProductCategory;
use AppBundle\Entity\Ticket;
use AppBundle\Entity\TicketStatus;
use AppBundle\Entity\TypeTicket;
use AppBundle\Form\Type\MyTicketFilterFormType;
use AppBundle\Form\Type\ProductCategoryFilterFormType;
use AppBundle\Form\Type\ProductCategoryFormType;
use AppBundle\Form\Type\ProductFormType;
use AppBundle\Entity\Role;
use AppBundle\Entity\Product;
use AppBundle\Form\Type\TicketCommentFormType;
use AppBundle\Form\Type\TicketFilterFormType;
use AppBundle\Form\Type\TicketFormType;
use AppBundle\Form\Type\TypeTicketFilterFormType;
use AppBundle\Form\Type\TypeTicketFormType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
class TicketController extends InitializableController
{
/**
* @return RedirectResponse|Response
* @Config\Route("/tickets", name = "site_tickets_index")
*/
public function indexAction()
{
if (($this->authChecker->isGranted(Role::TEHNIC)) ||
($this->authChecker->isGranted(Role::PROGER))) {
$form=$this->createForm(new MyTicketFilterFormType());
$id = null;
$status=null;
$my = null;
$form->handleRequest($this->request);
$tickets = $this->getRepository('Ticket')-
>createQueryBuilder('t')
->leftJoin('t.status', 's')
->leftJoin('t.user', 'u')
->where('1=1');
if ($form->isSubmitted() && $form->isValid()) {
$id = $form->get('id')->getData();
$status = $form->get('status')->getData();
$my = $form->get('my')->getData();
}
if (!empty($id)) {
100
$tickets->andWhere('t.id = :id ')-
>setParameter('id', $id);
}
if (!empty($status)) {
$tickets->andWhere('s.id = :status ')-
>setParameter('status', $status);
}
if (!empty($my)) {
$tickets->andWhere('u.id = :user ')-
>setParameter('user', $this->user->getId());
}
}
else {
$form=$this->createForm(new TicketFilterFormType());
$id = null;
$status=null;
$form->handleRequest($this->request);
$tickets = $this->getRepository('Ticket')-
>createQueryBuilder('t')
->leftJoin('t.status', 's')
->leftJoin('t.author', 'u')
->where('1=1');
if ($form->isSubmitted() && $form->isValid()) {
$id = $form->get('id')->getData();
$status = $form->get('status')->getData();
}
if (!empty($id)) {
$tickets->andWhere('t.id = :id ')-
>setParameter('id', $id);
}
if (!empty($status)) {
$tickets->andWhere('s.id = :status ')-
>setParameter('status', $status);
}
$tickets->andWhere('u.id = :user ')-
>setParameter('user', $this->user->getId());
}
$tickets=$tickets->getQuery()->getResult();
$this->view['tickets'] = $tickets;
$this->view['form'] = $form->createView();
$this->navigation = array('active' => 'tickets');
return $this->render('AppBundle:Tickets:index.html.twig');
}
/**
* @return RedirectResponse|Response
* @Config\Route("/tickets/add", name = "site_tickets_add")
*/
public function addAction()
{
$ticket = new Ticket();
$form = $this->createForm(new TicketFormType(), $ticket);
101
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$ticket->setAuthor($this->user);
/* @var TicketStatus $status*/
$status=$this->getRepository('TicketStatus')-
>findOneBy(array('id'=>1));
$ticket->setStatus($status);
$this->manager->persist($ticket);
$this->manager->flush();
$this->addNotice('success',
'tickets.html.twig',
array('notice' => 'added', 'id' => $ticket-
>getId())
);
return $this-
>redirectToRoute('site_tickets_index');
}
$this->forms['ticket'] = $form->createView();
$this->navigation = array('active' => 'tickets');
$this->view['ticket']=null;
return $this->render('AppBundle:Tickets:add.html.twig');
}
/**
* @param Ticket $ticket
* @return RedirectResponse|Response
* @Config\Route("/tickets/{ticket}/edit", name =
"site_tickets_edit")
* @Config\ParamConverter("ticket", options = {"mapping":
{"ticket": "id"}})
*/
public function editAction(Ticket $ticket)
{
$comment= new Comment();
$form = $this->createForm(new TicketCommentFormType(),
$comment);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$comment->setTicket($ticket);
$comment->setAuthor($this->user);
if (is_null($ticket->getUser()) && $this->user !=
$ticket->getAuthor()) {
$ticket->setUser($this->user);
$this->manager->persist($ticket);
}
$comment->upload();
$this->manager->persist($comment);
$this->manager->flush();
return $this->redirectToRoute('site_tickets_edit',
array('ticket'=>$ticket->getId()));
}
$this->forms['comment'] = $form->createView();
102
$this->view['ticket'] = $ticket;
$this->navigation = array('active' => 'tickets');
return $this->render('AppBundle:Tickets:edit.html.twig');
}
/**
* @param Ticket $ticket
* @param TicketStatus $status
* @return RedirectResponse|Response
* @Config\Route("/tickets/{ticket}/change/{status}", name =
"site_tickets_change")
* @Config\ParamConverter("ticket", options = {"mapping":
{"ticket": "id"}})
* @Config\ParamConverter("status", options = {"mapping":
{"srarus": "id"}})
*/
public function changeAction(Ticket $ticket, TicketStatus
$status)
{
$ticket->setStatus($status);
if ($status->getId()==4) {
$this->addNotice('success',
'tickets.html.twig',
array('notice' => 'closed', 'id' => $ticket-
>getId())
);
}
if ($status->getId()==3) {
$this->addNotice('info',
'tickets.html.twig',
array('notice' => 'sendmodified', 'id' => $ticket-
>getId())
);
$ticket->setUser(null);
}
$this->manager->persist($ticket);
$this->manager->flush();
$this->navigation = array('active' => 'tickets');
return $this->render('AppBundle:Tickets:index.html.twig');
}
}
<?php
namespace AppBundle\Controller;
use AppBundle\Form\Type\LoginFormType;
use AppBundle\Form\Type\ProfileFormType;
use AppBundle\Controller\InitializableController;
use AppBundle\Entity\Role;
use AppBundle\Entity\User;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
use Symfony\Component\Form\FormError;
103
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;
use Symfony\Component\Security\Core\Security;
class SecurityController extends InitializableController
{
/**
* @return RedirectResponse|Response
* @Config\Route("/login", name = "site_security_login")
*/
public function loginAction()
{
if ($this->authChecker->isGranted(Role::USER)) return
$this->redirectToRoute('homepage');
$error = null;
if ($this->request->attributes-
>has(Security::AUTHENTICATION_ERROR))
$error = $this->request->attributes-
>get(Security::AUTHENTICATION_ERROR);
else {
$error = $this->session-
>get(Security::AUTHENTICATION_ERROR, null);
$this->session-
>remove(Security::AUTHENTICATION_ERROR);
}
if (!is_null($error)) {
$this->addNotice('error', 'security_login.html.twig',
array('notice' => 'auth_error'));
}
$form = $this->createForm(new LoginFormType(), new User());
$this->navigation = array('active' => 'login');
$this->forms = array(
'login' => $form->createView(),
'last_username' => $this->session-
>get(Security::LAST_USERNAME, null)
);
return $this->render('AppBundle:Security:login.html.twig');
}
/**
* @throws NotFoundHttpException
* @Config\Route("/login-check", name =
"site_security_login_check")
*/
public function loginCheckAction()
{
throw $this->createNotFoundException();
}
/**
* @throws NotFoundHttpException
* @Config\Route("/logout", name = "site_security_logout")
104
*/
public function logoutAction()
{
throw $this->createNotFoundException();
}
/**
* @return RedirectResponse|Response
* @Config\Route("/profile", name = "site_security_profile")
*/
public function profileAction()
{
$form = $this->createForm(new ProfileFormType(), $this-
>user);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
if (!is_null($form->get('password')->getData())) {
/** @var UserPasswordEncoder $encoder */
$encoder = $this->get('security.password_encoder');
$this->user->setSalt(User::generateSalt())
->setPassword($encoder->encodePassword($this-
>user, $this->user->getPassword()));
$this->manager->persist($this->user);
$this->manager->flush();
}
$this->addNotice('success',
'security_profile.html.twig',
array('notice' => 'user_changed')
);
return $this->redirectToRoute('homepage');
}
$this->forms['profile'] = $form->createView();
$this->navigation = array('active' => 'homepage');
return $this-
>render('AppBundle:Security:profile.html.twig');
}
}
<!DOCTYPE html>
<html>
<head>
<title>{% block head_title %}Главная{% endblock %} | Технический
отдел </title>
{% block head_meta %}
<meta http-equiv="content-type" content="text/html;
charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-
scale=1">
{% endblock %}
{% block head_link %}

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
IPO - инструмент финансирования деятельности организации. На примере ПАО «Нефтяная компания «Лукойл»
PR как средство продвижения организации (на примере ПАО "Тамбовский завод "Комсомолец им. Н.С. Артемова")
PR-коммуникации в сфере общественного питания (на примере кафе-кондитерской «Cream Cheese»)
SMM как средство повышения эффективности работы учреждений социокультурной сферы (на примере Малого театра)